-
Notifications
You must be signed in to change notification settings - Fork 1
111 lines (92 loc) · 3.3 KB
/
swift-ci.yml
File metadata and controls
111 lines (92 loc) · 3.3 KB
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
name: Swift CI
on:
push:
branches:
- master
- main
- "modernize-*"
pull_request:
branches:
- master
- main
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
build-and-test:
# Run on both Linux and macOS so the cross-platform stability claims
# in the README (macOS + Linux) are actually exercised.
strategy:
fail-fast: false
matrix:
os: [ubuntu-24.04, macos-14]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
# --- Swift toolchain -------------------------------------------------
- name: Cache Swift toolchain (Linux)
if: runner.os == 'Linux'
id: cache-swift-linux
uses: actions/cache@v5
with:
path: /opt/swift
key: swift-6.3.1-ubuntu-24.04
- name: Install Swift 6.3.1 (Linux)
if: runner.os == 'Linux' && steps.cache-swift-linux.outputs.cache-hit != 'true'
run: |
set -euo pipefail
cd /tmp
wget -q https://download.swift.org/swift-6.3.1-release/ubuntu2404/swift-6.3.1-RELEASE/swift-6.3.1-RELEASE-ubuntu24.04.tar.gz
sudo mkdir -p /opt/swift
sudo tar -xzf swift-6.3.1-RELEASE-ubuntu24.04.tar.gz \
-C /opt/swift --strip-components=1
- name: Put Swift on PATH (Linux)
if: runner.os == 'Linux'
run: echo "/opt/swift/usr/bin" >> "$GITHUB_PATH"
- name: Cache Swift toolchain (macOS)
if: runner.os == 'macOS'
id: cache-swift-macos
uses: actions/cache@v5
with:
path: /Library/Developer/Toolchains/swift-6.3.1-RELEASE.xctoolchain
key: swift-6.3.1-macos-14
- name: Install Swift 6.3.1 (macOS)
if: runner.os == 'macOS' && steps.cache-swift-macos.outputs.cache-hit != 'true'
run: |
set -euo pipefail
cd /tmp
curl -sSLO https://download.swift.org/swift-6.3.1-release/xcode/swift-6.3.1-RELEASE/swift-6.3.1-RELEASE-osx.pkg
sudo installer -pkg swift-6.3.1-RELEASE-osx.pkg -target /
- name: Put Swift on PATH (macOS)
if: runner.os == 'macOS'
run: echo "/Library/Developer/Toolchains/swift-6.3.1-RELEASE.xctoolchain/usr/bin" >> "$GITHUB_PATH"
- name: Verify Swift toolchain
run: swift --version
# --- System C libraries ----------------------------------------------
- name: Install system dependencies (Linux)
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y \
libgd-dev \
libiptcdata0-dev \
libexif-dev \
libvips-dev \
pkg-config
- name: Install system dependencies (macOS)
if: runner.os == 'macOS'
run: |
brew update
brew install vips libexif libiptcdata pkg-config
# --- Build + test ----------------------------------------------------
- name: Cache Swift build artefacts
uses: actions/cache@v5
with:
path: .build
key: swift-build-${{ runner.os }}-${{ hashFiles('Package.resolved') }}
restore-keys: |
swift-build-${{ runner.os }}-
- name: swift build
run: swift build
- name: swift test
run: swift test