Skip to content

Commit

Permalink
Add CI (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
MahdiBM authored Jul 7, 2024
2 parents 0f9676f + e2e97a0 commit 640aff1
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 6 deletions.
53 changes: 53 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
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:
tests:
strategy:
fail-fast: false
matrix:
swift-image:
- swiftlang/swift:nightly-6.0-jammy
- swiftlang/swift:nightly-main-jammy

runs-on: ubuntu-latest

container: ${{ matrix.swift-image }}

timeout-minutes: 30

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-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

- 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-${{ matrix.swift-image }}-${{ runner.os }}-${{ hashFiles('./Package.resolved') }}"

- name: Run tests
run: swift test --enable-code-coverage --parallel

- name: Submit code coverage
uses: vapor/[email protected]
with:
codecov_token: ${{ secrets.CODECOV_TOKEN }}
11 changes: 10 additions & 1 deletion Package.resolved
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"originHash" : "6c0970a097f1721e32f26d59bf4a333fa05bb0688b69f7d97dec14f0d4e86c15",
"originHash" : "50cb47421625af7188301d64f0db7fffd3b6a974fef3d3a020bbfe982829d3e3",
"pins" : [
{
"identity" : "swift-syntax",
Expand All @@ -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
Expand Down
15 changes: 10 additions & 5 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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: [
Expand All @@ -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"),
]
Expand Down

0 comments on commit 640aff1

Please sign in to comment.