From 4dd54b78d5caca102c2a2581050e51aeb40617f6 Mon Sep 17 00:00:00 2001 From: MahdiBM <github@mahdibm.com> Date: Sun, 7 Jul 2024 17:31:58 +0330 Subject: [PATCH 1/7] Add CI --- .github/workflows/tests.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 .github/workflows/tests.yml diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..2280d0e --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,18 @@ +name: tests +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true +on: + pull_request: { types: [opened, reopened, synchronize, ready_for_review] } + push: { branches: [ main ] } + +jobs: + main-tests: + uses: vapor/ci/.github/workflows/run-unit-tests.yml@main + with: + with_coverage: true + with_tsan: true + with_api_check: true + with_gh_codeql: false + secrets: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} From a5fa7afc5b4aec62a1d677946c4ec0e6075b006e Mon Sep 17 00:00:00 2001 From: MahdiBM <github@mahdibm.com> Date: Sun, 7 Jul 2024 17:34:04 +0330 Subject: [PATCH 2/7] Update Package.swift --- Package.swift | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Package.swift b/Package.swift index 167b3d9..0c319c3 100644 --- a/Package.swift +++ b/Package.swift @@ -6,11 +6,11 @@ import PackageDescription let package = Package( name: "SyntaxKit", platforms: [ - .macOS(.v15), - .iOS(.v18), - .tvOS(.v18), - .watchOS(.v11), - .visionOS(.v2) + .macOS(.v14), + .iOS(.v17), + .tvOS(.v17), + .watchOS(.v10), + .visionOS(.v1) ], products: [ .library( From 2a22b55bd90f588299c769167449afe981fe6703 Mon Sep 17 00:00:00 2001 From: MahdiBM <github@mahdibm.com> Date: Sun, 7 Jul 2024 18:55:19 +0330 Subject: [PATCH 3/7] Update tests.yml --- .github/workflows/tests.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 2280d0e..41b9cc0 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -4,7 +4,7 @@ concurrency: cancel-in-progress: true on: pull_request: { types: [opened, reopened, synchronize, ready_for_review] } - push: { branches: [ main ] } + push: { branches: [main] } jobs: main-tests: @@ -14,5 +14,6 @@ jobs: with_tsan: true with_api_check: true with_gh_codeql: false + extra_flags: --enable-swift-testing secrets: CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} From 937ef11bc22f060ac0b69b7b5f38c99acfcaec8b Mon Sep 17 00:00:00 2001 From: MahdiBM <github@mahdibm.com> Date: Sun, 7 Jul 2024 19:25:34 +0330 Subject: [PATCH 4/7] manual ci --- .github/workflows/tests.yml | 46 +++++++++++++++++++++++++++++-------- 1 file changed, 36 insertions(+), 10 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 41b9cc0..00f8250 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -7,13 +7,39 @@ on: push: { branches: [main] } jobs: - main-tests: - uses: vapor/ci/.github/workflows/run-unit-tests.yml@main - with: - with_coverage: true - with_tsan: true - with_api_check: true - with_gh_codeql: false - extra_flags: --enable-swift-testing - secrets: - CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + tests: + runs-on: ubuntu-latest + + container: + image: swiftlang/swift:nightly-6.0-jammy + + steps: + - name: Check out ${{ github.event.repository.name }} + uses: actions/checkout@v4 + + - name: Restore .build + id: "restore-cache" + uses: runs-on/cache/restore@v4 + with: + path: .build + # e.g. 'syntax-kit-debug-build-Linux-c7008df8062ac4d5887ead9e59aa05829e' + key: "${{ github.event.repository.name }}-debug-build-${{ runner.os }}-${{ hashFiles('./Package.resolved') }}" + restore-keys: "${{ github.event.repository.name }}-debug-build-${{ runner.os }}-" + + - name: Build ${{ github.event.repository.name }} + run: swift build --build-tests + + - name: Cache .build + if: steps.restore-cache.outputs.cache-hit != 'true' + uses: runs-on/cache/save@v4 + with: + path: .build + key: "${{ github.event.repository.name }}-debug-build-${{ runner.os }}-${{ hashFiles('./Package.resolved') }}" + + - name: Run tests + run: swift test --enable-code-coverage --enable-swift-testing --parallel + + - name: Submit code coverage + uses: vapor/swift-codecov-action@v0.3 + with: + codecov_token: ${{ secrets.CODECOV_TOKEN }} From 10a7fca503d5d165f7d34587edcb9315fbf80f12 Mon Sep 17 00:00:00 2001 From: MahdiBM <github@mahdibm.com> Date: Sun, 7 Jul 2024 19:29:44 +0330 Subject: [PATCH 5/7] add swift-testing as an explicit dependency --- Package.swift | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Package.swift b/Package.swift index 0c319c3..ca63da2 100644 --- a/Package.swift +++ b/Package.swift @@ -22,6 +22,10 @@ let package = Package( .package( url: "https://github.com/swiftlang/swift-syntax", from: "600.0.0-prerelease-2024-06-12" + ), + .package( + url: "https://github.com/apple/swift-testing", + .upToNextMinor(from: "0.10.0") ) ], targets: [ @@ -35,6 +39,7 @@ let package = Package( name: "SyntaxKitTests", dependencies: [ "SyntaxKit", + .product(name: "Testing", package: "swift-testing"), .product(name: "SwiftSyntax", package: "swift-syntax"), .product(name: "SwiftParser", package: "swift-syntax"), ] From e862abf981614a8648b89be2b0537e5678dad2aa Mon Sep 17 00:00:00 2001 From: MahdiBM <github@mahdibm.com> Date: Sun, 7 Jul 2024 19:33:57 +0330 Subject: [PATCH 6/7] try no flag --- .github/workflows/tests.yml | 14 +++++++++++--- Package.resolved | 11 ++++++++++- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 00f8250..213b725 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -8,10 +8,18 @@ on: jobs: tests: + strategy: + fail-fast: false + matrix: + swift-image: + - swiftlang/swift:nightly-6.0-jammy + - swiftlang/swift:nightly-main-jammy + runs-on: ubuntu-latest - container: - image: swiftlang/swift:nightly-6.0-jammy + container: ${{ matrix.swift-image }} + + timeout-minutes: 30 steps: - name: Check out ${{ github.event.repository.name }} @@ -37,7 +45,7 @@ jobs: key: "${{ github.event.repository.name }}-debug-build-${{ runner.os }}-${{ hashFiles('./Package.resolved') }}" - name: Run tests - run: swift test --enable-code-coverage --enable-swift-testing --parallel + run: swift test --enable-code-coverage --parallel - name: Submit code coverage uses: vapor/swift-codecov-action@v0.3 diff --git a/Package.resolved b/Package.resolved index 78e4a78..3c88138 100644 --- a/Package.resolved +++ b/Package.resolved @@ -1,5 +1,5 @@ { - "originHash" : "6c0970a097f1721e32f26d59bf4a333fa05bb0688b69f7d97dec14f0d4e86c15", + "originHash" : "50cb47421625af7188301d64f0db7fffd3b6a974fef3d3a020bbfe982829d3e3", "pins" : [ { "identity" : "swift-syntax", @@ -9,6 +9,15 @@ "revision" : "4c6cc0a3b9e8f14b3ae2307c5ccae4de6167ac2c", "version" : "600.0.0-prerelease-2024-06-12" } + }, + { + "identity" : "swift-testing", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-testing", + "state" : { + "revision" : "69d59cfc76e5daf498ca61f5af409f594768eef9", + "version" : "0.10.0" + } } ], "version" : 3 From e2e97a024d3180fcaa6f765862df9c3e6272fd8c Mon Sep 17 00:00:00 2001 From: MahdiBM <github@mahdibm.com> Date: Sun, 7 Jul 2024 19:37:49 +0330 Subject: [PATCH 7/7] better caching key --- .github/workflows/tests.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 213b725..3efd96b 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -30,9 +30,9 @@ jobs: uses: runs-on/cache/restore@v4 with: path: .build - # e.g. 'syntax-kit-debug-build-Linux-c7008df8062ac4d5887ead9e59aa05829e' - key: "${{ github.event.repository.name }}-debug-build-${{ runner.os }}-${{ hashFiles('./Package.resolved') }}" - restore-keys: "${{ github.event.repository.name }}-debug-build-${{ runner.os }}-" + # e.g. 'syntax-kit-debug-build-swiftlang/swift:nightly-6.0-jammy-Linux-c7008df8062ac4d5887ead9e59aa05829e' + key: "${{ github.event.repository.name }}-debug-build-${{ matrix.swift-image }}-${{ runner.os }}-${{ hashFiles('./Package.resolved') }}" + restore-keys: "${{ github.event.repository.name }}-debug-build-${{ matrix.swift-image }}-${{ runner.os }}-" - name: Build ${{ github.event.repository.name }} run: swift build --build-tests @@ -42,7 +42,7 @@ jobs: uses: runs-on/cache/save@v4 with: path: .build - key: "${{ github.event.repository.name }}-debug-build-${{ runner.os }}-${{ hashFiles('./Package.resolved') }}" + key: "${{ github.event.repository.name }}-debug-build-${{ matrix.swift-image }}-${{ runner.os }}-${{ hashFiles('./Package.resolved') }}" - name: Run tests run: swift test --enable-code-coverage --parallel