Add CI #8
Workflow file for this run
This file contains 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
# Build and Test | |
name: Build and Test | |
on: | |
workflow_dispatch: | |
pull_request: | |
push: | |
branches: | |
- main | |
jobs: | |
build-and-test: | |
name: Build and Test for Apple Platforms | |
strategy: | |
matrix: | |
xcode-version: | |
- "16" | |
xcode-configuration: | |
- destination: "platform=iOS Simulator,name=iPhone 16" | |
sdk: "iphonesimulator" | |
- destination: "platform=macOS" | |
sdk: "macosx" | |
swift-configuration: | |
- "debug" | |
- "release" | |
runs-on: macos-15 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Select Xcode | |
run: sudo xcode-select -s /Applications/Xcode_${{ matrix.xcode-version }}.app/Contents/Developer | |
- name: Build | |
run: | | |
xcrun xcodebuild clean build \ | |
-workspace Xcode/SwiftProjectTemplateApp.xcworkspace \ | |
-scheme SwiftProjectTemplateApp \ | |
-derivedDataPath ".build/Xcode.noindex/DerivedData" \ | |
-configuration "${{ matrix.swift-configuration }}" \ | |
-sdk "${{ matrix.xcode-configuration.sdk }}" \ | |
-destination "${{ matrix.xcode-configuration.destination }}" | |
- name: Test | |
run: | | |
xcrun xcodebuild test \ | |
-workspace Xcode/SwiftProjectTemplateApp.xcworkspace \ | |
-scheme SwiftProjectTemplateAppUITests \ | |
-derivedDataPath ".build/Xcode.noindex/DerivedData" \ | |
-configuration "${{ matrix.swift-configuration }}" \ | |
-sdk "${{ matrix.xcode-configuration.sdk }}" \ | |
-destination "${{ matrix.xcode-configuration.destination }}" | |
- name: Upload Test Results | |
uses: actions/upload-artifact@v4 | |
with: | |
name: Test Results (${{ matrix }}) | |
path: .build/Xcode.noindex/DerivedData/Logs/Test | |
- name: Check that repository is clean | |
run: | |
git diff --exit-code | |
build-and-test-in-devcontainer: | |
name: Build and Test in Devcontainer | |
strategy: | |
matrix: | |
devcontainer-name: ["default"] | |
swift-configuration: ["debug", "release"] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Make devcontainer '${{ matrix.devcontainer-name }}' singular | |
run: .devcontainer/devcontainer-helper --make-singular ${{ matrix.devcontainer-name }} | |
- name: Initialize devcontainer | |
uses: devcontainers/[email protected] | |
with: | |
push: never | |
runCmd: | | |
echo "Devcontainer Initialized." | |
- name: Build | |
uses: devcontainers/[email protected] | |
with: | |
push: never | |
runCmd: | | |
swift build --configuration ${{ matrix.swift-configuration }} | |
- name: Build Tests | |
if: matrix.swift-configuration == 'debug' | |
uses: devcontainers/[email protected] | |
with: | |
push: never | |
runCmd: | | |
swift build --build-tests --configuration ${{ matrix.swift-configuration }} | |
- name: Test | |
uses: devcontainers/[email protected] | |
if: matrix.swift-configuration == 'debug' | |
with: | |
push: never | |
runCmd: | | |
swift test --skip-build | |
- name: Check that repository is clean | |
run: | |
.devcontainer/devcontainer-helper --clean | |
git diff --exit-code |