Skip to content

Commit 9e5196a

Browse files
committed
chore: reusable github workflows
Breakout format, test, and publish workflows into reusable workflows. Then created workflows that trigger on push and pull_request that call the reusable workflows. Hopefully this.. workflows.
1 parent f92cb8d commit 9e5196a

File tree

5 files changed

+68
-34
lines changed

5 files changed

+68
-34
lines changed

.github/workflows/format.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Check Format
2+
3+
on: [workflow_call]
4+
5+
jobs:
6+
format:
7+
strategy:
8+
matrix:
9+
deno: ["v2.2.12"]
10+
os: [ubuntu-latest]
11+
12+
runs-on: ${{ matrix.os }}
13+
14+
steps:
15+
- name: Setup repo
16+
uses: actions/checkout@v2
17+
18+
- name: Setup Deno
19+
uses: denoland/setup-deno@v1
20+
with:
21+
deno-version: ${{ matrix.deno }}
22+
23+
- name: Run Deno Check Formatting
24+
run: deno fmt --check
Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
1-
name: Publish to JSR.io
2-
on:
3-
push:
4-
branches: [main]
1+
name: Publish
2+
3+
on: [workflow_call]
54

65
jobs:
76
publish:
8-
runs-on: ubuntu-latest
9-
107
permissions:
118
contents: read
129
id-token: write
1310

11+
runs-on: ubuntu-latest
12+
1413
steps:
1514
- name: Setup repo
1615
uses: actions/checkout@v4

.github/workflows/pull_request.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
name: PR
2+
3+
on: [pull_request]
4+
5+
jobs:
6+
call-format:
7+
uses: ./.github/workflows/format.yml
8+
9+
call-test:
10+
uses: ./.github/workflows/test.yml

.github/workflows/push.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Push Main
2+
3+
on:
4+
push:
5+
branches: [main]
6+
7+
jobs:
8+
call-format:
9+
uses: ./.github/workflows/format.yml
10+
11+
call-test:
12+
uses: ./.github/workflows/test.yml
13+
secrets:
14+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
15+
16+
call-publish:
17+
needs: [call-format, call-test]
18+
uses: ./.github/workflows/test.yml
19+
permissions:
20+
contents: read
21+
id-token: write
Lines changed: 8 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,20 @@
1-
name: Format and Test
1+
name: Test
22

33
on:
4-
push:
5-
branches: [main]
6-
pull_request:
7-
branches: [main]
4+
workflow_call:
5+
secrets:
6+
GITHUB_TOKEN:
7+
required: true
88

99
jobs:
10-
check-format:
11-
runs-on: ${{ matrix.os }} # runs a test on Ubuntu, Windows and macOS
12-
13-
strategy:
14-
matrix:
15-
deno: ["v2.2.12"]
16-
os: [ubuntu-latest]
17-
18-
steps:
19-
- name: Setup repo
20-
uses: actions/checkout@v2
21-
22-
- name: Setup Deno
23-
uses: denoland/setup-deno@v1
24-
with:
25-
deno-version: ${{ matrix.deno }}
26-
27-
- name: Run Deno Check Formatting
28-
run: deno fmt --check
29-
3010
test:
31-
runs-on: ${{ matrix.os }} # runs a test on Ubuntu, Windows and macOS
32-
3311
strategy:
3412
matrix:
3513
deno: ["v2.2.12"]
3614
os: [macOS-latest, windows-latest, ubuntu-latest]
3715

16+
runs-on: ${{ matrix.os }}
17+
3818
steps:
3919
- name: Setup repo
4020
uses: actions/checkout@v2
@@ -45,7 +25,7 @@ jobs:
4525
deno-version: ${{ matrix.deno }}
4626

4727
- name: Run Deno Tests
48-
run: deno test --doc --parallel --coverage=coverage
28+
run: deno test --parallel --coverage=coverage
4929

5030
- name: Generate Coverage
5131
run: deno coverage --unstable ./coverage --lcov > ./coverage/lcov.info

0 commit comments

Comments
 (0)