-
Notifications
You must be signed in to change notification settings - Fork 86
165 lines (149 loc) · 5.7 KB
/
release.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
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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
name: Release
on:
workflow_dispatch:
release:
types: [published]
env:
SWIFT_VERSION: "6.0.2"
SWIFT_SDK_URL: https://download.swift.org/swift-6.0.2-release/static-sdk/swift-6.0.2-RELEASE/swift-6.0.2-RELEASE_static-linux-0.0.1.artifactbundle.tar.gz
SWIFT_SDK_CHECKSUM: aa5515476a403797223fc2aad4ca0c3bf83995d5427fb297cab1d93c68cee075
jobs:
build:
name: Build for ${{ matrix.destination.name }}
runs-on: ${{ matrix.destination.os }}
strategy:
matrix:
destination:
- { name: "linux-aarch64", os: ubuntu-latest }
- { name: "linux-x86_64", os: ubuntu-latest }
- { name: "macos-universal", os: macos-latest }
steps:
- if: startsWith(matrix.destination.name, 'linux')
uses: vapor/swiftly-action@v0.1
with:
toolchain: ${{ env.SWIFT_VERSION }}
- if: startsWith(matrix.destination.name, 'linux')
name: Install swift sdk
run: swift sdk install ${{ env.SWIFT_SDK_URL }} --checksum ${{ env.SWIFT_SDK_CHECKSUM }}
- if: startsWith(matrix.destination.name, 'macos')
run: sudo xcode-select -s /Applications/Xcode_16.app
- uses: actions/checkout@v4
- name: Create the binary
run: ./install-script.sh -s . -t mockolo -d . -o mockolo.${{ matrix.destination.name }}.tar.gz
- name: Upload the binary
uses: actions/upload-artifact@v4
with:
name: mockolo.${{ matrix.destination.name }}.tar.gz
path: mockolo.${{ matrix.destination.name }}.tar.gz
check-portability:
needs: build
name: TestRun on ${{ matrix.destination.os }} for ${{ matrix.destination.name }}
runs-on: ${{ matrix.destination.os }}
strategy:
fail-fast: false
matrix:
destination:
- { name: "linux-x86_64", os: ubuntu-24.04 }
- { name: "linux-x86_64", os: ubuntu-22.04 }
- { name: "linux-x86_64", os: ubuntu-20.04 }
- { name: "macos-universal", os: macos-14 }
- { name: "macos-universal", os: macos-13 }
steps:
- uses: actions/download-artifact@v4
with:
name: mockolo.${{ matrix.destination.name }}.tar.gz
- name: Unpack the binary
run: tar -xvf mockolo.${{ matrix.destination.name }}.tar.gz
- name: Run the binary
run: ./mockolo --version
check-portability-with-qemu:
needs: build
name: TestRun on ${{ matrix.destination.tag }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
destination:
- { name: "linux-aarch64", tag: "ubuntu:24.04" }
- { name: "linux-aarch64", tag: "ubuntu:22.04" }
- { name: "linux-aarch64", tag: "ubuntu:20.04" }
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- uses: actions/download-artifact@v4
with:
name: mockolo.${{ matrix.destination.name }}.tar.gz
- name: Unpack the binary
run: tar -xvf mockolo.${{ matrix.destination.name }}.tar.gz
- name: Run the binary
run: |
docker run --platform linux/arm64 --rm -v ${{ github.workspace }}:/work -w /work ${{ matrix.destination.tag }} \
./mockolo --version
make-artifact-bundle:
needs: [build]
runs-on: ubuntu-latest
outputs:
checksum: ${{ steps.checksum.outputs.checksum }}
checksum-macos: ${{ steps.checksum-macos.outputs.checksum }}
steps:
- uses: actions/checkout@v4
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
merge-multiple: true
- run: bundle/make_artifactbundle.sh ${{ github.event.release.tag_name || github.ref_name }}
- name: Upload artifact bundle
uses: actions/upload-artifact@v4
with:
name: mockolo.artifactbundle.zip
path: mockolo.artifactbundle.zip
- name: Upload artifact bundle maocs
uses: actions/upload-artifact@v4
with:
name: mockolo-macos.artifactbundle.zip
path: mockolo-macos.artifactbundle.zip
- name: Compute checksum
id: checksum
run: echo "checksum=$(swift package compute-checksum mockolo.artifactbundle.zip)" >> "$GITHUB_OUTPUT"
- name: Compute checksum macos
id: checksum-macos
run: echo "checksum=$(swift package compute-checksum mockolo-macos.artifactbundle.zip)" >> "$GITHUB_OUTPUT"
deploy-binary:
if: ${{ github.event_name == 'release' }}
needs: [check-portability, check-portability-with-qemu, make-artifact-bundle]
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v4
with:
merge-multiple: true
- name: Deploy the binary
uses: softprops/action-gh-release@v2
with:
body: |
----
## For Build Tools Plugin (artifactbundle)
- full version (linux and macos)
```swift
.binaryTarget(
name: "mockolo",
url: "https://github.com/${{ github.repository }}/releases/download/${{ github.event.release.tag_name }}/mockolo.artifactbundle.zip",
checksum: "${{ needs.make-artifact-bundle.outputs.checksum }}"
),
```
- lightweight version (macos only)
```swift
.binaryTarget(
name: "mockolo",
url: "https://github.com/${{ github.repository }}/releases/download/${{ github.event.release.tag_name }}/mockolo-macos.artifactbundle.zip",
checksum: "${{ needs.make-artifact-bundle.outputs.checksum-macos }}"
),
```
append_body: true
files: |
mockolo.linux-x86_64.tar.gz
mockolo.linux-aarch64.tar.gz
mockolo.macos-universal.tar.gz
mockolo.artifactbundle.zip
mockolo-macos.artifactbundle.zip