Skip to content

Commit e951ad2

Browse files
committed
add ci-build
1 parent 447ac7c commit e951ad2

File tree

1 file changed

+103
-0
lines changed

1 file changed

+103
-0
lines changed

.github/workflows/ci-build.yml

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
name: CI-BUILD
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- '*'
10+
workflow_dispatch:
11+
12+
concurrency:
13+
group: ci-${{ github.ref }}
14+
cancel-in-progress: true
15+
16+
jobs:
17+
xcodebuild:
18+
name: xcodebuild
19+
runs-on: macos-14
20+
strategy:
21+
matrix:
22+
command: [test, '']
23+
platform: [iOS, macOS, tvOS, watchOS, visionOS, macCatalyst]
24+
xcode: [15.4, '16.0']
25+
steps:
26+
- uses: actions/checkout@v4
27+
- name: Select Xcode ${{ matrix.xcode }}
28+
run: sudo xcode-select -s /Applications/Xcode_${{ matrix.xcode }}.app
29+
- name: Cache derived data
30+
uses: actions/cache@v3
31+
with:
32+
path: |
33+
~/.derivedData
34+
key: |
35+
deriveddata-xcodebuild-${{ matrix.platform }}-${{ matrix.xcode }}-${{ matrix.command }}-${{ hashFiles('**/Sources/**/*.swift', '**/Tests/**/*.swift') }}
36+
restore-keys: |
37+
deriveddata-xcodebuild-${{ matrix.platform }}-${{ matrix.xcode }}-${{ matrix.command }}-
38+
- name: Set IgnoreFileSystemDeviceInodeChanges flag
39+
run: defaults write com.apple.dt.XCBuild IgnoreFileSystemDeviceInodeChanges -bool YES
40+
- name: Update mtime for incremental builds
41+
uses: chetan/git-restore-mtime-action@v2
42+
- name: Debug
43+
run: make COMMAND="${{ matrix.command }}" CONFIG=Debug PLATFORM="${{ matrix.platform }}" xcodebuild
44+
- name: Release
45+
if: matrix.skip_release != '1'
46+
run: make COMMAND="${{ matrix.command }}" CONFIG=Release PLATFORM="${{ matrix.platform }}" xcodebuild
47+
48+
linux:
49+
runs-on: ubuntu-latest
50+
container: swift:latest
51+
steps:
52+
- uses: actions/checkout@v4
53+
- name: Cache build
54+
uses: actions/cache@v3
55+
with:
56+
path: |
57+
.build
58+
key: |
59+
build-spm-linux-${{ matrix.swift-verion }}-${{ hashFiles('**/Sources/**/*.swift', '**/Tests/**/*.swift', '**/Package.resolved') }}
60+
restore-keys: |
61+
build-spm-linux-${{ matrix.swift-verion }}-
62+
- run: make dot-env
63+
- run: swift build --build-tests
64+
- run: swift test --skip-build --enable-swift-testing --parallel
65+
66+
67+
68+
# library-evolution:
69+
# name: Library (evolution)
70+
# runs-on: macos-14
71+
# steps:
72+
# - uses: actions/checkout@v4
73+
# - name: Select Xcode 15.4
74+
# run: sudo xcode-select -s /Applications/Xcode_15.4.app
75+
# - name: Build for library evolution
76+
# run: make build-for-library-evolution
77+
78+
examples:
79+
name: Examples
80+
runs-on: macos-14
81+
steps:
82+
- uses: actions/checkout@v4
83+
- name: Cache derived data
84+
uses: actions/cache@v3
85+
with:
86+
path: ~/.derivedData
87+
key: |
88+
deriveddata-examples-${{ hashFiles('**/Sources/**/*.swift', '**/Tests/**/*.swift', '**/Examples/**/*.swift') }}
89+
restore-keys: |
90+
deriveddata-examples-
91+
- name: Select Xcode 16
92+
run: sudo xcode-select -s /Applications/Xcode_16.app
93+
- name: Set IgnoreFileSystemDeviceInodeChanges flag
94+
run: defaults write com.apple.dt.XCBuild IgnoreFileSystemDeviceInodeChanges -bool YES
95+
- name: Update mtime for incremental builds
96+
uses: chetan/git-restore-mtime-action@v2
97+
- name: Examples
98+
run: make SCHEME="Examples" build-example
99+
- name: SlackClone
100+
run: make SCHEME="SlackClone" build-example
101+
- name: UserManagement
102+
run: make SCHEME="UserManagement" build-example
103+

0 commit comments

Comments
 (0)