Skip to content

Commit 26ba139

Browse files
committed
composable workflows
1 parent 3312219 commit 26ba139

5 files changed

Lines changed: 49 additions & 88 deletions

File tree

Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
name: Tests
1+
name: Build
22

3-
on:
4-
- push
5-
- pull_request
3+
on: workflow_call
64

75
jobs:
86
build:
@@ -13,17 +11,17 @@ jobs:
1311
with:
1412
node-version: 22
1513

16-
- name: Install Swift via Swiftly
14+
- name: Install Swift via Swiftly (Linux)
1715
run: |
18-
curl -O https://download.swift.org/swiftly/linux/swiftly-$(uname -m).tar.gz && \
19-
tar zxf swiftly-$(uname -m).tar.gz && \
20-
./swiftly init --quiet-shell-followup && \
21-
. "${SWIFTLY_HOME_DIR:-$HOME/.local/share/swiftly}/env.sh" && \
16+
curl -O https://download.swift.org/swiftly/linux/swiftly-$(uname -m).tar.gz
17+
tar zxf swiftly-$(uname -m).tar.gz
18+
./swiftly init --quiet-shell-followup
19+
. "${SWIFTLY_HOME_DIR:-$HOME/.local/share/swiftly}/env.sh"
2220
hash -r
2321
24-
- name: Install Swift WASM SDK
22+
- name: Install Swift WASM SDK (6.2)
2523
run: |
26-
swift sdk install https://download.swift.org/swift-6.2-release/wasm/swift-6.2-RELEASE/swift-6.2-RELEASE_wasm.artifactbundle.tar.gz --checksum fe4e8648309fce86ea522e9e0d1dc48e82df6ba6e5743dbf0c53db8429fb5224 && \
24+
swift sdk install https://download.swift.org/swift-6.2-release/wasm/swift-6.2-RELEASE/swift-6.2-RELEASE_wasm.artifactbundle.tar.gz --checksum fe4e8648309fce86ea522e9e0d1dc48e82df6ba6e5743dbf0c53db8429fb5224
2725
swift sdk list
2826
2927
- name: Install Dependencies
@@ -44,23 +42,4 @@ jobs:
4442
README.md
4543
LICENSE
4644
package.json
47-
48-
test:
49-
runs-on: ubuntu-latest
50-
needs: build
51-
steps:
52-
- uses: actions/checkout@v4
53-
- uses: actions/setup-node@v4
54-
with:
55-
node-version: 22
56-
57-
- name: Install Dependencies
58-
run: npm ci
59-
60-
- name: Download build artifact
61-
uses: actions/download-artifact@v5
62-
with:
63-
name: package-dist
64-
65-
- name: Run Tests
66-
run: npm run test
45+
package-lock.json

.github/workflows/checks.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
name: Build & Test
2+
3+
on:
4+
- push
5+
- pull_request
6+
7+
jobs:
8+
build:
9+
uses: ./.github/workflows/build.yml
10+
11+
test:
12+
needs: build
13+
uses: ./.github/workflows/test.yml

.github/workflows/npm-publish.yml

Lines changed: 2 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -6,65 +6,11 @@ on:
66

77
jobs:
88
build:
9-
runs-on: ubuntu-latest
10-
steps:
11-
- uses: actions/checkout@v4
12-
- uses: actions/setup-node@v4
13-
with:
14-
node-version: 22
15-
16-
- name: Install Swift via Swiftly
17-
run: |
18-
curl -O https://download.swift.org/swiftly/linux/swiftly-$(uname -m).tar.gz && \
19-
tar zxf swiftly-$(uname -m).tar.gz && \
20-
./swiftly init --quiet-shell-followup && \
21-
. "${SWIFTLY_HOME_DIR:-$HOME/.local/share/swiftly}/env.sh" && \
22-
hash -r
23-
24-
- name: Install Swift WASM SDK
25-
run: |
26-
swift sdk install https://download.swift.org/swift-6.2-release/wasm/swift-6.2-RELEASE/swift-6.2-RELEASE_wasm.artifactbundle.tar.gz --checksum fe4e8648309fce86ea522e9e0d1dc48e82df6ba6e5743dbf0c53db8429fb5224 && \
27-
swift sdk list
28-
29-
- name: Install Dependencies
30-
run: npm ci
31-
32-
- name: Build
33-
run: npm run build
34-
35-
- name: Upload build artifact
36-
uses: actions/upload-artifact@v4
37-
with:
38-
name: package-dist
39-
path: |
40-
bin/**
41-
dist/**
42-
wasm/**
43-
WASI.md
44-
README.md
45-
LICENSE
46-
package.json
47-
package-lock.json
9+
uses: ./.github/workflows/build.yml
4810

4911
test:
50-
runs-on: ubuntu-latest
5112
needs: build
52-
steps:
53-
- uses: actions/checkout@v4
54-
- uses: actions/setup-node@v4
55-
with:
56-
node-version: 22
57-
58-
- name: Install Dependencies
59-
run: npm ci
60-
61-
- name: Download build artifact
62-
uses: actions/download-artifact@v5
63-
with:
64-
name: package-dist
65-
66-
- name: Run Tests
67-
run: npm run test
13+
uses: ./.github/workflows/test.yml
6814

6915
publish:
7016
runs-on: ubuntu-latest

.github/workflows/test.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Run Tests
2+
3+
on: workflow_call
4+
5+
jobs:
6+
test:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v4
10+
- uses: actions/setup-node@v4
11+
with:
12+
node-version: 22
13+
14+
- name: Install Dependencies
15+
run: npm ci
16+
17+
- name: Download build artifact
18+
uses: actions/download-artifact@v5
19+
with:
20+
name: package-dist
21+
22+
- name: Run Tests
23+
run: npm run test

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Swift AST parsing in JavaScript via WebAssembly (WASM), powered by SwiftSyntax + SwiftParser.
44

5-
[![NPM version](https://img.shields.io/npm/v/@flisk/swift-ast.svg)](https://www.npmjs.com/package/@flisk/swift-ast) [![Tests](https://github.com/fliskdata/swift-ast/actions/workflows/tests.yml/badge.svg?branch=main)](https://github.com/fliskdata/swift-ast/actions/workflows/tests.yml)
5+
[![NPM version](https://img.shields.io/npm/v/@flisk/swift-ast.svg)](https://www.npmjs.com/package/@flisk/swift-ast) [![Tests](https://github.com/fliskdata/swift-ast/actions/workflows/checks.yml/badge.svg?branch=main)](https://github.com/fliskdata/swift-ast/actions/workflows/checks.yml)
66

77
## Introduction
88

0 commit comments

Comments
 (0)