Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add basic GitHub CI workflow #12

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
107 changes: 107 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
# This workflow runs CI tests for the main package and Examples package
name: CI

# Trigger the workflow on push to main, any pull request, or manual dispatch
on:
push:
branches:
- main
- github-ci
pull_request:
branches:
- '*'
workflow_dispatch:

# Ensure only one workflow per ref is running at a time
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true

jobs:
macos:
name: macOS - ${{ matrix.package }} (Xcode ${{ matrix.xcode }})
runs-on: macos-14
strategy:
matrix:
xcode:
- '15.4'
# - '15.0'
- '16.0'
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Select Xcode ${{ matrix.xcode }}
run: sudo xcode-select -s /Applications/Xcode_${{ matrix.xcode }}.app

- name: Print Swift version
run: swift --version

- name: Build package
run: swift build

- name: Run tests
run: swift test

linux:
name: Ubuntu - ${{ matrix.package }} (Swift ${{ matrix.swift }})
runs-on: ubuntu-latest
strategy:
matrix:
swift:
- '6.0'
- '5.10'
# - '5.9'
package:
- 'main'
container: swift:${{ matrix.swift }}
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Build package
run: swift build

- name: Run tests
run: swift test

windows:
name: Windows - ${{ matrix.package }} (Swift ${{ matrix.swift }})
runs-on: windows-latest
strategy:
matrix:
swift:
- '6.0'
- '5.10'
# - '5.9.1' # Macros has been added to Swift on Windows in 5.9.1 version
package:
- 'main'
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install Swift
uses: compnerd/gha-setup-swift@main
with:
branch: swift-${{ matrix.swift }}-release
tag: ${{ matrix.swift }}-RELEASE

- name: Build package
run: swift build

- name: Run tests
run: swift test

check-macro-compatibility:
name: Check Macro Compatibility
runs-on: macos-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Run Swift Macro Compatibility Check
uses: Matejkob/swift-macro-compatibility-check@v1
with:
run-tests: true
major-versions-only: false