Skip to content

Commit 725109e

Browse files
committed
Automate testing on commit and in CI
1 parent 24e32d3 commit 725109e

File tree

3 files changed

+53
-10
lines changed

3 files changed

+53
-10
lines changed

.github/workflows/deno.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# This workflow uses actions that are not certified by GitHub.
2+
# They are provided by a third-party and are governed by
3+
# separate terms of service, privacy policy, and support
4+
# documentation.
5+
6+
# This workflow will install Deno then run `deno lint` and `deno test`.
7+
# For more information see: https://github.com/denoland/setup-deno
8+
9+
name: Deno
10+
11+
on:
12+
push:
13+
branches: ["main"]
14+
pull_request:
15+
branches: ["main"]
16+
17+
permissions:
18+
contents: read
19+
20+
jobs:
21+
test:
22+
runs-on: ubuntu-latest
23+
24+
steps:
25+
- name: Setup repo
26+
uses: actions/checkout@v4
27+
28+
- name: Setup Deno
29+
# uses: denoland/setup-deno@v1
30+
uses: denoland/setup-deno@61fe2df320078202e33d7d5ad347e7dcfa0e8f31 # v1.1.2
31+
with:
32+
deno-version: v2.x
33+
34+
# Uncomment this step to verify the use of 'deno fmt' on each commit.
35+
- name: Verify formatting
36+
run: deno fmt --check
37+
38+
- name: Run linter
39+
run: deno lint
40+
41+
- name: Run tests
42+
run: deno task test

.pre-commit-config.yaml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,12 @@ repos:
3434
# pass_filenames: false
3535
description: "Type-check code using Deno's built-in type checker"
3636
stages: [pre-commit]
37-
# - id: deno-test
38-
# name: deno-test
39-
# entry: deno task test
40-
# language: system
41-
# files: \.(ts|tsx|js|jsx)$
42-
# pass_filenames: false
43-
# always_run: true
44-
# description: "Run tests using Deno's built-in test runner"
45-
# stages: [pre-commit]
37+
- id: deno-test
38+
name: deno-test
39+
entry: deno task test
40+
language: system
41+
files: \.(ts|tsx|js|jsx)$
42+
pass_filenames: false
43+
always_run: true
44+
description: "Run tests using Deno's built-in test runner"
45+
stages: [pre-commit]

deno.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
"tasks": {
66
"dev": "deno run -A --watch example/main.tsx",
77
"cli": "deno run -A --watch cli.ts",
8-
"update:i18n": "deno run -A example/i18n.ts"
8+
"update:i18n": "deno run -A example/i18n.ts",
9+
"test": "deno test -A"
910
},
1011
"exports": "./lib/mod.ts",
1112
"imports": {

0 commit comments

Comments
 (0)