-
Notifications
You must be signed in to change notification settings - Fork 86
151 lines (139 loc) · 4.91 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
name: Release
on:
workflow_dispatch:
release:
types: [published]
env:
SWIFT_VERSION: "5.10"
jobs:
build:
name: Build for ${{ matrix.destination.name }}
runs-on: ${{ matrix.destination.os }}
strategy:
matrix:
destination:
- { name: "ubuntu-x86_64", os: ubuntu-20.04 }
- { name: "macos-universal", os: macos-14 }
container: ${{ matrix.destination.container }}
steps:
- uses: swift-actions/setup-swift@v2
with:
swift-version: ${{ env.SWIFT_VERSION }}
- 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:
path: mockolo.${{ matrix.destination.name }}.tar.gz
name: mockolo.${{ matrix.destination.name }}
build-with-qemu:
name: Build for ${{ matrix.destination.name }}
runs-on: ubuntu-latest
strategy:
matrix:
destination:
- { name: "ubuntu-aarch64" }
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- uses: actions/checkout@v4
- name: Create the binary
run: |
docker run --platform linux/arm64 --rm -v ${{ github.workspace }}:/work -w /work swift:${{ env.SWIFT_VERSION }}-focal \
./install-script.sh -s . -t mockolo -d /work -o mockolo.${{ matrix.destination.name }}.tar.gz
- name: Upload the binary
uses: actions/upload-artifact@v4
with:
path: mockolo.${{ matrix.destination.name }}.tar.gz
name: mockolo.${{ matrix.destination.name }}
check-portability:
needs: build
name: TestRun on ${{ matrix.destination.os }} for ${{ matrix.destination.name }}
runs-on: ${{ matrix.destination.os }}
strategy:
matrix:
destination:
- { name: "ubuntu-x86_64", os: ubuntu-22.04 }
- { name: "ubuntu-x86_64", os: ubuntu-20.04 }
- { name: "macos-universal", os: macos-14 }
- { name: "macos-universal", os: macos-13 }
- { name: "macos-universal", os: macos-12 }
steps:
- uses: actions/download-artifact@v4
with:
name: mockolo.${{ matrix.destination.name }}
- 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-with-qemu
name: TestRun on ${{ matrix.destination.tag }}
runs-on: ubuntu-latest
strategy:
matrix:
destination:
- { name: "ubuntu-aarch64", tag: "ubuntu:20.04" }
- { name: "ubuntu-aarch64", tag: "ubuntu:22.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 }}
- 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, build-with-qemu]
runs-on: ubuntu-latest
outputs:
checksum: ${{ steps.checksum.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: Compute checksum
id: checksum
run: echo "checksum=$(swift package compute-checksum mockolo.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: |
```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 }}"
),
```
append_body: true
files: |
mockolo.ubuntu-x86_64.tar.gz
mockolo.ubuntu-aarch64.tar.gz
mockolo.macos-universal.tar.gz
mockolo.artifactbundle.zip