chore: refactor build and test env #5
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: | |
pull_request: | |
push: | |
branches: [main, master] | |
jobs: | |
package: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version-file: ".nvmrc" | |
cache: "yarn" | |
- uses: actions/cache@v3 | |
with: | |
path: ./node_modules | |
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock', '**/*.patch') }} | |
- name: Install node modules | |
run: yarn install --frozen-lockfile | |
- run: npm run package | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version-file: ".nvmrc" | |
cache: "yarn" | |
- uses: actions/cache@v3 | |
with: | |
path: ./node_modules | |
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock', '**/*.patch') }} | |
- name: Install node modules | |
run: yarn install --frozen-lockfile | |
- run: xvfb-run -a npm test | |
if: runner.os == 'Linux' | |
- run: npm test | |
if: runner.os != 'Linux' | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version-file: ".nvmrc" | |
cache: "yarn" | |
- uses: actions/cache@v3 | |
with: | |
path: ./node_modules | |
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock', '**/*.patch') }} | |
- name: Install node modules | |
run: yarn install --frozen-lockfile | |
- run: npm run lint |