-
Notifications
You must be signed in to change notification settings - Fork 1
184 lines (159 loc) · 5.61 KB
/
macos-arm64.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
179
180
181
182
183
184
name: macos-arm64
on:
schedule:
- cron: "0 2 * * 2"
push:
branches: [ main ]
tags: [ v* ]
paths-ignore:
- .github/workflows/ubuntu.yml
- .github/workflows/windows.yml
- .github/workflows/alpine.yml
- .github/workflows/macos-x86_64.yml
- .github/workflows/release_tag.yml
- .cirrus.*
- Makefile.win
pull_request:
paths-ignore:
- .github/workflows/ubuntu.yml
- .github/workflows/windows.yml
- .github/workflows/alpine.yml
- .github/workflows/macos-x86_64.yml
- .github/workflows/release_tag.yml
- .cirrus.*
- Makefile.win
workflow_dispatch:
concurrency:
group: '${{ github.workflow }}-${{ github.job }}-${{ github.head_ref || github.ref_name }}'
cancel-in-progress: true
jobs:
# https://wildwolf.name/github-actions-how-to-avoid-running-the-same-workflow-multiple-times/
prepare:
runs-on: ubuntu-latest
outputs:
head_tag: ${{ steps.check.outputs.head_tag }}
foreign_pr: ${{ steps.check.outputs.foreign_pr }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Retrieve tags
run: git fetch --depth=1 origin +refs/tags/*:refs/tags/* || true
- name: Set output variables
id: check
run: |
fpr="no"
tag=""
if [[ "${{ github.ref }}" == refs/heads/* ]]; then
tag="$(git tag --points-at HEAD)"
elif [[ "${{ github.ref }}" == refs/pull/* ]] && [ "${{ github.event.pull_request.head.repo.full_name }}" != "${{ github.event.pull_request.base.repo.full_name }}" ]; then
fpr="yes"
fi
echo "foreign_pr=${fpr}" >> $GITHUB_OUTPUT
echo "head_tag=${tag}" >> $GITHUB_OUTPUT
build:
runs-on: macos-14
needs: prepare
if: "(github.event_name == 'push' && needs.prepare.outputs.head_tag == '') || github.event_name == 'pull_request' || github.event_name == 'schedule'"
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup environment
run: cat common.env >> $GITHUB_ENV
- name: Setup Tebako
uses: tamatebako/tebako/.github/actions/setup-tebako@main
with:
cache: build
cache_ver: ${{ env.CACHE_VER }}
cache_path: ${{ env.TEBAKO_PREFIX }}
ruby_version: ${{ env.RUBY_VER }}
bundler_version: ${{ env.BUNDLER_VER }}
- name: package metanorma
run: make build/bin/metanorma-darwin-arm64
- uses: actions/upload-artifact@v4
with:
name: metanorma-darwin-arm64
path: build/bin/metanorma-darwin-arm64
- name: Verify packaging
run: |
build/bin/metanorma-darwin-arm64 --tebako-extract extracted_source_filesystem
diff -r extracted_source_filesystem ${{ env.TEBAKO_PREFIX }}/o/s
- name: Smoke test
run: build/bin/metanorma-darwin-arm64 help
build-matrix:
uses: metanorma/ci/.github/workflows/build-sample-matrix.yml@main
with:
smoke: false
flavors-only: true
public-only: true
test:
needs: [build, build-matrix]
runs-on: macos-14
continue-on-error: ${{ matrix.flavor.experimental }}
strategy:
max-parallel: 5
fail-fast: false
matrix: ${{ fromJson(needs.build-matrix.outputs.samples-matrix) }}
steps:
- uses: actions/checkout@v4
- run: rm Gemfile
- if: matrix.flavor.id == 'ietf'
uses: metanorma/ci/xml2rfc-setup-action@main
- uses: actions/download-artifact@v4
with:
name: metanorma-darwin-arm64
path: build/bin
- run: chmod a+x build/bin/metanorma-darwin-arm64
- uses: actions/cache@v4
with:
path: ~/.relaton
key: relaton-macos-${{ matrix.flavor.id }}
restore-keys: relaton-macos-${{ matrix.flavor.id }}
- name: Fetch samples (${{ matrix.flavor.id }})
uses: actions/checkout@v4
with:
submodules: recursive
repository: metanorma/mn-samples-${{ matrix.flavor.id }}
token: ${{ secrets.METANORMA_CI_PAT_TOKEN }}
path: ${{ github.workspace }}/samples
fetch-depth: 1
- name: Test (${{ matrix.flavor.id }})
timeout-minutes: 120
run: |
build/bin/metanorma-darwin-arm64 \
site generate samples \
-c samples/metanorma.yml \
-o site-${{ matrix.flavor.id }} \
--agree-to-terms
- uses: actions/upload-artifact@v4
with:
name: site-${{ matrix.flavor.id }}
path: site-${{ matrix.flavor.id }}
release:
if: startsWith(github.ref, 'refs/tags/')
runs-on: macos-14
needs: test
steps:
- uses: actions/download-artifact@v4
with:
name: metanorma-darwin-arm64
path: build/bin
- name: Package binary into archive
run: |
chmod a+x build/bin/metanorma-darwin-arm64
cp build/bin/metanorma-darwin-arm64 metanorma-darwin-arm64
tar -czvf metanorma-darwin-arm64.tgz metanorma-darwin-arm64
- name: Calculate SHA256 hash
run: |
brew install coreutils
sha256sum metanorma-darwin-arm64.tgz | cut -d ' ' -f1 > metanorma-darwin-arm64.tgz.sha256.txt
- uses: softprops/action-gh-release@v1
with:
files: |
metanorma-darwin-arm64.tgz
metanorma-darwin-arm64.tgz.sha256.txt
- uses: peter-evans/repository-dispatch@v2
with:
token: ${{ secrets.METANORMA_CI_PAT_TOKEN }}
repository: metanorma/homebrew-metanorma
event-type: ${{ github.repository }}
client-payload: '{ "ref": "${{ github.ref }}" }'