Switch from docker-compose
to docker compose
.
#995
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node | |
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions | |
name: testsuite | |
on: | |
push: | |
branches: [master] | |
pull_request: | |
branches: [master] | |
env: | |
NODE_VERSION: 18.x | |
DOCKER_REPO: sheltertechsf/askdarcel-web | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-node@v2 | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
- uses: actions/cache@v2 | |
with: | |
path: ~/.npm | |
key: npm-${{ hashFiles('package-lock.json') }} | |
restore-keys: npm- | |
- run: npm ci | |
- run: cp config.example.yml config.yml | |
- run: npm run prettier | |
- run: npm run lint | |
test_unit: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-node@v2 | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
- uses: actions/cache@v2 | |
with: | |
path: ~/.npm | |
key: npm-${{ hashFiles('package-lock.json') }} | |
restore-keys: npm- | |
- run: npm ci | |
- run: cp config.example.yml config.yml | |
- run: npm run test | |
test_e2e: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-node@v2 | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
- uses: actions/cache@v2 | |
with: | |
path: ~/.npm | |
key: npm-${{ hashFiles('package-lock.json') }} | |
restore-keys: npm- | |
- run: npm ci | |
- run: cp config.example.yml config.yml | |
- run: npm run build | |
- run: docker compose -f docker-compose.test.yml up -d db api api-go frontend | |
- run: sleep 60 | |
- run: yarn cypress run | |
- if: always() | |
run: docker compose -f docker-compose.test.yml logs -t # Output all docker logs from API and frontend to help debugging after the fact | |
- uses: actions/upload-artifact@v2 | |
if: failure() | |
with: | |
name: E2E screenshot(s) and video(s) | |
path: | | |
/home/runner/work/askdarcel-web/askdarcel-web/cypress/videos/ | |
/home/runner/work/askdarcel-web/askdarcel-web/cypress/screenshots/ | |
retention-days: 3 | |
publish-latest: | |
runs-on: ubuntu-latest | |
needs: [lint, test_e2e, test_unit] | |
if: github.ref == 'refs/heads/master' && github.event_name == 'push' | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: docker/setup-qemu-action@v1 | |
- uses: docker/setup-buildx-action@v1 | |
- uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_PASSWORD }} | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-node@v2 | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
- uses: actions/cache@v2 | |
with: | |
path: ~/.npm | |
key: npm-${{ hashFiles('package-lock.json') }} | |
restore-keys: npm- | |
- run: npm ci | |
- run: cp config.example.yml config.yml | |
- run: CONFIG_YAML=config.docker.yml npm run build | |
- run: touch version.json | |
- uses: docker/build-push-action@v2 | |
with: | |
push: true | |
context: . | |
tags: ${{ env.DOCKER_REPO }}:latest | |
- run: echo ${{ steps.docker_build.outputs.digest }} |