Skip to content

kk-yes/no-toCheckbox #481

kk-yes/no-toCheckbox

kk-yes/no-toCheckbox #481

Workflow file for this run

# 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: CI
on:
push:
branches: [master]
pull_request:
branches: [master]
env:
PACT_BROKER_BASE_URL: https://c4cneu.pactflow.io
PACT_BROKER_TOKEN: ${{ secrets.PACT_BROKER_TOKEN }}
PACT_PACTICIPANT: jpal-frontend
GIT_COMMIT: ${{ github.sha }}
GITHUB_REF: ${{ github.ref }}
AWS_COGNITO_USERNAME: ${{ secrets.AWS_COGNITO_USERNAME }}
AWS_COGNITO_PASSWORD: ${{ secrets.AWS_COGNITO_PASSWORD }}
jobs:
cypress-test:
runs-on: ubuntu-latest
steps:
- name: Check out code 🛎
uses: actions/checkout@v2
- name: Use Node.js 14.x
uses: actions/setup-node@v1
with:
node-version: 14.x
# need this to avoid chokidar file watcher spamming the console
- run: npm ci
- name: Run E2E tests 🧪
uses: cypress-io/github-action@v2
with:
# we have already installed everything
install: false
start: npm run start:ci
wait-on: 'http://localhost:3000'
unit-and-pact-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Use Node.js 14.x
uses: actions/setup-node@v1
with:
node-version: 14.x
- uses: mansona/npm-lockfile-version@v1
- run: npm ci
- run: npm run test:unit
- run: npm run test:pact
- name: Publish pact tagged with branch name
run: npx pact-broker publish ./pact/pacts --consumer-app-version ${GIT_COMMIT} --broker-base-url ${PACT_BROKER_BASE_URL} --broker-token ${PACT_BROKER_TOKEN} --tag ${GITHUB_REF:11}
lint-format-build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Use Node.js 14.x
uses: actions/setup-node@v1
with:
node-version: 14.x
- run: npm ci
- run: npm run prepush
- run: npm run build
can-i-deploy:
runs-on: ubuntu-latest
needs: [cypress-test, unit-and-pact-test, lint-format-build]
steps:
- uses: actions/checkout@v2
- run: docker pull pactfoundation/pact-cli:latest
- name: Can I deploy?
run: |
docker run --rm \
pactfoundation/pact-cli:latest \
broker can-i-deploy \
--broker-base-url=${PACT_BROKER_BASE_URL} \
--broker-token ${PACT_BROKER_TOKEN} \
--pacticipant ${PACT_PACTICIPANT} \
--version ${GIT_COMMIT} \
--to prod
#TODO: write a real deploy script
deploy:
if: ${{ github.ref == 'refs/heads/master' }}
runs-on: ubuntu-latest
needs: can-i-deploy
steps:
- uses: actions/checkout@v2
- run: docker pull pactfoundation/pact-cli:latest
- name: Tag version as prod
run: |
docker run --rm \
pactfoundation/pact-cli:latest \
broker create-version-tag \
--broker-base-url=${PACT_BROKER_BASE_URL} \
--broker-token ${PACT_BROKER_TOKEN} \
--pacticipant ${PACT_PACTICIPANT} \
--version ${GIT_COMMIT} \
--tag prod
- name: Create Sentry release
uses: getsentry/action-release@v1
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
with:
environment: production