init #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
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json | |
name: Deno Test | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- '**.ts' | |
- '.github/workflows/test.yml' | |
- 'deno.jsonc' | |
pull_request: | |
branches: | |
- main | |
paths: | |
- '**.ts' | |
permissions: | |
contents: read | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Setup repo | |
uses: actions/checkout@v4 | |
- name: Setup Deno | |
uses: denoland/setup-deno@v1 | |
with: | |
deno-version: v1.x | |
- name: Check | |
run: deno task check | |
- name: Run linter | |
run: deno task lint | |
- name: Run test with coverage report | |
shell: bash | |
run: | | |
deno task test:coverage | |
deno task coverage:lco | |
deno task coverage:show >> .coverage/result.txt | |
- name: Upload coverage report to Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: my-artifact | |
path: ./.coverage | |
coverage-report: | |
needs: test | |
runs-on: ubuntu-latest | |
permissions: | |
write-all | |
steps: | |
- name: Download coverage report from Artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: my-artifact | |
path: ./.coverage | |
- name: echo coverage report text to env | |
id: comment_coverage_report_var | |
run: echo "COVERAGE_REPORT=$(cat ./.coverage/result.txt)" >> $GITHUB_ENV | |
- name: Create commit comment | |
uses: peter-evans/commit-comment@v3 | |
with: | |
body: | | |
Deno test coverage report | |
${{ steps.comment_coverage_report_var.outputs.COVERAGE_REPORT }} | |
- name: Upload coverage report to Codecov | |
if: false # if you want to upload coverage report to Codecov, set to true | |
uses: codecov/codecov-action@v4.3.0 | |
with: | |
file: ./.coverage/lcov.info | |
fail_ci_if_error: true | |
token: ${{ secrets.CODECOV_TOKEN }} | |
slug: ${{ github.repository }} | |
jsr-publish-dry-run: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: denoland/setup-deno@v1 | |
with: | |
deno-version: ${{ env.DENO_VERSION }} | |
- run: deno publish --dry-run | |
action-timeline: | |
needs: | |
- test | |
- coverage-report | |
- jsr-publish-dry-run | |
if: ${{ always() }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: Kesin11/actions-timeline@v2 |