chore: 🤖 Update to the workflows #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: Tests | |
on: push | |
jobs: | |
prepare-environment: | |
runs-on: ubuntu-latest | |
name: Prepare environment | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: "20" | |
cache: "yarn" | |
cache-dependency-path: yarn.lock | |
env: | |
FORCE_COLOR: 0 | |
- name: Install node_modules on cache miss | |
if: steps.cache-node-modules.outputs.cache-hit != 'true' | |
run: yarn install --frozen-lockfile | |
- name: Cache node_modules | |
if: steps.cache-node-modules.outputs.cache-hit != 'true' | |
uses: actions/cache/save@v3 | |
with: | |
path: node_modules | |
key: yarn-${{ hashFiles('yarn.lock') }} | |
tests: | |
name: Run tests | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: "20" | |
cache: "yarn" | |
- name: Restore node_modules | |
uses: actions/cache/restore@v3 | |
id: cache-node-modules | |
with: | |
path: node_modules | |
key: yarn-${{ hashFiles('yarn.lock') }} | |
fail-on-cache-miss: false | |
- name: Install node_modules on cache miss | |
if: steps.cache-node-modules.outputs.cache-hit != 'true' | |
run: yarn install --frozen-lockfile | |
- name: Build | |
run: yarn build | |
- name: Lint | |
run: yarn lint | |
- name: Typecheck | |
run: yarn typecheck | |
- name: Clear Jest | |
run: yarn jest --clearCache | |
- name: Test | |
run: yarn test --coverage | |
# - name: Send Report | |
# uses: paambaati/codeclimate-action@v3.0.0 | |
# env: | |
# CC_TEST_REPORTER_ID: 7d1e3713df373ab2c9efce24b85c16efa2bd953aae32bd9d278004784d71291e | |
# with: | |
# coverageLocations: ${{github.workspace}}/coverage/lcov.info:lcov | |
release: | |
name: Release | |
if: ${{ github.ref == 'refs/heads/master' }} | |
runs-on: ubuntu-latest | |
needs: tests | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: "20" | |
cache: "yarn" | |
cache-dependency-path: yarn.lock | |
- name: Restore node_modules | |
uses: actions/cache/restore@v3 | |
id: cache-node-modules | |
with: | |
path: node_modules | |
key: yarn-${{ hashFiles('yarn.lock') }} | |
fail-on-cache-miss: false | |
- name: Install node_modules on cache miss | |
if: steps.cache-node-modules.outputs.cache-hit != 'true' | |
run: yarn install --frozen-lockfile | |
- name: Build | |
run: yarn build | |
- name: Publish | |
run: yarn release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} |