2021-01-30 03:52:26 +01:00

144 lines
6.4 KiB
YAML

name: ocelot.social CI
on: [push]
jobs:
##############################################################################
# JOB: PREPARE #####################################################
##############################################################################
prepare:
name: Prepare
runs-on: ubuntu-latest
# needs: nothing
steps:
##########################################################################
# CHECKOUT CODE ##########################################################
##########################################################################
- name: Checkout code
uses: actions/checkout@v2
##########################################################################
# TODO: DO STUFF ??? #####################################################
##########################################################################
- name: Check translation files
run: |
scripts/translations/sort.sh
scripts/translations/missing-keys.sh
##############################################################################
# JOB: DOCKER BUILD TEST #####################################################
##############################################################################
build_test:
name: Docker Build Test
runs-on: ubuntu-latest
needs: prepare
steps:
##########################################################################
# NEO4J ##################################################################
##########################################################################
- name: Neo4J | Build `community` image
uses: docker/build-push-action@v1.1.0
with:
repository: ocelotsocialnetwork/neo4j
tags: latest
path: neo4j/
push: false
##########################################################################
# BUILD BACKEND DOCKER IMAGE (build) #####################################
##########################################################################
- name: backend | Build `build` image
uses: docker/build-push-action@v1.1.0
with:
repository: ocelotsocialnetwork/backend
tags: build
target: build
path: backend/
push: false
##########################################################################
# BUILD WEBAPP DOCKER IMAGE (build) ######################################
##########################################################################
- name: webapp | Build `build` image
uses: docker/build-push-action@v1.1.0
with:
repository: ocelotsocialnetwork/webapp
tags: build
target: build
path: webapp/
push: false
##############################################################################
# JOB: LINT ##################################################################
##############################################################################
lint:
name: Lint
runs-on: ubuntu-latest
needs: build_test
steps:
##########################################################################
# LINT BACKEND ###########################################################
##########################################################################
- name: backend | Lint
run: docker run --rm ocelotsocialnetwork/backend:build yarn run lint
##########################################################################
# LINT WEBAPP ############################################################
##########################################################################
- name: webapp | Lint
run: docker run --rm ocelotsocialnetwork/webapp:build yarn run lint
##############################################################################
# JOB: UNIT TESTS ############################################################
##############################################################################
unit_tests:
name: Lint
runs-on: ubuntu-latest
needs: build_test
steps:
##########################################################################
# UNIT TESTS BACKEND #####################################################
##########################################################################
- name: backend | docker-compose
run: docker-compose up
- name: backend | Unit tests
run: docker-compose exec backend yarn test
#run: docker run --network container:webapp-frontend appropriate/curl -s --retry 10 --retry-connrefused http://localhost:5000/
##########################################################################
# UNIT TESTS WEBAPP #####################################################
##########################################################################
- name: webapp | Unit tests
run: docker run --rm ocelotsocialnetwork/webapp:build yarn run test
##############################################################################
# JOB: DOCKER BUILD PRODUCTION & PUSH ########################################
##############################################################################
#build_production:
# name: Docker Build Production & Push
# runs-on: ubuntu-latest
# needs: prepare
# steps:
##########################################################################
# BACKEND ################################################################
##########################################################################
# TODO: We want to push this to dockerhub
#- name: Build backend production image
# uses: docker/build-push-action@v1.1.0
# with:
# repository: ocelotsocialnetwork/backend
# tags: production
# target: production
# path: backend/
# push: false
##########################################################################
# WEBAPP #################################################################
##########################################################################
# TODO: We want to push this to dockerhub
#- name: Build webapp production image
# uses: docker/build-push-action@v1.1.0
# with:
# repository: ocelotsocialnetwork/webapp
# tags: production
# target: production
# path: webapp/
# push: false