From 0ae8219902d5ef4990168e0e706efe917aff65f0 Mon Sep 17 00:00:00 2001 From: Jay Herron Date: Sun, 5 Nov 2023 21:05:39 -0700 Subject: [PATCH 1/6] chore: Runs tests in parallel --- .github/workflows/build.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2bb57301..20479c7d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -30,7 +30,7 @@ jobs: - uses: swift-actions/setup-swift@v1 - uses: actions/checkout@v3 - name: Test - run: swift test + run: swift test --parallel # ubuntu-latest is ubuntu-22.04 currently. Swift versions older than 5.7 don't have builds for 22.04. https://www.swift.org/download/ ubuntu-old: @@ -46,7 +46,7 @@ jobs: swift-version: ${{ matrix.swift }} - uses: actions/checkout@v3 - name: Test - run: swift test + run: swift test --parallel ubuntu-latest: name: Build ${{ matrix.swift }} on ${{ matrix.os }} @@ -61,4 +61,4 @@ jobs: swift-version: ${{ matrix.swift }} - uses: actions/checkout@v3 - name: Test - run: swift test + run: swift test --parallel From b58c8fac9ab336561c76a5eb2cde66f492f731ae Mon Sep 17 00:00:00 2001 From: Jay Herron Date: Sun, 5 Nov 2023 21:07:35 -0700 Subject: [PATCH 2/6] chore: Avoids XCTest issues in MacOS --- .github/workflows/build.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 20479c7d..df61d40f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -27,10 +27,12 @@ jobs: name: Build and test on macos-latest runs-on: macos-latest steps: - - uses: swift-actions/setup-swift@v1 + - uses: maxim-lobanov/setup-xcode@v1 + with: + xcode-version: latest - uses: actions/checkout@v3 - - name: Test - run: swift test --parallel + - name: Build and test + run: swift test --parallel --enable-test-discovery # ubuntu-latest is ubuntu-22.04 currently. Swift versions older than 5.7 don't have builds for 22.04. https://www.swift.org/download/ ubuntu-old: From 6ef65e3856c78ee70073f1a54801b12a06750f9f Mon Sep 17 00:00:00 2001 From: Jay Herron Date: Sun, 5 Nov 2023 21:09:08 -0700 Subject: [PATCH 3/6] chore: Adds llvm test coverage export --- .github/workflows/build.yml | 25 +++++++++++++++++++++++-- .gitignore | 3 +++ 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index df61d40f..6760701e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -35,7 +35,7 @@ jobs: run: swift test --parallel --enable-test-discovery # ubuntu-latest is ubuntu-22.04 currently. Swift versions older than 5.7 don't have builds for 22.04. https://www.swift.org/download/ - ubuntu-old: + ubuntu-20_04: name: Build ${{ matrix.swift }} on ${{ matrix.os }} runs-on: ${{ matrix.os }} strategy: @@ -50,7 +50,7 @@ jobs: - name: Test run: swift test --parallel - ubuntu-latest: + ubuntu-22_04: name: Build ${{ matrix.swift }} on ${{ matrix.os }} runs-on: ${{ matrix.os }} strategy: @@ -64,3 +64,24 @@ jobs: - uses: actions/checkout@v3 - name: Test run: swift test --parallel + + ubuntu-latest: + name: Test Latest Swift on Latest Ubuntu + runs-on: ubuntu-latest + steps: + - uses: swift-actions/setup-swift@v1 + - uses: actions/checkout@v3 + - name: Test + run: swift test --parallel --enable-code-coverage + - name: Get test coverage html + run: | + llvm-cov show \ + $(swift build --show-bin-path)/GraphQLPackageTests.xctest \ + --instr-profile $(swift build --show-bin-path)/codecov/default.profdata \ + --format html \ + --output-dir=.test-coverage + - name: Upload test coverage html + uses: actions/upload-artifact@v3 + with: + name: test-coverage-report + path: .test-coverage diff --git a/.gitignore b/.gitignore index 19e5288c..f10a07cf 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,6 @@ ### SwiftPM ### .build/ .swiftpm/ + +### CI Artifacts ### +/.test-coverage \ No newline at end of file From e7ecdd0314382ac03a8eb9f7d5db38c01a36afcc Mon Sep 17 00:00:00 2001 From: Jay Herron Date: Sun, 5 Nov 2023 21:09:50 -0700 Subject: [PATCH 4/6] chore: Improves job names --- .github/workflows/build.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6760701e..9bcb4401 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -11,7 +11,7 @@ on: jobs: formatlint: - name: Lint for correct formatting + name: Format linting runs-on: ubuntu-latest steps: - name: Checkout @@ -24,7 +24,7 @@ jobs: run: docker run --rm -v ${{ github.workspace }}:/repo ghcr.io/nicklockwood/swiftformat:latest /repo --lint macos: - name: Build and test on macos-latest + name: Test on macOS runs-on: macos-latest steps: - uses: maxim-lobanov/setup-xcode@v1 @@ -36,7 +36,7 @@ jobs: # ubuntu-latest is ubuntu-22.04 currently. Swift versions older than 5.7 don't have builds for 22.04. https://www.swift.org/download/ ubuntu-20_04: - name: Build ${{ matrix.swift }} on ${{ matrix.os }} + name: Test Swift ${{ matrix.swift }} on ${{ matrix.os }} runs-on: ${{ matrix.os }} strategy: matrix: @@ -51,7 +51,7 @@ jobs: run: swift test --parallel ubuntu-22_04: - name: Build ${{ matrix.swift }} on ${{ matrix.os }} + name: Test Swift ${{ matrix.swift }} on ${{ matrix.os }} runs-on: ${{ matrix.os }} strategy: matrix: From 37890ce9d87d13685c0112f2667b5d05d2d3d6d4 Mon Sep 17 00:00:00 2001 From: Jay Herron Date: Sun, 5 Nov 2023 21:15:16 -0700 Subject: [PATCH 5/6] chore: Moves test and clarifies naming --- .github/workflows/build.yml | 62 ++++++++++++++++++------------------- 1 file changed, 30 insertions(+), 32 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9bcb4401..1dd2163d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -34,29 +34,33 @@ jobs: - name: Build and test run: swift test --parallel --enable-test-discovery - # ubuntu-latest is ubuntu-22.04 currently. Swift versions older than 5.7 don't have builds for 22.04. https://www.swift.org/download/ - ubuntu-20_04: - name: Test Swift ${{ matrix.swift }} on ${{ matrix.os }} - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [ubuntu-20.04] - swift: ["5.5", "5.6"] + linux: + name: Test on Linux + runs-on: ubuntu-latest steps: - uses: swift-actions/setup-swift@v1 - with: - swift-version: ${{ matrix.swift }} - uses: actions/checkout@v3 - name: Test - run: swift test --parallel + run: swift test --parallel --enable-code-coverage + - name: Get test coverage html + run: | + llvm-cov show \ + $(swift build --show-bin-path)/GraphQLPackageTests.xctest \ + --instr-profile $(swift build --show-bin-path)/codecov/default.profdata \ + --format html \ + --output-dir=.test-coverage + - name: Upload test coverage html + uses: actions/upload-artifact@v3 + with: + name: test-coverage-report + path: .test-coverage - ubuntu-22_04: - name: Test Swift ${{ matrix.swift }} on ${{ matrix.os }} - runs-on: ${{ matrix.os }} + backcompat-ubuntu-22_04: + name: Test Swift ${{ matrix.swift }} on Ubuntu 22.04 + runs-on: ubuntu-22.04 strategy: matrix: - os: [ubuntu-latest] - swift: ["5.7", "5.8", "5.9"] + swift: ["5.7", "5.8"] steps: - uses: swift-actions/setup-swift@v1 with: @@ -65,23 +69,17 @@ jobs: - name: Test run: swift test --parallel - ubuntu-latest: - name: Test Latest Swift on Latest Ubuntu - runs-on: ubuntu-latest + # Swift versions older than 5.7 don't have builds for 22.04. https://www.swift.org/download/ + backcompat-ubuntu-20_04: + name: Test Swift ${{ matrix.swift }} on Ubuntu 20.04 + runs-on: ubuntu-20.04 + strategy: + matrix: + swift: ["5.5", "5.6"] steps: - uses: swift-actions/setup-swift@v1 + with: + swift-version: ${{ matrix.swift }} - uses: actions/checkout@v3 - name: Test - run: swift test --parallel --enable-code-coverage - - name: Get test coverage html - run: | - llvm-cov show \ - $(swift build --show-bin-path)/GraphQLPackageTests.xctest \ - --instr-profile $(swift build --show-bin-path)/codecov/default.profdata \ - --format html \ - --output-dir=.test-coverage - - name: Upload test coverage html - uses: actions/upload-artifact@v3 - with: - name: test-coverage-report - path: .test-coverage + run: swift test --parallel From 6f77149e4a8a2a9855eea538b67764ee100301b8 Mon Sep 17 00:00:00 2001 From: Jay Herron Date: Sun, 5 Nov 2023 21:26:36 -0700 Subject: [PATCH 6/6] chore: Code coverage ignores .build and test files --- .github/workflows/build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1dd2163d..491d2aaa 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -47,6 +47,7 @@ jobs: llvm-cov show \ $(swift build --show-bin-path)/GraphQLPackageTests.xctest \ --instr-profile $(swift build --show-bin-path)/codecov/default.profdata \ + --ignore-filename-regex="\.build|Tests" \ --format html \ --output-dir=.test-coverage - name: Upload test coverage html