sample of monorepo with react ui design lib #1
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: CI | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
env: | |
TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} | |
jobs: | |
# display-variables: | |
# name: display ci variables | |
# runs-on: ubuntu-latest | |
# environment: CI | |
# steps: | |
# - name: Use variables | |
# run: | | |
# echo "SECRET_TOKEN : $SECRET_TOKEN" | |
# echo "VAR_TOKEN : $VARS_TOKEN" | |
# echo "ENV_TOKEN : $ENV_TOKEN" | |
# env: | |
# SECRET_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} | |
# VARS_TOKEN: ${{ vars.SLACK_BOT_TOKEN }} | |
# ENV_TOKEN: ${{ env.TOKEN }} | |
# build: | |
# runs-on: ubuntu-latest | |
# needs: display-variables | |
# steps: | |
# - name: Checkout 🛎️ | |
# uses: actions/checkout@v3 | |
# with: | |
# persist-credentials: false | |
# - name: install pnpm | |
# uses: pnpm/action-setup@v2 | |
# with: | |
# version: 8 | |
# run_install: false | |
# - name: Set up Node.js | |
# uses: actions/setup-node@v3 | |
# with: | |
# node-version: '16' | |
# cache: 'pnpm' | |
# # - name: cache build /dist directories | |
# # id: cache-dist | |
# # uses: actions/cache@v3 | |
# # with: | |
# # path: ./**/dist | |
# # key: dist-${{ github.job }}-${{ github.ref_name }}-${{ github.sha }} | |
# # restore-keys: dist-${{ github.job }}-${{ github.ref_name }}- | |
# # - name: turbo cache | |
# # id: turbo-cache | |
# # uses: actions/cache@v3 | |
# # with: | |
# # path: .turbo | |
# # key: turbo-${{ github.job }}-${{ github.ref_name }}-${{ github.sha }} | |
# # restore-keys: | | |
# # turbo-${{ github.job }}-${{ github.ref_name }}- | |
# - name : install dependencies | |
# run: make install | |
# - name : build | |
# run: make build | |
test-unit: | |
runs-on: ubuntu-latest | |
# needs: build | |
steps: | |
- name: Checkout 🛎️ | |
uses: actions/checkout@v3 | |
with: | |
persist-credentials: false | |
- name: install pnpm | |
uses: pnpm/action-setup@v2 | |
with: | |
version: 8 | |
run_install: false | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '16' | |
cache: 'pnpm' | |
- name : install dependencies | |
run: make install | |
- name : build | |
run: make build | |
- name : test | |
run: make test-unit | |
- name: cleanup | |
run: sudo chown -R $(whoami):$(id -ng) . | |
- name: upload coverage from unit tests | |
uses: actions/upload-artifact@v3 | |
with: | |
name: coverage-from-unit-tests | |
path: | | |
**/coverage/lcov.info | |
**/coverage/coverage-final.json | |
retention-days: 1 | |
test-features: | |
runs-on: ubuntu-latest | |
# needs: build | |
steps: | |
- name: Checkout 🛎️ | |
uses: actions/checkout@v3 | |
with: | |
persist-credentials: false | |
- name: install pnpm | |
uses: pnpm/action-setup@v2 | |
with: | |
version: 8 | |
run_install: false | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '16' | |
cache: 'pnpm' | |
- name : install dependencies | |
run: make install | |
- name : build | |
run: make build | |
- name : test | |
run: make test-features | |
- name: cleanup | |
run: sudo chown -R $(whoami):$(id -ng) . | |
- name: upload coverage from features tests | |
uses: actions/upload-artifact@v3 | |
with: | |
name: coverage-from-features-tests | |
path: | | |
**/coverage/features-it/lcov.info | |
**/coverage/features-it/coverage-final.json | |
**/coverage/features-it-api/lcov.info | |
**/coverage/features-it-api/coverage-final.json | |
**/coverage/features-core-domain/lcov.info | |
**/coverage/features-core-domain/coverage-final.json | |
retention-days: 1 | |
test-smoke: | |
runs-on: ubuntu-latest | |
# needs: build | |
steps: | |
- name: Checkout 🛎️ | |
uses: actions/checkout@v3 | |
with: | |
persist-credentials: false | |
- name: install pnpm | |
uses: pnpm/action-setup@v2 | |
with: | |
version: 8 | |
run_install: false | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '16' | |
cache: 'pnpm' | |
- name : install dependencies | |
run: make install | |
- name : build | |
run: make build | |
- name : test | |
run: make test-smoke | |
- name: cleanup | |
run: sudo chown -R $(whoami):$(id -ng) . | |
- name: upload coverage from features tests | |
uses: actions/upload-artifact@v3 | |
with: | |
name: coverage-from-smoke-tests | |
path: | | |
**/coverage/smoke/lcov.info | |
**/coverage/smoke/coverage-final.json | |
retention-days: 1 | |
# lint: | |
# runs-on: ubuntu-latest | |
# needs: | |
# - test-unit | |
# - test-features | |
# steps: | |
# - name: Checkout 🛎️ | |
# uses: actions/checkout@v3 | |
# with: | |
# persist-credentials: false | |
# - name: install pnpm | |
# uses: pnpm/action-setup@v2 | |
# with: | |
# version: 8 | |
# run_install: false | |
# - name: Set up Node.js | |
# uses: actions/setup-node@v3 | |
# with: | |
# node-version: '16' | |
# cache: 'pnpm' | |
# - name : install dependencies | |
# run: make install-offline | |
# - name : build | |
# run: make build | |
# - name : lint | |
# run: make lint | |
coverage: | |
runs-on: ubuntu-latest | |
needs: | |
- test-unit | |
- test-features | |
- test-smoke | |
steps: | |
- name: Checkout 🛎️ | |
uses: actions/checkout@v3 | |
with: | |
persist-credentials: false | |
- name: download coverage from unit tests | |
uses: actions/download-artifact@v3 | |
id: download-coverage-from-unit-tests | |
with: | |
name: coverage-from-unit-tests | |
continue-on-error: true | |
- name: download coverage from features tests | |
uses: actions/download-artifact@v3 | |
id: download-coverage-from-features-tests | |
with: | |
name: coverage-from-features-tests | |
continue-on-error: true | |
- name: download coverage from smoke tests | |
uses: actions/download-artifact@v3 | |
id: download-coverage-from-smoke-tests | |
with: | |
name: coverage-from-smoke-tests | |
continue-on-error: true | |
- name: install pnpm | |
uses: pnpm/action-setup@v2 | |
with: | |
version: 8 | |
run_install: false | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '16' | |
cache: 'pnpm' | |
- name : install dependencies | |
run: make install-offline | |
- name : prepare and merge coverage files | |
run: make merge-coverage | |
- name: codecov | |
uses: codecov/codecov-action@v3 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
files: ./coverage/lcov.info # optional | |
flags: unittests # optional | |
name: codecov-umbrella # optional | |
fail_ci_if_error: true # optional (default = false) | |
verbose: false # optional (default = false) | |
# ci-passed-notif: | |
# needs: | |
# - coverage | |
# - lint | |
# runs-on: ubuntu-latest | |
# environment: CI | |
# steps: | |
# - name: slack notificaiton - ci passed | |
# uses: slackapi/slack-github-action@v1 | |
# env: | |
# SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} | |
# with: | |
# channel-id: "C05UA1LUW1H" #ci | |
# payload: | | |
# { | |
# "text": "github workflow", | |
# "attachments": [ | |
# { | |
# "color": "warning", | |
# "pretext": "Quality Gate bypassed with no-coverage", | |
# "fields": [ | |
# { | |
# "title": "Repo", | |
# "value": "<https://github.com/${{ github.repository }} | ${{ github.repository }}>", | |
# "short": true | |
# }, | |
# { | |
# "title": "Pull Request", | |
# "short": true, | |
# "value": "<https://github.com/${{ github.repository }}/pull/${{ github.event.pull_request.number }}>" | |
# }, | |
# { | |
# "title": "Status", | |
# "short": true, | |
# "value": "CI Passed" | |
# }, | |
# { | |
# "title": "Branch", | |
# "value": "${{ github.head_ref || github.ref_name }}", | |
# "short": true | |
# } | |
# ], | |
# "footer_icon": "https://github.githubassets.com/favicon.ico", | |
# "footer": "<https://github.com/${{ github.repository }} | ${{ github.repository }}/pull/${{ github.event.pull_request.number }}>" | |
# } | |
# ] | |
# } |