chore(package): initial package config and files #4
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI — digipin-swift | |
| on: | |
| push: | |
| branches: [main] | |
| paths: | |
| - "Sources/**" | |
| - "Tests/**" | |
| - "Package.swift" | |
| - ".github/workflows/ci.yml" | |
| pull_request: | |
| branches: [main] | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| jobs: | |
| test: | |
| name: Build & Test (${{ matrix.os }}) | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: | |
| - ubuntu-latest | |
| - macos-latest | |
| - windows-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 | |
| with: | |
| fetch-depth: 0 | |
| # ------------------------------------------------- | |
| # Linux — Swiftly (official prebuilt binary) | |
| # ------------------------------------------------- | |
| - name: Install Swift (Linux via Swiftly) | |
| if: runner.os == 'Linux' | |
| run: | | |
| curl --proto '=https' -fsSL \ | |
| https://download.swift.org/swiftly/linux/swiftly-$(uname -m).tar.gz \ | |
| -o swiftly.tar.gz | |
| tar zxf swiftly.tar.gz | |
| ./swiftly init --quiet-shell-followup | |
| . "${SWIFTLY_HOME_DIR:-$HOME/.local/share/swiftly}/env.sh" | |
| hash -r | |
| echo "$HOME/.local/bin" >> $GITHUB_PATH | |
| swiftly install 6.2 | |
| swiftly use 6.2 | |
| # ------------------------------------------------- | |
| # macOS — Swiftly (official pkg installer) | |
| # ------------------------------------------------- | |
| - name: Install Swift (macOS via Swiftly pkg) | |
| if: runner.os == 'macOS' | |
| run: | | |
| curl --proto '=https' -fsSL https://download.swift.org/swiftly/darwin/swiftly.pkg -o swiftly.pkg | |
| installer -pkg swiftly.pkg -target CurrentUserHomeDirectory | |
| ~/.swiftly/bin/swiftly init --quiet-shell-followup | |
| . "${SWIFTLY_HOME_DIR:-$HOME/.swiftly}/env.sh" | |
| hash -r | |
| swiftly install 6.2 | |
| swiftly use 6.2 | |
| echo "$HOME/.swiftly/bin" >> $GITHUB_PATH | |
| # ------------------------------------------------- | |
| # Windows — Swift + MSVC via WinGet (official) | |
| # ------------------------------------------------- | |
| - name: Install Swift (Windows via winget) | |
| if: runner.os == 'Windows' | |
| shell: pwsh | |
| run: | | |
| winget install --id Microsoft.VisualStudio.2022.Community ` | |
| --exact --force ` | |
| --custom "--add Microsoft.VisualStudio.Component.Windows11SDK.22621 ` | |
| --add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 ` | |
| --add Microsoft.VisualStudio.Component.VC.Tools.ARM64" | |
| winget install --id Swift.Toolchain -e ` | |
| --accept-source-agreements ` | |
| --accept-package-agreements | |
| # ------------------------------------------------- | |
| # Core CI steps | |
| # ------------------------------------------------- | |
| - name: Verify Swift toolchain | |
| run: swift --version | |
| - name: Build (debug) | |
| run: swift build --configuration debug | |
| - name: Test | |
| run: swift test --enable-test-discovery | |
| - name: Upload build artifacts (on failure) | |
| if: failure() | |
| uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # 6.0.0 | |
| with: | |
| name: swift-build-${{ matrix.os }} | |
| path: | | |
| .build/ |