You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
290 lines
8.7 KiB
290 lines
8.7 KiB
name: CI/CD
|
|
on: [push, pull_request]
|
|
jobs:
|
|
setup:
|
|
name: setup
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Dump GitHub context
|
|
env:
|
|
GITHUB_CONTEXT: ${{ toJson(github) }}
|
|
run: echo "$GITHUB_CONTEXT"
|
|
- name: Checkout
|
|
uses: actions/checkout@v2
|
|
- name: Setup
|
|
uses: actions/setup-node@v1
|
|
with:
|
|
node-version: "14.x"
|
|
- uses: actions/cache@v1
|
|
id: yarn-cache
|
|
with:
|
|
path: node_modules
|
|
key: ${{ runner.os }}-node_modules-${{ hashFiles('**/yarn.lock') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-node_modules-
|
|
- name: Install
|
|
if: steps.yarn-cache.outputs.cache-hit != 'true'
|
|
run: yarn install
|
|
|
|
build:
|
|
name: build
|
|
runs-on: ubuntu-latest
|
|
needs: setup
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v2
|
|
- name: Setup
|
|
uses: actions/setup-node@v1
|
|
with:
|
|
node-version: "14.x"
|
|
- uses: actions/cache@v1
|
|
id: yarn-cache
|
|
with:
|
|
path: node_modules
|
|
key: ${{ runner.os }}-node_modules-${{ hashFiles('**/yarn.lock') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-node_modules-
|
|
- name: Install
|
|
if: steps.yarn-cache.outputs.cache-hit != 'true'
|
|
run: yarn install
|
|
|
|
- uses: actions/cache@v1
|
|
id: assets-cache
|
|
with:
|
|
path: src/frontend/assets/scripts
|
|
key: assets-${{ hashFiles('**/src/frontend/global-entry.js') }}-${{ hashFiles('**/yarn.lock') }}-{{ hashFiles('**/bin/bundle-globals.js') }}
|
|
restore-keys: |
|
|
assets-
|
|
- name: bundle globals production
|
|
if: steps.assets-cache.outputs.cache-hit != 'true'
|
|
run: NODE_ENV=production yarn bundle:globals
|
|
- name: bundle globals dev
|
|
if: steps.assets-cache.outputs.cache-hit != 'true'
|
|
run: NODE_ENV=dev yarn bundle:globals
|
|
|
|
- name: bundle production
|
|
run: NODE_ENV=production ONCE=true yarn bundle
|
|
- name: bundle dev
|
|
run: ONCE=true yarn bundle
|
|
- name: build
|
|
run: yarn build
|
|
- name: types
|
|
run: yarn types
|
|
- name: Upload Build
|
|
if: |
|
|
contains(github.ref, 'refs/heads/next')
|
|
|| contains(github.ref, 'refs/heads/master')
|
|
|| contains(github.ref, 'refs/heads/next-major')
|
|
|| contains(github.ref, 'refs/heads/beta')
|
|
|| contains(github.ref, 'refs/heads/dev')
|
|
uses: actions/upload-artifact@v1
|
|
with:
|
|
name: lib
|
|
path: lib
|
|
- name: Upload Types
|
|
if: |
|
|
contains(github.ref, 'refs/heads/next')
|
|
|| contains(github.ref, 'refs/heads/master')
|
|
|| contains(github.ref, 'refs/heads/next-major')
|
|
|| contains(github.ref, 'refs/heads/beta')
|
|
|| contains(github.ref, 'refs/heads/dev')
|
|
uses: actions/upload-artifact@v1
|
|
with:
|
|
name: types
|
|
path: types
|
|
- name: Upload Bundle
|
|
if: |
|
|
contains(github.ref, 'refs/heads/next')
|
|
|| contains(github.ref, 'refs/heads/master')
|
|
|| contains(github.ref, 'refs/heads/next-major')
|
|
|| contains(github.ref, 'refs/heads/beta')
|
|
|| contains(github.ref, 'refs/heads/dev')
|
|
uses: actions/upload-artifact@v1
|
|
with:
|
|
name: bundle
|
|
path: src/frontend/assets/scripts
|
|
|
|
test:
|
|
name: Test
|
|
runs-on: ubuntu-latest
|
|
needs: setup
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v2
|
|
- name: Setup
|
|
uses: actions/setup-node@v1
|
|
with:
|
|
node-version: "14.x"
|
|
- uses: actions/cache@v1
|
|
id: yarn-cache
|
|
with:
|
|
path: node_modules
|
|
key: ${{ runner.os }}-node_modules-${{ hashFiles('**/yarn.lock') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-node_modules-
|
|
- name: Install
|
|
if: steps.yarn-cache.outputs.cache-hit != 'true'
|
|
run: yarn install
|
|
- name: Lint
|
|
run: yarn lint
|
|
- name: spell
|
|
run: yarn cspell
|
|
- name: install codecov
|
|
run: yarn global add codecov
|
|
if: contains(github.ref, 'refs/heads/master')
|
|
- name: cover
|
|
if: contains(github.ref, 'refs/heads/master')
|
|
run: yarn codecov
|
|
env:
|
|
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
|
- name: test
|
|
if: "!contains(github.ref, 'refs/heads/master')"
|
|
run: yarn test
|
|
|
|
cypress:
|
|
name: Cypress
|
|
needs: build
|
|
if: |
|
|
contains(github.ref, 'refs/heads/next')
|
|
services:
|
|
mongo:
|
|
image: mongo:3.4.23
|
|
ports:
|
|
- 27017:27017
|
|
postgres:
|
|
image: postgres:10.8
|
|
env:
|
|
POSTGRES_USER: postgres
|
|
POSTGRES_PASSWORD: postgres
|
|
POSTGRES_DB: postgres
|
|
ports:
|
|
- 5432:5432
|
|
# needed because the postgres container does not provide a healthcheck
|
|
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v2
|
|
- name: Setup
|
|
uses: actions/setup-node@v1
|
|
with:
|
|
node-version: "14.x"
|
|
- uses: actions/cache@v1
|
|
id: yarn-cache
|
|
with:
|
|
path: node_modules
|
|
key: ${{ runner.os }}-node_modules-${{ hashFiles('**/yarn.lock') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-node_modules-
|
|
- name: Install
|
|
if: steps.yarn-cache.outputs.cache-hit != 'true'
|
|
run: yarn install
|
|
- name: Download Build
|
|
uses: actions/download-artifact@v1
|
|
with:
|
|
name: lib
|
|
- name: Download Types
|
|
uses: actions/download-artifact@v1
|
|
with:
|
|
name: types
|
|
- name: Download Bundle
|
|
uses: actions/download-artifact@v1
|
|
with:
|
|
name: bundle
|
|
- run: yarn link
|
|
- name: Install dependencies
|
|
uses: cypress-io/github-action@v2
|
|
with:
|
|
# just perform install
|
|
runTests: false
|
|
working-directory: packages/adminjs-e2e
|
|
- run: yarn link adminjs
|
|
working-directory: packages/adminjs-e2e
|
|
- run: yarn run sequelize db:create
|
|
working-directory: packages/adminjs-e2e
|
|
env:
|
|
POSTGRES_PASSWORD: postgres
|
|
POSTGRES_USER: postgres
|
|
POSTGRES_DATABASE: adminjs_e2e_development
|
|
- run: yarn run sequelize db:migrate
|
|
working-directory: packages/adminjs-e2e
|
|
env:
|
|
POSTGRES_PASSWORD: postgres
|
|
POSTGRES_USER: postgres
|
|
POSTGRES_DATABASE: adminjs_e2e_development
|
|
- run: node bin/setup-db.js
|
|
working-directory: packages/adminjs-e2e
|
|
- uses: cypress-io/github-action@v2
|
|
with:
|
|
install: false
|
|
working-directory: packages/adminjs-e2e
|
|
start: yarn start
|
|
- uses: actions/upload-artifact@v1
|
|
if: failure()
|
|
with:
|
|
name: cypress-screenshots
|
|
path: packages/adminjs-e2e/cypress/screenshots
|
|
- uses: actions/upload-artifact@v1
|
|
if: always()
|
|
with:
|
|
name: cypress-videos
|
|
path: packages/adminjs-e2e/cypress/videos
|
|
|
|
publish:
|
|
name: Publish
|
|
if: |
|
|
github.event_name == 'push'
|
|
&& (
|
|
contains(github.ref, 'refs/heads/next')
|
|
|| contains(github.ref, 'refs/heads/master')
|
|
|| contains(github.ref, 'refs/heads/next-major')
|
|
|| contains(github.ref, 'refs/heads/beta')
|
|
|| contains(github.ref, 'refs/heads/dev')
|
|
)
|
|
needs:
|
|
- test
|
|
- build
|
|
services:
|
|
mongo:
|
|
image: mongo:3.4.23
|
|
ports:
|
|
- 27017:27017
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v2
|
|
- name: Setup
|
|
uses: actions/setup-node@v1
|
|
with:
|
|
node-version: "14.x"
|
|
- uses: actions/cache@v1
|
|
id: yarn-cache
|
|
with:
|
|
path: node_modules
|
|
key: ${{ runner.os }}-node_modules-${{ hashFiles('**/yarn.lock') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-node_modules-
|
|
- name: Install
|
|
if: steps.yarn-cache.outputs.cache-hit != 'true'
|
|
run: yarn install
|
|
- name: Download Build
|
|
uses: actions/download-artifact@v1
|
|
with:
|
|
name: lib
|
|
- name: Download Types
|
|
uses: actions/download-artifact@v1
|
|
with:
|
|
name: types
|
|
- name: Download Bundle
|
|
uses: actions/download-artifact@v1
|
|
with:
|
|
name: bundle
|
|
- name: Release
|
|
env:
|
|
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
JIRA_TOKEN: ${{ secrets.JIRA_TOKEN }}
|
|
JIRA_EMAIL: ${{ secrets.JIRA_EMAIL }}
|
|
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
|
|
run: yarn release
|