Skip to content

Add configurable compiler and linker flags (#16) #82

Add configurable compiler and linker flags (#16)

Add configurable compiler and linker flags (#16) #82

Workflow file for this run

name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
package-version-parity:
name: Package version parity
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions/setup-node@v7
with:
node-version: '24'
- name: Fetch main version baseline
if: github.event_name == 'pull_request'
run: git fetch --no-tags origin +refs/heads/main:refs/remotes/origin/main
- name: Fetch previous version baseline
if: >-
github.event_name == 'push' &&
github.event.before != '0000000000000000000000000000000000000000'
run: git fetch --no-tags origin ${{ github.event.before }}
- name: Check release package versions
env:
BASELINE_REF: >-
${{ github.event_name == 'pull_request' && 'origin/main' ||
(github.event.before != '0000000000000000000000000000000000000000' && github.event.before || '') }}
run: |
command=(node scripts/run-without-node-warnings.mjs node scripts/check-package-versions.mjs)
if [[ -n "$BASELINE_REF" ]]; then command+=(--baseline-ref "$BASELINE_REF"); fi
"${command[@]}"
quality:
name: Format, lint, and type check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: voidzero-dev/setup-vp@07d0b0e993009eb3b908ea06e49e88e933b728a2 # v1.17.0
with:
node-version: '24'
cache: true
- run: node scripts/run-without-node-warnings.mjs vp install
- run: node scripts/run-without-node-warnings.mjs vp check
unit-tests:
name: Unit Tests - ${{ matrix.platform }}
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: false
matrix:
include:
- runner: ubuntu-latest
platform: Linux
- runner: macos-26
platform: macOS ARM64
- runner: macos-26-intel
platform: macOS Intel
- runner: windows-latest
platform: Windows
steps:
- uses: actions/checkout@v7
- uses: voidzero-dev/setup-vp@07d0b0e993009eb3b908ea06e49e88e933b728a2 # v1.17.0
with:
node-version: '24'
cache: true
# Match the Swift toolchain selected by `swift-node init`'s generated CI.
- name: Prepare Windows native toolchain
if: runner.os == 'Windows'
uses: ./.github/actions/setup-windows-toolchain
- uses: SwiftyLab/setup-swift@38f54a76b70d989321de9dc7c840618c08cf56e9 # v1.14.0
if: runner.os != 'Windows'
with:
swift-version: 6.3.3
- run: node scripts/run-without-node-warnings.mjs vp install
- run: node scripts/run-without-node-warnings.mjs vp -C packages/swift-node pack
- run: node scripts/run-without-node-warnings.mjs vp -C packages/swift-node test
- run: node scripts/run-without-node-warnings.mjs vp -C packages/swift-node-unplugin pack
- run: node scripts/run-without-node-warnings.mjs vp -C packages/swift-node-unplugin test
example-hello-world:
name: Example - Hello World - ${{ matrix.platform }}
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: false
matrix:
include:
- runner: ubuntu-latest
platform: Linux
- runner: macos-26
platform: macOS ARM64
- runner: macos-26-intel
platform: macOS Intel
- runner: windows-latest
platform: Windows
steps:
- uses: actions/checkout@v7
- uses: voidzero-dev/setup-vp@07d0b0e993009eb3b908ea06e49e88e933b728a2 # v1.17.0
with:
node-version: '24'
cache: true
# Match the Swift toolchain selected by `swift-node init`'s generated CI.
- name: Prepare Windows native toolchain
if: runner.os == 'Windows'
uses: ./.github/actions/setup-windows-toolchain
- uses: SwiftyLab/setup-swift@38f54a76b70d989321de9dc7c840618c08cf56e9 # v1.14.0
if: runner.os != 'Windows'
with:
swift-version: 6.3.3
- name: Verify toolchain
run: |
swiftc --version
clang++ --version
- run: node scripts/run-without-node-warnings.mjs vp install
- name: Build SDK
run: |
node scripts/run-without-node-warnings.mjs vp -C packages/swift-node pack
node scripts/run-without-node-warnings.mjs vp -C packages/swift-node-unplugin pack
- name: Build example
run: node scripts/run-without-node-warnings.mjs vp -C examples/hello-world run build
- name: Test native addon and ESM/CJS consumers
run: |
node scripts/run-without-node-warnings.mjs vp -C examples/hello-world test
node scripts/run-without-node-warnings.mjs vp -C examples/hello-world-consumer-esm test
node scripts/run-without-node-warnings.mjs vp -C examples/hello-world-consumer-cjs test
node scripts/run-without-node-warnings.mjs vp -C examples/hello-world-tsdown run build
node scripts/run-without-node-warnings.mjs vp -C examples/hello-world-tsdown test
node scripts/run-without-node-warnings.mjs vp -C examples/hello-world-tsdown-consumer-esm test
node scripts/run-without-node-warnings.mjs vp -C examples/hello-world-tsdown-consumer-cjs test
- name: Test packaged install
run: node scripts/run-without-node-warnings.mjs vp test test/packaged-hello-world.test.mjs
example-secure-storage:
# This demo uses Apple's Security/Keychain framework and has no Linux backend.
name: Example - Secure Storage - ${{ matrix.platform }}
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: false
matrix:
include:
- runner: macos-26
platform: macOS ARM64
- runner: macos-26-intel
platform: macOS Intel
steps:
- uses: actions/checkout@v7
- uses: voidzero-dev/setup-vp@07d0b0e993009eb3b908ea06e49e88e933b728a2 # v1.17.0
with:
node-version: '24'
cache: true
# Match the Swift toolchain selected by `swift-node init`'s generated CI.
- uses: SwiftyLab/setup-swift@38f54a76b70d989321de9dc7c840618c08cf56e9 # v1.14.0
with:
swift-version: 6.3.3
- name: Verify toolchain
run: |
swiftc --version
clang++ --version
- run: node scripts/run-without-node-warnings.mjs vp install
- name: Build SDK
run: node scripts/run-without-node-warnings.mjs vp -C packages/swift-node pack
- name: Build examples
run: |
node scripts/run-without-node-warnings.mjs vp -C examples/secure-storage run build
node scripts/run-without-node-warnings.mjs vp -C examples/secure-storage-consumer-esm run build
- name: Test native addon and ESM/CJS consumers
run: |
node scripts/run-without-node-warnings.mjs vp -C examples/secure-storage test
node scripts/run-without-node-warnings.mjs vp -C examples/secure-storage-consumer-esm test
node scripts/run-without-node-warnings.mjs vp -C examples/secure-storage-consumer-cjs test
- name: Run ESM consumer demo
run: node scripts/run-without-node-warnings.mjs vp -C examples/secure-storage-consumer-esm run start
example-timer-callback:
name: Example - Timer Callback - ${{ matrix.platform }}
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: false
matrix:
include:
- runner: ubuntu-latest
platform: Linux
- runner: macos-26
platform: macOS ARM64
- runner: macos-26-intel
platform: macOS Intel
- runner: windows-latest
platform: Windows
steps:
- uses: actions/checkout@v7
- uses: voidzero-dev/setup-vp@07d0b0e993009eb3b908ea06e49e88e933b728a2 # v1.17.0
with:
node-version: '24'
cache: true
# Match the Swift toolchain selected by `swift-node init`'s generated CI.
- name: Prepare Windows native toolchain
if: runner.os == 'Windows'
uses: ./.github/actions/setup-windows-toolchain
- uses: SwiftyLab/setup-swift@38f54a76b70d989321de9dc7c840618c08cf56e9 # v1.14.0
if: runner.os != 'Windows'
with:
swift-version: 6.3.3
- name: Verify toolchain
run: |
swiftc --version
clang++ --version
- run: node scripts/run-without-node-warnings.mjs vp install
- name: Build SDK
run: node scripts/run-without-node-warnings.mjs vp -C packages/swift-node pack
- name: Build example
run: node scripts/run-without-node-warnings.mjs vp -C examples/timer-callback run build
- name: Test native addon and ESM/CJS consumers
run: |
node scripts/run-without-node-warnings.mjs vp -C examples/timer-callback test
node scripts/run-without-node-warnings.mjs vp -C examples/timer-callback-consumer-esm test
node scripts/run-without-node-warnings.mjs vp -C examples/timer-callback-consumer-cjs test
integration-tests:
name: Additional Integrations - ${{ matrix.platform }}
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: false
matrix:
include:
- runner: ubuntu-latest
platform: Linux
- runner: macos-26
platform: macOS ARM64
- runner: macos-26-intel
platform: macOS Intel
- runner: windows-latest
platform: Windows
steps:
- uses: actions/checkout@v7
- uses: voidzero-dev/setup-vp@07d0b0e993009eb3b908ea06e49e88e933b728a2 # v1.17.0
with:
node-version: '24'
cache: true
# Match the Swift toolchain selected by `swift-node init`'s generated CI.
- name: Prepare Windows native toolchain
if: runner.os == 'Windows'
uses: ./.github/actions/setup-windows-toolchain
- uses: SwiftyLab/setup-swift@38f54a76b70d989321de9dc7c840618c08cf56e9 # v1.14.0
if: runner.os != 'Windows'
with:
swift-version: 6.3.3
- name: Verify toolchain
run: |
swiftc --version
clang++ --version
- run: node scripts/run-without-node-warnings.mjs vp install
# Example coverage is owned by the three dedicated jobs above. Keep the
# remaining, non-example integration checks here to avoid duplicate runs.
- name: Test Node warning policy
run: node scripts/run-without-node-warnings.mjs vp test test/node-warning-policy.test.mjs
- name: Test `init <package-name>` and `init .` quick starts
run: node scripts/run-without-node-warnings.mjs vp test test/quickstart.test.mjs
- name: Test oversized string handling
run: node scripts/run-without-node-warnings.mjs vp test test/oversized-string.test.mjs
- name: Test production bridge
run: node scripts/run-without-node-warnings.mjs vp test test/production-bridge.test.mjs
- name: Test packaged production bridge
run: node scripts/run-without-node-warnings.mjs vp test test/packaged-production-bridge.test.mjs