You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

114 lines
2.6 KiB
YAML

name: Deployment Pipeline
on:
push:
branches: [main]
pull_request:
branches: [main]
types: [opened, synchronize]
jobs:
3 years ago
avoid_reduncy:
runs-on: ubuntu-18.04
steps:
- name: Cancel Previous Redundant Builds
uses: styfle/cancel-workflow-action@0.9.1
with:
access_token: ${{ github.token }}
3 years ago
lint:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/setup-node@v2
with:
cache: 'npm'
node-version: '14'
- name: Install dependencies
run: npm ci
- name: Lint
run: npm run eslint
3 years ago
build:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/setup-node@v2
with:
cache: 'npm'
3 years ago
node-version: '14'
- name: Install dependencies
run: npm ci
- name: Build
run: npm run build
3 years ago
- uses: actions/upload-artifact@v2
with:
name: dist
path: dist
test:
needs: [lint, build]
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/setup-node@v2
with:
cache: 'npm'
3 years ago
node-version: '14'
- name: Install dependencies
run: npm ci
- uses: actions/download-artifact@v2
with:
name: dist
path: dist
- name: Test
run: npm test
3 years ago
e2e:
needs: [lint, build]
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/setup-node@v2
with:
cache: 'npm'
3 years ago
node-version: '14'
- name: Install dependencies
run: npm ci
- uses: actions/download-artifact@v2
with:
name: dist
path: dist
- name: E2E tests
uses: cypress-io/github-action@v2
with:
command: npm run test:e2e
start: npm run start-test
wait-on: http://localhost:5000
3 years ago
deploy:
needs: [test, e2e]
3 years ago
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Deploy to Heroku
if: ${{ github.event_name == 'push' }}
uses: akhileshns/heroku-deploy@v3.12.12
with:
heroku_api_key: ${{secrets.HEROKU_API_KEY}}
heroku_app_name: ${{secrets.HEROKU_APP}}
heroku_email: ${{secrets.HEROKU_API_EMAIL}}
healthcheck: "https://${{secrets.HEROKU_APP}}.herokuapp.com/health"
rollbackonhealthcheckfailed: true