fix: add coverage token #2
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 | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Setup Git with PAT | |
run: | | |
git config --global url."https://x-access-token:${{ secrets.GH_PAT }}@github.com/".insteadOf "git@github.com:" | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
persist-credentials: false | |
- uses: pnpm/action-setup@v3 | |
with: | |
version: 8 | |
- run: pnpm add -g pnpm | |
- name: 'Setup Node.js with pnpm cache' | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
cache: 'pnpm' | |
- name: 'Install dependencies' | |
run: pnpm install | |
- name: 'Build' | |
run: pnpm build | |
- name: 'Save build output' | |
uses: actions/cache/save@v4 | |
with: | |
path: ${{ github.workspace }} | |
key: ${{ runner.os }}-build-${{ github.sha }}-${{ github.run_id }} | |
test: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: pnpm/action-setup@v3 | |
with: | |
version: 8 | |
- run: pnpm add -g pnpm | |
- name: 'Restore build output' | |
uses: actions/cache/restore@v4 | |
with: | |
path: ${{ github.workspace }} | |
key: ${{ runner.os }}-build-${{ github.sha }}-${{ github.run_id }} | |
restore-keys: ${{ runner.os }}-build-${{ github.sha }} | |
fail-on-cache-miss: true | |
- name: 'Setup Node.js with pnpm cache' | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
cache: 'pnpm' | |
- name: 'Run tests' | |
run: pnpm run coverage | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: coverage-artifacts | |
path: coverage/ | |
report-coverage: | |
runs-on: ubuntu-latest | |
needs: [test] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
persist-credentials: false | |
- uses: actions/download-artifact@v4 | |
with: | |
name: coverage-artifacts | |
path: coverage | |
- name: 'Upload coverage to Codecov' | |
uses: codecov/codecov-action@v4.0.1 | |
with: | |
fail_ci_if_error: true | |
token: ${{ secrets.CODECOV_TOKEN }} | |
slug: cre8/sd-jwt-veramo | |
lint: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: pnpm/action-setup@v3 | |
with: | |
version: 8 | |
- run: pnpm add -g pnpm | |
- name: 'Restore build output' | |
uses: actions/cache/restore@v4 | |
with: | |
path: ${{ github.workspace }} | |
key: ${{ runner.os }}-build-${{ github.sha }}-${{ github.run_id }} | |
restore-keys: ${{ runner.os }}-build-${{ github.sha }} | |
fail-on-cache-miss: true | |
- name: 'Setup Node.js with pnpm cache' | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
cache: 'pnpm' | |
- name: Setup Biome | |
uses: biomejs/setup-biome@v2 | |
with: | |
version: latest | |
- name: Run Biome | |
run: biome ci . | |
# release: | |
# if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
# needs: [test, lint] | |
# runs-on: ubuntu-latest | |
# steps: | |
# - uses: actions/checkout@v4 | |
# with: | |
# fetch-depth: 0 | |
# - uses: pnpm/action-setup@v3 | |
# with: | |
# version: 8 | |
# - run: pnpm add -g pnpm | |
# - name: 'Restore build output' | |
# uses: actions/cache/restore@v4 | |
# with: | |
# path: ${{ github.workspace }} | |
# key: ${{ runner.os }}-build-${{ github.sha }}-${{ github.run_id }} | |
# restore-keys: ${{ runner.os }}-build-${{ github.sha }} | |
# fail-on-cache-miss: true | |
# - name: 'Setup Node.js with pnpm cache' | |
# uses: actions/setup-node@v4 | |
# with: | |
# node-version: 20 | |
# cache: 'pnpm' | |
# - name: git config | |
# run: | | |
# git config user.name "${{github.actor}}" | |
# git config user.email "${{github.actor}}@users.noreply.github.com" | |
# - name: Set npm token | |
# run: npm config set //registry.npmjs.org/:_authToken $NPM_TOKEN | |
# env: | |
# NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
# - name: Build | |
# run: pnpm build | |
# - run: pnpm run release | |
# env: | |
# NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |