Skip to content

Commit 3e41c4d

Browse files
committed
Add GitHub Actions CI workflow
1 parent 80e6099 commit 3e41c4d

1 file changed

Lines changed: 59 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [master]
6+
pull_request:
7+
branches: [master]
8+
9+
concurrency:
10+
group: ${{ github.workflow }}-${{ github.ref }}
11+
cancel-in-progress: true
12+
13+
jobs:
14+
swiftlint:
15+
name: SwiftLint
16+
runs-on: macos-latest
17+
steps:
18+
- uses: actions/checkout@v4
19+
20+
- name: Install or upgrade SwiftLint
21+
run: brew install swiftlint || brew upgrade swiftlint
22+
23+
- name: Run SwiftLint
24+
run: swiftlint --strict
25+
26+
build-and-test:
27+
name: ${{ matrix.name }}
28+
runs-on: ${{ matrix.runner }}
29+
strategy:
30+
fail-fast: false
31+
matrix:
32+
include:
33+
- name: macOS
34+
runner: macos-latest
35+
- name: Linux
36+
runner: ubuntu-latest
37+
steps:
38+
- uses: actions/checkout@v4
39+
40+
- name: Set up Swift
41+
uses: swift-actions/setup-swift@v2
42+
with:
43+
swift-version: "6.2"
44+
45+
- name: Cache SPM dependencies
46+
uses: actions/cache@v4
47+
with:
48+
path: |
49+
.build
50+
~/.cache/org.swift.swiftpm
51+
key: ${{ runner.os }}-spm-${{ hashFiles('Package.swift', 'Package.resolved') }}
52+
restore-keys: |
53+
${{ runner.os }}-spm-
54+
55+
- name: Build
56+
run: swift build
57+
58+
- name: Run tests
59+
run: swift test

0 commit comments

Comments
 (0)