Skip to content

Commit 44ed91d

Browse files
authored
feat: reusable github action workflows (#1721)
Signed-off-by: Adam Setch <[email protected]>
1 parent 5a9965a commit 44ed91d

File tree

4 files changed

+68
-33
lines changed

4 files changed

+68
-33
lines changed

.github/workflows/ci.yml

Lines changed: 13 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -9,42 +9,20 @@ on:
99
- main
1010

1111
jobs:
12-
lint-app:
13-
name: Lint (biomejs)
14-
runs-on: ubuntu-latest
15-
16-
steps:
17-
- uses: actions/checkout@v4
18-
- uses: pnpm/action-setup@v3
19-
- uses: actions/setup-node@v4
20-
with:
21-
node-version-file: '.nvmrc'
22-
cache: 'pnpm'
23-
- run: pnpm install
24-
- run: pnpm lint:check
12+
lint:
13+
name: Lint App
14+
uses: ./.github/workflows/lint.yml
2515

26-
run-unit-tests:
27-
name: Run Tests
28-
runs-on: macos-latest
29-
needs: lint-app
30-
31-
steps:
32-
- uses: actions/checkout@v4
33-
- uses: pnpm/action-setup@v3
34-
- uses: actions/setup-node@v4
35-
with:
36-
node-version-file: '.nvmrc'
37-
cache: 'pnpm'
38-
- run: pnpm install
39-
- run: pnpm tsc --noEmit
40-
- run: pnpm test -- --coverage --runInBand --verbose
41-
- name: Coveralls
42-
uses: coverallsapp/github-action@v2
16+
tests:
17+
name: Tests
18+
uses: ./.github/workflows/test.yml
19+
needs: lint
4320

4421
build-macos:
4522
name: Build macOS (electron-builder)
4623
runs-on: macos-latest
47-
needs: run-unit-tests
24+
needs: tests
25+
if: ${{ !startsWith(github.head_ref, 'release/v') }}
4826

4927
steps:
5028
- uses: actions/checkout@v4
@@ -71,7 +49,8 @@ jobs:
7149
build-windows:
7250
name: Build Windows (electron-builder)
7351
runs-on: windows-latest
74-
needs: run-unit-tests
52+
needs: tests
53+
if: ${{ !startsWith(github.head_ref, 'release/v') }}
7554

7655
steps:
7756
- uses: actions/checkout@v4
@@ -95,7 +74,8 @@ jobs:
9574
build-linux:
9675
name: Build Linux (electron-builder)
9776
runs-on: ubuntu-latest
98-
needs: run-unit-tests
77+
needs: tests
78+
if: ${{ !startsWith(github.head_ref, 'release/v') }}
9979

10080
steps:
10181
- uses: actions/checkout@v4

.github/workflows/lint.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Lint
2+
3+
on:
4+
workflow_call:
5+
6+
jobs:
7+
lint:
8+
name: biomejs
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- uses: actions/checkout@v4
13+
- uses: pnpm/action-setup@v3
14+
- uses: actions/setup-node@v4
15+
with:
16+
node-version-file: '.nvmrc'
17+
cache: 'pnpm'
18+
- run: pnpm install
19+
- run: pnpm lint:check
20+

.github/workflows/release.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,19 @@ permissions:
1010
contents: write
1111

1212
jobs:
13+
lint:
14+
name: Lint App
15+
uses: ./.github/workflows/lint.yml
16+
17+
tests:
18+
name: Tests
19+
uses: ./.github/workflows/test.yml
20+
needs: lint
21+
1322
release-macos:
1423
name: Publish macOS (electron-builder)
1524
runs-on: macos-latest
25+
needs: tests
1626

1727
steps:
1828
- uses: actions/checkout@v4
@@ -45,6 +55,7 @@ jobs:
4555
release-windows:
4656
name: Publish Windows (electron-builder)
4757
runs-on: windows-latest
58+
needs: tests
4859

4960
steps:
5061
- uses: actions/checkout@v4
@@ -71,6 +82,7 @@ jobs:
7182
release-linux:
7283
name: Publish Linux (electron-builder)
7384
runs-on: ubuntu-latest
85+
needs: tests
7486

7587
steps:
7688
- uses: actions/checkout@v4

.github/workflows/test.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Test
2+
3+
on:
4+
workflow_call:
5+
6+
jobs:
7+
run-unit-tests:
8+
name: Run Tests
9+
runs-on: macos-latest
10+
11+
steps:
12+
- uses: actions/checkout@v4
13+
- uses: pnpm/action-setup@v3
14+
- uses: actions/setup-node@v4
15+
with:
16+
node-version-file: '.nvmrc'
17+
cache: 'pnpm'
18+
- run: pnpm install
19+
- run: pnpm tsc --noEmit
20+
- run: pnpm test -- --coverage --runInBand --verbose
21+
- name: Coveralls
22+
uses: coverallsapp/github-action@v2
23+

0 commit comments

Comments
 (0)