refactor #7
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
## TODO When branch protection is enabled, make a CD action that triggers on push to main and deploys script. Also this action should upload coverage | |
name: CI | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
tags: | |
- '!*' # Do not execute on tags | |
paths: | |
- src/** | |
- yarn.lock | |
- .github/workflows/test.yml | |
pull_request: | |
jobs: | |
test: | |
name: Test | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@master | |
- run: corepack enable | |
- uses: actions/setup-node@master | |
with: | |
node-version: 22 | |
- run: yarn install --immutable | |
- run: node build | |
- run: yarn test --run --coverage | |
- name: Upload coverage | |
# Run only on push on main repo | |
if: github.repository == 'LushWay/Scripts' && github.ref == 'refs/heads/main' | |
uses: paambaati/[email protected] | |
env: | |
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }} | |
lint: | |
name: Lint | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@master | |
- run: corepack enable | |
- uses: actions/setup-node@master | |
with: | |
node-version: 22 | |
- run: yarn install --immutable | |
- run: yarn prettier -w src | |
- run: yarn eslint src | |
deploy: | |
name: Deploy | |
runs-on: ubuntu-latest | |
# Run only on push on main repo | |
if: github.repository == 'LushWay/Scripts' && github.ref == 'refs/heads/main' | |
needs: [test, lint] | |
steps: | |
- run: echo 'Deploy occurs' |