Merge pull request #819 from HSLdevcom/dev #43
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: Deploy and test production | |
on: | |
push: | |
branches: | |
- production | |
jobs: | |
deploy-production: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
ref: production | |
- name: Build UI and publish Docker image | |
uses: elgohr/Publish-Docker-Github-Action@master | |
with: | |
name: hsldevcom/transitlog-ui | |
username: ${{ secrets.TRANSITLOG_DOCKERHUB_USER }} | |
password: ${{ secrets.TRANSITLOG_DOCKERHUB_TOKEN }} | |
buildargs: BUILD_ENV=production | |
tags: production | |
- name: Checkout server | |
uses: actions/checkout@v2 | |
with: | |
repository: HSLdevcom/transitlog-server | |
ref: production | |
- name: Build Server and publish Docker image | |
uses: elgohr/Publish-Docker-Github-Action@master | |
with: | |
name: hsldevcom/transitlog-server | |
username: ${{ secrets.TRANSITLOG_DOCKERHUB_USER }} | |
password: ${{ secrets.TRANSITLOG_DOCKERHUB_TOKEN }} | |
tags: production | |
test-production: | |
needs: deploy-production | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/setup-node@v2 | |
with: | |
node-version: "14" | |
- uses: actions/checkout@v2 | |
with: | |
ref: production | |
- name: Sleep for 5 minutes | |
uses: jakejarvis/wait-action@master | |
with: | |
time: "5m" # Wait until all servers are restarted | |
- name: Cypress tests | |
uses: cypress-io/github-action@v2 | |
# with: | |
# record: true # Only production records to Cypress.io | |
env: | |
CYPRESS_BASE_URL: https://reittiloki.hsl.fi | |
CYPRESS_CLIENT_ID: ${{ secrets.CYPRESS_CLIENT_ID }} | |
CYPRESS_CLIENT_SECRET: ${{ secrets.CYPRESS_CLIENT_SECRET }} | |
CYPRESS_HSL_TESTING_HSLID_USERNAME: ${{ secrets.CYPRESS_HSL_TESTING_HSLID_USERNAME }} | |
CYPRESS_HSL_TESTING_HSLID_PASSWORD: ${{ secrets.CYPRESS_HSL_TESTING_HSLID_PASSWORD }} | |
# CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }} | |
- name: Upload screenshot artifacts | |
uses: actions/upload-artifact@v2 | |
if: failure() | |
with: | |
name: cypress-screenshots | |
path: cypress/screenshots | |
- name: Upload video artifacts | |
uses: actions/upload-artifact@v2 | |
if: failure() | |
with: | |
name: cypress-videos | |
path: cypress/videos | |
- name: Notify of tests | |
uses: 8398a7/action-slack@v2 | |
if: failure() | |
with: | |
status: ${{ job.status }} | |
text: Reittiloki PROD E2E test status | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} |