Skip to content

Commit 98650c6

Browse files
authored
GitHub Actions workflow fixes (#422)
This PR proposes fixes for some of the workflow issues introduced with #418, and to update the GitHub Actions workflows where appropriate to use recent versions of Xcode, macOS and the Actions plugins. This ended up being a wonderful confluence of problems to solve, resulting in the following changes: - macOS 11 runners have been removed (GHA doesn't support them anymore). - Swift versions prior to 5.7 on platforms other than macOS had to be removed, as the images were conflicting with the actions/checkout action (in reality, all node-based actions would fail on these older images). - Where possible, base tasks like SwiftLint and CocoaPods verification happen on a macOS 14 Sonoma image running Xcode 15.4 (the latest at the time of authoring). - CocoaPods needed to be upgraded for visionOS support. - A few minor SwiftLint violations introduced in recent versions needed to be fixed or disabled. - I disabled running SwiftLint from within the Xcode project when it detects that it is being built on CI. It seemed unnecessary given it's running in a dedicated workflow. - Existing workflow jobs will now auto-cancel if a new set of jobs is started on the same branch.
1 parent 60be6ad commit 98650c6

File tree

15 files changed

+213
-148
lines changed

15 files changed

+213
-148
lines changed

.github/workflows/bazel.yml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,15 @@ on:
2727
- '.bazelrc'
2828
- '.bazelversion'
2929

30+
concurrency:
31+
group: bazel-${{ github.ref }}
32+
cancel-in-progress: true
33+
3034
jobs:
31-
MacOS:
32-
runs-on: macos-13
35+
macOS:
36+
runs-on: macos-14
3337
steps:
34-
- uses: actions/checkout@v3
38+
- uses: actions/checkout@v4
3539
- name: Apple tests
3640
run: bazelisk test //Tests/...
3741
Linux:
@@ -42,7 +46,7 @@ jobs:
4246
container:
4347
image: swift:${{ matrix.tag }}-focal
4448
steps:
45-
- uses: actions/checkout@v3
46-
- uses: bazelbuild/setup-bazelisk@v2
49+
- uses: actions/checkout@v4
50+
- uses: bazelbuild/setup-bazelisk@v3
4751
- name: Yams tests
4852
run: bazel test --test_output=all //Tests:UnitTests

.github/workflows/cmake.yml

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: CMake
33
on:
44
push:
55
branches: [main]
6-
paths:
6+
paths:
77
- '.github/workflows/cmake.yml'
88
- '**/CMakeLists.txt'
99
- '**/*.cmake'
@@ -12,7 +12,7 @@ on:
1212
- 'Sources/**/*.swift'
1313
- 'Sources/**/module.modulemap'
1414
pull_request:
15-
paths:
15+
paths:
1616
- '.github/workflows/cmake.yml'
1717
- '**/CMakeLists.txt'
1818
- '**/*.cmake'
@@ -21,33 +21,40 @@ on:
2121
- 'Sources/**/*.swift'
2222
- 'Sources/**/module.modulemap'
2323

24+
concurrency:
25+
group: cmake-${{ github.ref }}
26+
cancel-in-progress: true
27+
2428
jobs:
2529
CMake:
30+
name: macOS with Xcode ${{ matrix.xcode_version }}
2631
strategy:
2732
matrix:
28-
xcode_version: ['14.2', '14.3', '15.0']
29-
runs-on: macos-13
33+
xcode_version: ['15.0', '15.1', '15.2', '15.3', '15.4']
34+
runs-on: macos-14
3035
env:
3136
DEVELOPER_DIR: /Applications/Xcode_${{ matrix.xcode_version }}.app
3237
steps:
33-
- uses: actions/checkout@v3
38+
- uses: actions/checkout@v4
39+
- run: sudo chown runner:admin /usr/local
3440
- run: brew install cmake ninja
3541
- run: swift -version
3642
- run: rm -rf build
3743
- run: cmake -B build -G Ninja -S . -DCMAKE_BUILD_TYPE=Release
3844
- run: cmake --build build
3945
- run: cmake --build build --target install
40-
- run: file /usr/local/lib/swift/macosx/libYams.dylib | grep "Mach-O 64-bit dynamically linked shared library x86_64"
46+
- run: file /usr/local/lib/swift/macosx/libYams.dylib | grep "Mach-O 64-bit dynamically linked shared library arm64"
4147

4248
CMake_Linux:
49+
name: Linux with Swift ${{ matrix.tag }}
4350
strategy:
4451
matrix:
45-
tag: ['5.6', '5.7', '5.8', '5.9', '5.10']
52+
tag: ['5.7', '5.8', '5.9', '5.10']
4653
runs-on: ubuntu-latest
4754
container:
4855
image: swift:${{ matrix.tag }}
4956
steps:
50-
- uses: actions/checkout@v3
57+
- uses: actions/checkout@v4
5158
- run: apt-get update && apt-get install -y ninja-build curl
5259
- run: curl -L https://github.com/Kitware/CMake/releases/download/v3.23.1/cmake-3.23.1-linux-x86_64.tar.gz | tar xz --strip-components=1 -C /usr
5360
- run: swift -version

.github/workflows/jazzy.yml

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Jazzy
33
on:
44
push:
55
branches: [main]
6-
paths:
6+
paths:
77
- '.github/workflows/jazzy.yml'
88
- '.jazzy.yaml'
99
- '**/*.md'
@@ -12,7 +12,7 @@ on:
1212
- 'Package*'
1313
- 'Sources/**/*.swift'
1414
pull_request:
15-
paths:
15+
paths:
1616
- '.github/workflows/jazzy.yml'
1717
- '.jazzy.yaml'
1818
- '**/*.md'
@@ -21,21 +21,25 @@ on:
2121
- 'Package*'
2222
- 'Sources/**/*.swift'
2323

24+
concurrency:
25+
group: jazzy-${{ github.ref }}
26+
cancel-in-progress: true
27+
2428
jobs:
2529
Jazzy:
26-
runs-on: macos-13
30+
runs-on: macos-14
2731
env:
28-
DEVELOPER_DIR: /Applications/Xcode_15.0.app
32+
DEVELOPER_DIR: /Applications/Xcode_15.4.app
2933
steps:
30-
- uses: actions/checkout@v3
34+
- uses: actions/checkout@v4
3135
- name: Install SourceKitten
3236
run: brew install sourcekitten
3337
- run: swift build
3438
- name: Generate documentation json
3539
run: sourcekitten doc --spm --module-name Yams > yams.json
3640
- uses: ruby/setup-ruby@v1
3741
with:
38-
ruby-version: 2.7.5
42+
ruby-version: 3.3.3
3943
bundler-cache: true
4044
- name: Run jazzy
4145
run: bundle exec jazzy --clean --sourcekitten-sourcefile yams.json
@@ -47,7 +51,7 @@ jobs:
4751
exit 1
4852
fi
4953
- name: Upload Artifact
50-
uses: actions/upload-artifact@v1
54+
uses: actions/upload-artifact@v4
5155
with:
5256
name: API Docs
5357
path: docs

.github/workflows/nightly.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Nightly
33
on:
44
push:
55
branches: [main]
6-
paths:
6+
paths:
77
- '.github/workflows/nightly.yml'
88
- 'Package*'
99
- 'Sources/**/*.[ch]'
@@ -12,7 +12,7 @@ on:
1212
- 'Tests/**/*.swift'
1313
- 'Tests/**/*.ya?ml'
1414
pull_request:
15-
paths:
15+
paths:
1616
- '.github/workflows/nightly.yml'
1717
- 'Package*'
1818
- 'Sources/**/*.[ch]'
@@ -23,13 +23,17 @@ on:
2323
schedule:
2424
- cron: '0 4 * * *'
2525

26+
concurrency:
27+
group: nightly-${{ github.ref }}
28+
cancel-in-progress: true
29+
2630
jobs:
2731
Nightly:
2832
runs-on: ubuntu-latest
2933
container:
3034
image: swiftlang/swift:nightly
3135
steps:
32-
- uses: actions/checkout@v3
36+
- uses: actions/checkout@v4
3337
- run: swift --version
3438
- run: YAMS_DEFAULT_ENCODING=UTF16 swift test --parallel
3539
- run: YAMS_DEFAULT_ENCODING=UTF8 swift test --parallel

.github/workflows/pod_lib_lint.yml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,27 +3,31 @@ name: pod lib lint
33
on:
44
push:
55
branches: [main]
6-
paths:
6+
paths:
77
- '.github/workflows/pod_lib_lint.yml'
88
- '*.podspec'
99
- 'Gemfile*'
1010
- 'Sources/**/*.[ch]'
1111
- 'Sources/**/*.swift'
1212
pull_request:
13-
paths:
13+
paths:
1414
- '.github/workflows/pod_lib_lint.yml'
1515
- '*.podspec'
1616
- 'Gemfile*'
1717
- 'Sources/**/*.[ch]'
1818
- 'Sources/**/*.swift'
1919

20+
concurrency:
21+
group: pod-lib-lint-${{ github.ref }}
22+
cancel-in-progress: true
23+
2024
jobs:
2125
pod_lib_lint:
2226
name: pod lib lint
23-
runs-on: macos-13
27+
runs-on: macos-14
2428
env:
25-
DEVELOPER_DIR: /Applications/Xcode_14.3.app
29+
DEVELOPER_DIR: /Applications/Xcode_15.4.app
2630
steps:
27-
- uses: actions/checkout@v3
31+
- uses: actions/checkout@v4
2832
- run: bundle install --path vendor/bundle
2933
- run: bundle exec pod lib lint --verbose

.github/workflows/swiftlint.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,16 @@ on:
77
- '.swiftlint.yml'
88
- '**/*.swift'
99

10+
concurrency:
11+
group: swiftlint-${{ github.ref }}
12+
cancel-in-progress: true
13+
1014
jobs:
1115
SwiftLint:
1216
runs-on: ubuntu-latest
1317
container:
1418
image: ghcr.io/realm/swiftlint:0.54.0
1519
steps:
16-
- uses: actions/checkout@v3
20+
- uses: actions/checkout@v4
1721
- name: SwiftLint
1822
run: swiftlint lint --strict

.github/workflows/swiftlint_analyze.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: SwiftLint Analyze
33
on:
44
push:
55
branches: [main]
6-
paths:
6+
paths:
77
- '.github/workflows/swiftlint_analyze.yml'
88
- 'Yams.xcodeproj/**'
99
- 'Sources/**/*.[ch]'
@@ -19,13 +19,17 @@ on:
1919
- 'Tests/**/*.swift'
2020
- '!Tests/LinuxMain.swift'
2121

22+
concurrency:
23+
group: swiftlint-analyze-${{ github.ref }}
24+
cancel-in-progress: true
25+
2226
jobs:
2327
Analyze:
24-
runs-on: macos-13
28+
runs-on: macos-14
2529
env:
26-
DEVELOPER_DIR: /Applications/Xcode_15.0.app
30+
DEVELOPER_DIR: /Applications/Xcode_15.4.app
2731
steps:
28-
- uses: actions/checkout@v3
32+
- uses: actions/checkout@v4
2933
- name: Generate xcodebuild.log
3034
run: xcodebuild -sdk macosx -scheme Yams -project Yams.xcodeproj clean build-for-testing > xcodebuild.log
3135
shell: bash

.github/workflows/swiftpm.yml

Lines changed: 28 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -23,47 +23,54 @@ on:
2323
- 'Tests/**/*.swift'
2424
- 'Tests/**/*.ya?ml'
2525

26+
concurrency:
27+
group: swiftpm-${{ github.ref }}
28+
cancel-in-progress: true
29+
2630
jobs:
27-
Xcode:
31+
Xcode_Monterey:
32+
name: macOS 12 with Xcode ${{ matrix.xcode_version }}
2833
strategy:
2934
matrix:
30-
xcode_version: ['12.5.1', '13.0', '13.1', '13.2.1']
31-
runs-on: macos-11
35+
xcode_version: ['13.3.1', '13.4', '14.0.1', '14.1', '14.2']
36+
runs-on: macos-12
3237
env:
3338
DEVELOPER_DIR: /Applications/Xcode_${{ matrix.xcode_version }}.app
3439
steps:
35-
- uses: actions/checkout@v3
40+
- uses: actions/checkout@v4
3641
- run: swift -version
3742
- run: YAMS_DEFAULT_ENCODING=UTF16 swift test --parallel
3843
- run: YAMS_DEFAULT_ENCODING=UTF8 swift test --parallel
3944

40-
Xcode_Monterey:
45+
Xcode_Ventura:
46+
name: macOS 13 with Xcode ${{ matrix.xcode_version }}
4147
strategy:
4248
matrix:
43-
xcode_version: ['13.3.1', '13.4', '14.0.1', '14.1', '14.2']
44-
runs-on: macos-12
49+
xcode_version: ['14.3', '15.0']
50+
runs-on: macos-13
4551
env:
4652
DEVELOPER_DIR: /Applications/Xcode_${{ matrix.xcode_version }}.app
4753
steps:
48-
- uses: actions/checkout@v3
54+
- uses: actions/checkout@v4
4955
- run: swift -version
5056
- run: YAMS_DEFAULT_ENCODING=UTF16 swift test --parallel
5157
- run: YAMS_DEFAULT_ENCODING=UTF8 swift test --parallel
5258

53-
Xcode_Ventura:
59+
Xcode_Sonoma:
60+
name: macOS 14 with Xcode ${{ matrix.xcode_version }}
5461
strategy:
5562
matrix:
56-
xcode_version: ['14.3', '15.0']
57-
runs-on: macos-13
63+
xcode_version: ['15.4']
64+
runs-on: macos-14
5865
env:
5966
DEVELOPER_DIR: /Applications/Xcode_${{ matrix.xcode_version }}.app
6067
steps:
61-
- uses: actions/checkout@v3
68+
- uses: actions/checkout@v4
6269
- run: swift -version
6370
- run: YAMS_DEFAULT_ENCODING=UTF16 swift test --parallel
6471
- run: YAMS_DEFAULT_ENCODING=UTF8 swift test --parallel
6572
- name: Code Coverage
66-
if: matrix.xcode_version == '15.0'
73+
if: matrix.xcode_version == '15.4'
6774
run: |
6875
swift test --enable-code-coverage
6976
xcrun llvm-cov export -format="lcov" .build/debug/YamsPackageTests.xctest/Contents/MacOS/YamsPackageTests -instr-profile .build/debug/codecov/default.profdata > coverage.lcov
@@ -73,36 +80,30 @@ jobs:
7380
env: { 'CODECOV_TOKEN': '${{ secrets.CODECOV_TOKEN }}' }
7481

7582
Linux:
83+
name: Linux with Swift ${{ matrix.tag }}
7684
strategy:
7785
matrix:
78-
tag: ['5.4', '5.5', '5.6', '5.7', '5.8', '5.9', '5.10']
86+
tag: ['5.7', '5.8', '5.9', '5.10']
7987
runs-on: ubuntu-latest
8088
container:
8189
image: swift:${{ matrix.tag }}
8290
steps:
83-
- uses: actions/checkout@v3
91+
- uses: actions/checkout@v4
8492
- run: YAMS_DEFAULT_ENCODING=UTF16 swift test --parallel
8593
- run: YAMS_DEFAULT_ENCODING=UTF8 swift test --parallel
8694

8795
Windows:
96+
name: Windows with Swift ${{ matrix.swift_version }}
8897
runs-on: windows-latest
89-
9098
strategy:
9199
matrix:
92-
include:
93-
- branch: swift-5.6.3-release
94-
tag: 5.6.3-RELEASE
95-
- branch: swift-5.7.2-release
96-
tag: 5.7.2-RELEASE
97-
- branch: development
98-
tag: DEVELOPMENT-SNAPSHOT-2021-11-20-a
99-
100+
swift_version: ['5.7.3', '5.8.1', '5.9.1', '5.10.1']
100101
steps:
101-
- uses: actions/checkout@v3
102+
- uses: actions/checkout@v4
102103
- uses: compnerd/gha-setup-swift@main
103104
with:
104-
branch: ${{ matrix.branch }}
105-
tag: ${{ matrix.tag }}
105+
branch: swift-${{ matrix.swift_version }}-release
106+
tag: ${{ matrix.swift_version }}-RELEASE
106107
# Commands to run once connected via SSH:
107108
#
108109
# >d:

0 commit comments

Comments
 (0)