-
-
Notifications
You must be signed in to change notification settings - Fork 51
179 lines (150 loc) · 4.84 KB
/
ci-macos.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
166
167
168
169
170
171
172
173
174
175
176
177
178
name: CI macOS
on:
pull_request:
paths-ignore:
- 'doc/**'
- '**.md'
- '**.rst'
- '**.txt'
release:
types: [published]
workflow_dispatch:
jobs:
build:
name: CI on macOS
strategy:
fail-fast: false
matrix:
os:
- macos-13 # x64
- macos-latest # arm64
runs-on: ${{ matrix.os }}
steps:
- name: Check out repository
uses: actions/checkout@v4
with:
submodules: true
- name: Install FSF toolchain
uses: alire-project/alr-install@v2
with:
crates: gnat_native gprbuild
prefix: alire_prefix
- name: Check toolchain architecture
uses: mosteo-actions/gnat-toolchain-arch-checker@v1
- name: Install Python 3.x (required for the testsuite)
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Run test script
run: scripts/ci-github.sh
shell: bash
env:
BRANCH: ${{ github.base_ref }}
INDEX: ""
# Ascertain whether alr can run without the toolchain that built it
- name: Check standalone alr
uses: mosteo-actions/alr-standalone-checker@v1
with:
alr_path: bin
toolchain_path: alire_prefix
- name: Upload binaries
uses: actions/upload-artifact@v4
with:
name: alr-bin-${{ runner.arch }}-macos.zip
path: |
bin/alr
LICENSE.txt
- name: Upload logs (if failed)
if: failure()
uses: actions/upload-artifact@v4
with:
name: testsuite-log-macos-${{ runner.arch }}.zip
path: testsuite/out
# Release steps start here. These only run during a release creation.
- name: Retrieve upload URL for the release
if: github.event_name == 'release'
id: get_release
uses: bruceadams/get-release@v1.3.2
env:
GITHUB_TOKEN: ${{ github.token }}
- name: Get release version
id: get_version
if: github.event_name == 'release'
uses: battila7/get-version-action@v2
- name: Package release binaries
if: github.event_name == 'release'
run: zip alr-bin-macos.zip bin/alr LICENSE.txt
- name: Select arch name
id: get_arch
if: github.event_name == 'release'
shell: bash
run: |
case ${{ runner.arch }} in
X64) echo "arch=x86_64" >> $GITHUB_OUTPUT ;;
ARM64) echo "arch=aarch64" >> $GITHUB_OUTPUT ;;
*) echo "Unknown architecture, failing..." && exit 1 ;;
esac
- name: Upload release assets
if: github.event_name == 'release'
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.get_release.outputs.upload_url }}
asset_path: alr-bin-macos.zip
asset_name: alr-${{ steps.get_version.outputs.version-without-v }}-bin-${{ steps.get_arch.outputs.arch }}-macos.zip
asset_content_type: application/zip
build-macos-universal:
runs-on: macos-latest
needs: [build]
steps:
- name: Install Python 3.x (required for releaser)
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: download x86_64
uses: robinraju/release-downloader@v1
with:
fileName: '*-x86_64-macos.zip'
latest: true
preRelease: true
out-file-path: 'x86_64'
extract: true
- name: download aarch64
uses: robinraju/release-downloader@v1
with:
latest: true
preRelease: true
fileName: '*-aarch64-macos.zip'
out-file-path: 'aarch64'
extract: true
- name: Create universal binary
run: |
mkdir bin
lipo x86_64/bin/alr aarch64/bin/alr -create -output bin/alr
chmod +x bin/alr
cp aarch64/LICENSE.txt .
zip alr-bin-macos.zip bin/alr LICENSE.txt
# Release steps
# I think I have to run these first two again, because
# the previous uses are in a different job?
- name: Retrieve upload URL for the release
if: github.event_name == 'release'
id: get_release
uses: bruceadams/get-release@v1.3.2
env:
GITHUB_TOKEN: ${{ github.token }}
- name: Get release version
id: get_version
if: github.event_name == 'release'
uses: battila7/get-version-action@v2
- name: Upload release assets
if: github.event_name == 'release'
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.get_release.outputs.upload_url }}
asset_path: alr-bin-macos.zip
asset_name: alr-${{ steps.get_version.outputs.version-without-v }}-bin-universal-macos.zip
asset_content_type: application/zip