From d8ddc57a9a3ffe5d5523293d74eee057e93c8fdb Mon Sep 17 00:00:00 2001 From: laosb Date: Wed, 20 Aug 2025 21:07:22 +0800 Subject: [PATCH] ci: Add CI workflow for Linux and macOS with Swift 6.1/6.2 --- .github/workflows/ci.yml | 65 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..9692200 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,65 @@ +name: CI + +on: + push: + branches: [main] + pull_request: + branches: [main] + +jobs: + test-linux: + name: Test on Linux + runs-on: ubuntu-latest + strategy: + matrix: + swift-version: ["6.1", "6.2"] + container: + image: swift:${{ matrix.swift-version }} + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Cache Swift packages + uses: actions/cache@v4 + with: + path: .build + key: ${{ runner.os }}-swift-${{ matrix.swift-version }}-${{ hashFiles('**/Package.resolved') }} + restore-keys: | + ${{ runner.os }}-swift-${{ matrix.swift-version }}- + ${{ runner.os }}-swift- + + - name: Build package + run: swift build --verbose + + - name: Run tests + run: swift test --verbose + + test-macos: + name: Test on macOS + runs-on: macos-latest + strategy: + matrix: + swift-version: ["6.1", "6.2"] + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup Swift ${{ matrix.swift-version }} + uses: swift-actions/setup-swift@v2 + with: + swift-version: ${{ matrix.swift-version }} + + - name: Cache Swift packages + uses: actions/cache@v4 + with: + path: .build + key: ${{ runner.os }}-swift-${{ matrix.swift-version }}-${{ hashFiles('**/Package.resolved') }} + restore-keys: | + ${{ runner.os }}-swift-${{ matrix.swift-version }}- + ${{ runner.os }}-swift- + + - name: Build package + run: swift build --verbose + + - name: Run tests + run: swift test --verbose