Skip to content

Commit fca041e

Browse files
committed
chore: add ci+publish workflow
1 parent b6be21f commit fca041e

File tree

1 file changed

+76
-0
lines changed

1 file changed

+76
-0
lines changed

.github/workflows/ci.yml

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
name: CI
2+
on:
3+
push:
4+
branches:
5+
- main
6+
tags:
7+
- "*"
8+
paths-ignore:
9+
- .github/**
10+
- .gitignore
11+
- .vscode/**
12+
- ./*.md
13+
- LICENSE
14+
pull_request:
15+
branches:
16+
- main
17+
workflow_dispatch:
18+
inputs:
19+
publish:
20+
description: Publish to JSR?
21+
type: boolean
22+
default: false
23+
required: true
24+
jobs:
25+
test:
26+
runs-on: ${{ matrix.os }}
27+
timeout-minutes: 30
28+
permissions:
29+
contents: read
30+
id-token: write # required for deno publish
31+
strategy:
32+
matrix:
33+
os: [ubuntu-latest, macos-latest, windows-latest]
34+
deno: [canary]
35+
steps:
36+
- name: setup repo
37+
uses: actions/checkout@v4
38+
39+
- name: setup deno
40+
uses: denoland/setup-deno@v2
41+
with:
42+
# currently this is always canary
43+
deno-version: ${{ matrix.deno }}
44+
45+
- name: setup rust
46+
uses: dsherret/rust-toolchain-file@v1
47+
48+
- name: build wasm
49+
run: deno run -Aq jsr:@deno/wasmbuild@0.19.1 --inline
50+
51+
- name: deno test
52+
run: deno test -A --no-check=remote --parallel --doc
53+
54+
# only need to run this once
55+
- if: runner.os == 'Linux'
56+
name: deno lint
57+
run: deno lint
58+
59+
# only need to run this once
60+
- if: runner.os == 'Linux'
61+
name: deno fmt --check
62+
run: deno fmt --check
63+
64+
# only publish once, if on a tag or if manually triggered
65+
- if: |
66+
runner.os == 'Linux' && (
67+
(
68+
github.event_name == 'push' &&
69+
startsWith(github.ref, 'refs/tags/')
70+
) || (
71+
github.event_name == 'workflow_dispatch' &&
72+
github.event.inputs.publish == 'true'
73+
)
74+
)
75+
name: publish to jsr
76+
run: deno publish --dry-run && deno publish

0 commit comments

Comments
 (0)