debug #346
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
name: Test and build staging-image | |
on: | |
push: | |
branches: [master] | |
jobs: | |
test: | |
name: "Run linter and Cypress tests" | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: npm ci | |
run: npm ci | |
- name: npm run lint | |
run: npm run lint | |
- uses: 1arp/[email protected] | |
with: | |
path: 'client' | |
file: 'outsideGitFakeUsers.json' | |
content: | | |
[] | |
- name: docker-compose up -d | |
run: E2E=true docker-compose -f docker-compose-test.yml up -d | |
- name: Run cypress tests | |
run: ./node_modules/.bin/cypress run --headless *.spec.js | |
- uses: actions/upload-artifact@v1 | |
if: failure() | |
with: | |
name: cypress-screenshots | |
path: /home/runner/work/fuksilaiterekisteri/fuksilaiterekisteri/cypress/screenshots/ | |
# Test run video was always captured, so this action uses "always()" condition | |
- uses: actions/upload-artifact@v1 | |
if: always() | |
with: | |
name: cypress-videos | |
path: /home/runner/work/fuksilaiterekisteri/fuksilaiterekisteri/cypress/videos/ | |
build: | |
name: 'Build and publish staging image' | |
needs: test | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Build image | |
id: build-image | |
uses: redhat-actions/buildah-build@v2 | |
with: | |
image: fuksilaiterekisteri | |
tags: staging ${{ github.sha }} | |
containerfiles: | | |
./Dockerfile | |
build-args: | | |
BASE_PATH=/fuksilaite/ | |
GIT_SHA=${{ github.sha }} | |
NODE_ENV=staging | |
SENTRY_AUTH_TOKEN=${{ secrets.SENTRY_AUTH_TOKEN }} | |
- name: Push to quay.io | |
uses: redhat-actions/push-to-registry@v2 | |
with: | |
image: ${{ steps.build-image.outputs.image }} | |
tags: ${{ steps.build-image.outputs.tags }} | |
registry: quay.io/toska | |
username: toska+github | |
password: ${{ secrets.QUAY_IO_TOKEN }} | |
notify: | |
runs-on: ubuntu-latest | |
needs: [test, build] | |
if: always() | |
steps: | |
- name: Notify failed | |
uses: UniversityOfHelsinkiCS/[email protected] | |
if: (needs.test.result != 'success' || needs.build.result != 'success') | |
with: | |
webhook-url: ${{ secrets.WEBHOOK_URL }} | |
message-type: test-failure | |
- name: Notify success | |
uses: UniversityOfHelsinkiCS/[email protected] | |
if: (needs.test.result == 'success' || needs.build.result == 'success') | |
with: | |
webhook-url: ${{ secrets.WEBHOOK_URL }} | |
message-type: deployment | |
deployment-target: staging | |
softa-url: https://toska-staging.cs.helsinki.fi/fuksilaite/ |