Merge pull request #351 from etn-ccis/dependabot/npm_and_yarn/login-w… #87
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: Build | |
on: | |
push: | |
branches: [ "dev", "master" ] | |
pull_request: | |
branches: [ "dev", "master" ] | |
pull_request_target: | |
types: | |
- opened | |
branches: | |
- '*/*' | |
permissions: | |
pull-requests: write | |
contents: read | |
jobs: | |
prettier_lint: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [18.x] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node-version }} | |
cache: 'yarn' | |
cache-dependency-path: login-workflow | |
- run: yarn install --immutable | |
working-directory: login-workflow | |
- run: yarn prettier:check | |
working-directory: login-workflow | |
- run: yarn lint | |
working-directory: login-workflow | |
unit_test: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [18.x] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node-version }} | |
cache: 'yarn' | |
cache-dependency-path: login-workflow | |
- run: yarn --immutable | |
working-directory: login-workflow | |
- run: yarn coverage | |
working-directory: login-workflow | |
- name: Upload to Codecov | |
uses: codecov/codecov-action@v3 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
directory: ./login-workflow/coverage/ | |
files: cobertura-coverage.xml | |
name: codecov-report | |
verbose: true | |
cypress-run: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [18.x] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node-version }} | |
cache: 'yarn' | |
cache-dependency-path: login-workflow | |
- run: yarn cy:stage | |
working-directory: login-workflow | |
- name: Cypress install | |
uses: cypress-io/github-action@v6 | |
with: | |
runTests: false | |
working-directory: login-workflow/example | |
- name: Cypress run | |
uses: cypress-io/github-action@v6 | |
with: | |
start: yarn cytest | |
working-directory: login-workflow/example | |
wait-on: ${{ matrix.node-version == 18 && 'http://[::1]:4200' || 'http://localhost:4200' }} | |
wait-on-timeout: 300 | |
browser: chrome | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v3 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
directory: ./login-workflow/cypress-coverage/ | |
files: clover.xml | |
name: codecov-report | |
verbose: true | |
build_login_workflow: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [18.x] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node-version }} | |
cache: 'yarn' | |
cache-dependency-path: login-workflow | |
- run: yarn --immutable | |
working-directory: login-workflow | |
- run: yarn build | |
working-directory: login-workflow | |
- name: Save build | |
uses: actions/upload-artifact@v3 | |
with: | |
name: dist | |
if-no-files-found: error | |
path: login-workflow/dist | |
publish_login_workflow: | |
runs-on: ubuntu-latest | |
if: ${{ github.event_name == 'push' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/dev') }} | |
needs: [prettier_lint, unit_test, cypress-run, build_login_workflow] | |
strategy: | |
matrix: | |
node-version: [18.x] | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
BRANCH: ${{ github.ref == 'refs/heads/master' && 'master' || 'dev' }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Download dist | |
uses: actions/download-artifact@v3 | |
with: | |
name: dist | |
path: login-workflow/dist | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node-version }} | |
registry-url: 'https://registry.npmjs.org' | |
- run: yarn --immutable | |
working-directory: login-workflow | |
- run: npm run publish:package -- -b ${{env.BRANCH}} | |
working-directory: login-workflow |