-
Notifications
You must be signed in to change notification settings - Fork 0
78 lines (78 loc) · 2.65 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
name: CI
on:
push:
branches: main
paths:
- '**.swift'
- '.github/workflows/ci.yml'
pull_request: {}
concurrency:
group: ${{ github.head_ref }}-${{ github.workflow }}
cancel-in-progress: true
jobs:
generate-matrix:
name: Generate matrix
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v4
- id: set-matrix
run: |
matrix=$(cat .github/matrix.json | jq -c .)
echo "matrix=$matrix" >> $GITHUB_OUTPUT
test:
name: Test
needs: generate-matrix
runs-on: macOS-14
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.generate-matrix.outputs.matrix) }}
env:
DEVELOPER_DIR: /Applications/Xcode_${{ matrix.xcode_version }}.app/Contents/Developer
steps:
- uses: actions/checkout@v4
- name: Cache SPM build directory
uses: actions/cache@v4
env:
cache-name: swiftpm
with:
path: .build
key: ${{ runner.os }}-${{ github.job }}-${{ matrix.xcode_version }}-${{ env.cache-name }}-${{ hashFiles('**/Package.swift') }}
restore-keys: |
${{ runner.os }}-${{ github.job }}-${{ matrix.xcode_version }}-${{ env.cache-name }}-
${{ runner.os }}-${{ github.job }}-${{ matrix.xcode_version }}-
${{ runner.os }}-${{ github.job }}-
${{ runner.os }}-
# - name: Cache Homebrew modules
# uses: actions/cache@v4
# env:
# cache-name: brew
# with:
# path: |
# ~/Library/Caches/Homebrew/downloads
# key: ${{ runner.os }}-${{ github.job }}-${{ matrix.xcode_version }}-${{ env.cache-name }}-${{ hashFiles('**/Package.swift') }}
# restore-keys: |
# ${{ runner.os }}-${{ github.job }}-${{ matrix.xcode_version }}-${{ env.cache-name }}-
# ${{ runner.os }}-${{ github.job }}-${{ matrix.xcode_version }}-
# ${{ runner.os }}-${{ github.job }}-
# ${{ runner.os }}-
- name: Disable SwiftLint Plugin
run: sed -i -e 's/.*SwiftLint.*//g' Package.swift
- name: Install LLVM
env:
HOMEBREW_NO_AUTO_UPDATE: 1
run: brew install llvm
- name: Activate clang module
run: |
swift package resolve
sudo swift .build/checkouts/ClangSwift/utils/make-pkgconfig.swift
- name: Build
run: swift build
- name: Test
run: swift test
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
path: .build/debug/sbgen
name: sbgen-${{ github.sha }}-xcode-${{ matrix.xcode_version }}