-
Notifications
You must be signed in to change notification settings - Fork 0
69 lines (60 loc) · 1.84 KB
/
Copy pathspm-linux.yml
File metadata and controls
69 lines (60 loc) · 1.84 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
name: Linux
on:
workflow_call:
env:
RUN_TESTS: true
jobs:
SPM-Linux:
name: Linux Swift ${{ matrix.swift_version }} [${{ matrix.build_config }}]
timeout-minutes: 30
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
swift_version: # https://hub.docker.com/_/swift/tags
- "6.0.3"
- "5.10.1"
build_config:
- debug
- release
container:
image: swift:${{ matrix.swift_version }}
steps:
- uses: actions/checkout@v4
- name: Cache SPM dependencies
uses: actions/cache@v4
with:
path: |
~/.cache/org.swift.swiftpm
.build/artifacts
.build/checkouts
.build/repositories
key: ${{ runner.os }}-spm-${{ hashFiles('Package.resolved') }}
restore-keys: |
${{ runner.os }}-spm-
- name: Prepare
run: |
if [ ! -x "$(command -v jq)" ]; then
apt update -qy
apt install jq -qy
fi
TARGET_TYPES=$(swift package describe --type json | jq '.targets[].type')
HAS_TESTS=$(echo $TARGET_TYPES | grep -q "test" && echo true || echo false)
echo "Package has tests: $HAS_TESTS"
echo "RUN_TESTS=$HAS_TESTS" >> $GITHUB_ENV
- name: Build
run: |
swift build -c ${{ matrix.build_config }}
- name: Test
if: env.RUN_TESTS == 'true'
run: |
swift test -c ${{ matrix.build_config }}
- name: Upload failure artifacts
if: failure()
uses: actions/upload-artifact@v4
with:
name: ${{ runner.os }}-${{ github.job }}-swift_${{ matrix.swift_version }}-${{ matrix.build_config }}-${{ github.run_id }}
path: |
.build
if-no-files-found: warn
include-hidden-files: true