From f802fa8732c8577daaeb898b803fbc374b3cf7fe Mon Sep 17 00:00:00 2001 From: Jesse Wesson <5934501+cybersonik@users.noreply.github.com> Date: Thu, 29 Aug 2024 21:19:59 -0700 Subject: [PATCH] wip: Split macOS and Linux GHA into separate jobs Add concurrency setting to GHS so only one will run at a time --- .github/workflows/swift.yml | 49 +++++++++++++++++++++++++++++++++---- 1 file changed, 44 insertions(+), 5 deletions(-) diff --git a/.github/workflows/swift.yml b/.github/workflows/swift.yml index 2d806cc..bc63309 100644 --- a/.github/workflows/swift.yml +++ b/.github/workflows/swift.yml @@ -13,14 +13,18 @@ on: pull_request: branches: [ "main" ] +concurrency: + group: ci-${{ github.ref }} + cancel-in-progress: true + jobs: - build: - name: Build and test on ${{ matrix.os }} - runs-on: ${{ matrix.os }} + macos: strategy: matrix: - os: [macos-14, ubuntu-latest] + os: [macos-14] + name: Build and test on ${{ matrix.os }} + runs-on: ${{ matrix.os }} steps: - uses: swift-actions/setup-swift@v2 with: @@ -48,4 +52,39 @@ jobs: with: name: Swift tests on ${{ matrix.os }} path: results.xml - reporter: java-junit \ No newline at end of file + reporter: java-junit + + ubuntu: + strategy: + matrix: + os: [ubuntu-latest] + + name: Build and test on ${{ matrix.os }} + runs-on: ${{ matrix.os }} + container: swiftlang/swift:nightly-6.0-jammy + steps: + - uses: actions/checkout@v3 + - name: Get swift version + run: swift --version + - name: Get macOS version + run: sw_vers + if: startsWith( matrix.os, 'macos' ) + - name: Set TEST_GITHUB_TOKEN env variable + shell: bash + env: + TEST_GITHUB_TOKEN: ${{ secrets.TEST_GITHUB_TOKEN }} + run: | + echo "$TEST_GITHUB_TOKEN" > $HOME/.env + - name: Build + run: swift build --build-tests + - name: Run tests + run: swift test --parallel --xunit-output=results.xml + - name: Report test results + uses: phoenix-actions/test-reporting@v8 + id: test-report + if: success() || failure() # run this step even if previous step failed + with: + name: Swift tests on ${{ matrix.os }} + path: results.xml + reporter: java-junit +