Merge pull request #8 from udibo/dev #57
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, pull_request] | |
jobs: | |
build: | |
name: test deno ${{ matrix.deno }} ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
timeout-minutes: 5 | |
strategy: | |
matrix: | |
os: [ubuntu-latest, windows-latest, macOS-latest] | |
deno: [v1.x, canary] | |
fail-fast: true | |
steps: | |
- name: Clone repository | |
uses: actions/checkout@v4 | |
- name: Setup deno | |
uses: denoland/setup-deno@main | |
with: | |
deno-version: ${{ matrix.deno }} | |
- name: Check formatting | |
if: matrix.os == 'ubuntu-latest' | |
run: deno fmt --check | |
- name: Check linting | |
if: matrix.os == 'ubuntu-latest' | |
run: deno lint | |
- name: Run tests | |
run: deno test --coverage=cov | |
- name: Run tests unstable | |
run: deno test --unstable | |
- name: Generate lcov | |
if: | | |
matrix.os == 'ubuntu-latest' && | |
matrix.deno == 'v1.x' | |
run: deno coverage --lcov cov > cov.lcov | |
- name: Upload coverage | |
if: | | |
matrix.os == 'ubuntu-latest' && | |
matrix.deno == 'v1.x' | |
uses: codecov/codecov-action@v4 | |
with: | |
fail_ci_if_error: true | |
files: cov.lcov | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
- name: Release info | |
if: | | |
github.repository == 'udibo/http-error' && | |
matrix.os == 'ubuntu-latest' && | |
matrix.deno == 'v1.x' && | |
startsWith(github.ref, 'refs/tags/') | |
shell: bash | |
run: | | |
echo "RELEASE_VERSION=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV | |
- name: Bundle | |
if: env.RELEASE_VERSION != '' | |
run: | | |
mkdir -p target/release | |
deno bundle mod.ts target/release/http-error.${RELEASE_VERSION}.js | |
- name: Release | |
uses: softprops/action-gh-release@v1 | |
if: env.RELEASE_VERSION != '' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
draft: true | |
files: | | |
target/release/http-error.${{ env.RELEASE_VERSION }}.js |