workadventure/.github/workflows/continuous_integration.yml
2020-04-14 20:42:57 +02:00

92 lines
2.2 KiB
YAML

# https://help.github.com/en/categories/automating-your-workflow-with-github-actions
name: "Continuous Integration"
on:
- "pull_request"
- "push"
jobs:
continuous-integration-front:
name: "Continuous Integration Front"
runs-on: "ubuntu-latest"
steps:
- name: "Checkout"
uses: "actions/checkout@v2.0.0"
- name: "Setup NodeJS"
uses: actions/setup-node@v1
with:
node-version: '12.x'
- name: "Install dependencies"
run: yarn install
working-directory: "front"
- name: "Build"
run: yarn run build
env:
API_URL: "http://localhost:8080"
working-directory: "front"
- name: "Lint"
run: yarn run lint
working-directory: "front"
continuous-integration-back:
name: "Continuous Integration Back"
runs-on: "ubuntu-latest"
steps:
- name: "Checkout"
uses: "actions/checkout@v2.0.0"
- name: "Setup NodeJS"
uses: actions/setup-node@v1
with:
node-version: '12.x'
- name: "Install dependencies"
run: yarn install
working-directory: "back"
- name: "Build"
run: yarn run tsc
working-directory: "back"
- name: "Lint"
run: yarn run lint
working-directory: "back"
- name: "Jasmine"
run: yarn test
working-directory: "back"
e2e:
name: "End to end testing with cypress"
runs-on: "ubuntu-latest"
steps:
- name: "Checkout"
uses: "actions/checkout@v2.0.0"
- name: "Init .env"
run: "cp .env.template .env"
- name: "Init containers"
run: "docker-compose -f docker-compose.yaml -f docker-compose.ci.yml run --rm wait_app" #start the containers and then wait for the website to be online
- name: "Run cypress"
run: "docker-compose -f docker-compose.yaml -f docker-compose.ci.yml up --exit-code-from cypress cypress" # run cypress in docker-compose and get its exit code
- name: "Upload the screenshot on test failure"
uses: actions/upload-artifact@v1
if: failure()
with:
name: "screenshot"
path: "./e2e/cypress/screenshots/spec.js/WorkAdventureGame -- loads (failed).png"