Workflow config file is invalid. Please check your config file: yaml: unmarshal errors: line 78: mapping key "uses" already defined at line 71 line 79: mapping key "with" already defined at line 72 line 110: mapping key "uses" already defined at line 102 line 111: mapping key "with" already defined at line 103 line 142: mapping key "uses" already defined at line 134 line 143: mapping key "with" already defined at line 135
2021-01-30 04:52:31 +01:00

282 lines
12 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
test_latest_version_v1:
needs: docker_build
runs-on: ubuntu-latest
name: latest v1
env:
AWS_CLI_VERSION: 1
steps:
- name: Download Docker Image (Artifact)
uses: actions/download-artifact@v2
with:
name: docker-artifact
path: path/to/artifacts
- name: Run test in Docker
run: |
cd path/to/artifacts
docker load < docker-image.tar
export DOCKER_FULLTAG=$(cat docker-tag)
docker run --rm "$DOCKER_FULLTAG" $AWS_CLI_VERSION
- uses: actions/checkout@v2
- name: Run test on Runner
run: |
sudo ./entrypoint.sh
##############################################################################
# JOB: DOCKER BUILD TEST NEO4J ###############################################
##############################################################################
build_test_neo4j:
name: Docker Build Test - Neo4J
runs-on: ubuntu-latest
needs: [prepare]
steps:
##########################################################################
# CHECKOUT CODE ##########################################################
##########################################################################
- name: Checkout code
uses: actions/checkout@v2
- name: Create output folder
run: mkdir -p /docker
##########################################################################
# NEO4J ##################################################################
##########################################################################
- name: Neo4J | Build `community` image
uses: docker/build-push-action@v1.1.0
with:
repository: ocelotsocialnetwork/neo4j
tags: latest
path: neo4j/
push: false
outputs: type=local,dest=/docker/neo4j.tar
uses: actions/upload-artifact@v2
with:
name: docker-neo4j-image
path: /docker/neo4j.tar
##############################################################################
# JOB: DOCKER BUILD TEST BACKEND #############################################
##############################################################################
build_test_backend:
name: Docker Build Test - Backend
runs-on: ubuntu-latest
needs: [prepare]
steps:
##########################################################################
# CHECKOUT CODE ##########################################################
##########################################################################
- name: Checkout code
uses: actions/checkout@v2
- name: Create output folder
run: mkdir -p /docker
##########################################################################
# 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
outputs: type=local,dest=/docker/backend.tar
uses: actions/upload-artifact@v2
with:
name: docker-backend-image
path: /docker/backend.tar
##############################################################################
# JOB: DOCKER BUILD TEST WEBAPP ##############################################
##############################################################################
build_test_webapp:
name: Docker Build Test - WebApp
runs-on: ubuntu-latest
needs: [prepare]
steps:
##########################################################################
# CHECKOUT CODE ##########################################################
##########################################################################
- name: Checkout code
uses: actions/checkout@v2
- name: Create output folder
run: mkdir -p /docker
##########################################################################
# 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
outputs: type=local,dest=/docker/webapp.tar
uses: actions/upload-artifact@v2
with:
name: docker-webapp-image
path: /docker/webapp.tar
##############################################################################
# JOB: AFTER DOCKER BUILD ####################################################
##############################################################################
after_docker_build:
name: After Build
runs-on: ubuntu-latest
needs: [build_test_neo4j, build_test_backend, build_test_webapp]
##############################################################################
# JOB: LINT BACKEND ##########################################################
##############################################################################
lint_backend:
name: Lint backend
runs-on: ubuntu-latest
needs: after_docker_build
steps:
##########################################################################
# CHECKOUT CODE ##########################################################
##########################################################################
- name: Checkout code
uses: actions/checkout@v2
- name: Create artifact folder
run: mkdir -p /docker
##########################################################################
# DOWNLOAD DOCKER IMAGE ##################################################
##########################################################################
- name: Download Docker Image (Artifact)
uses: actions/download-artifact@v2
with:
name: docker-backend-image
path: /docker/backend.tar
run: docker load < /docker/backend.tar
##########################################################################
# LINT BACKEND ###########################################################
##########################################################################
- name: backend | Lint
run: docker run --rm ocelotsocialnetwork/backend:build yarn run lint
##############################################################################
# JOB: LINT WEBAPP ###########################################################
##############################################################################
lint_webapp:
name: Lint backend
runs-on: ubuntu-latest
needs: after_docker_build
steps:
##########################################################################
# CHECKOUT CODE ##########################################################
##########################################################################
- name: Checkout code
uses: actions/checkout@v2
- name: Create artifact folder
run: mkdir -p /docker
##########################################################################
# DOWNLOAD DOCKER IMAGE ##################################################
##########################################################################
- name: Download Docker Image (Artifact)
uses: actions/download-artifact@v2
with:
name: docker-webapp-image
path: /docker/webapp.tar
run: docker load < /docker/webapp.tar
##########################################################################
# LINT WEBAPP ############################################################
##########################################################################
- name: webapp | Lint
run: docker run --rm ocelotsocialnetwork/webapp:build yarn run lint
##############################################################################
# JOB: UNIT TESTS ############################################################
##############################################################################
#unit_tests:
# name: Unit Tests
# runs-on: ubuntu-latest
# needs: prepare
# steps:
##########################################################################
# CHECKOUT CODE ##########################################################
##########################################################################
#- name: Checkout code
# uses: actions/checkout@v2
##########################################################################
# UNIT TESTS BACKEND #####################################################
##########################################################################
#- name: backend | copy env files (webapp, backend)
# run: cp webapp/.env.template webapp/.env
# run: cp backend/.env.template backend/.env
#- 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:
##########################################################################
# CHECKOUT CODE ##########################################################
##########################################################################
#- name: Checkout code
# uses: actions/checkout@v2
##########################################################################
# 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