forked from moq-dev/moq
-
Notifications
You must be signed in to change notification settings - Fork 0
212 lines (184 loc) · 7.01 KB
/
Copy pathlibmoq.yml
File metadata and controls
212 lines (184 loc) · 7.01 KB
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
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
name: libmoq
on:
push:
tags:
- "libmoq-v*"
permissions:
contents: read
jobs:
build:
name: Build (${{ matrix.target }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
use_nix: true
- target: aarch64-unknown-linux-gnu
os: ubuntu-24.04-arm
use_nix: true
# Both Apple targets build on the Apple Silicon runner: the
# Determinate Nix installer dropped Intel macOS, so x86_64 is
# cross-compiled (Apple clang is multi-arch). libmoq.a needs no
# execution, so no Rosetta. See rs/libmoq/build.sh.
- target: x86_64-apple-darwin
os: macos-latest
use_nix: true
- target: aarch64-apple-darwin
os: macos-latest
use_nix: true
- target: x86_64-pc-windows-msvc
os: windows-latest
use_nix: false
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
fetch-depth: 0
persist-credentials: false
- name: Install Nix
if: matrix.use_nix
uses: DeterminateSystems/nix-installer-action@1d87d45818068401a10cf16bdc5f00b24994a83f # main
with:
determinate: false
- name: Install Rust (Windows)
if: '!matrix.use_nix'
uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable
with:
targets: ${{ matrix.target }}
- name: Parse version
id: parse
shell: bash
run: .github/scripts/release.sh parse-version libmoq
- name: Build and package
shell: bash
run: |
./rs/libmoq/build.sh \
--target ${{ matrix.target }} \
--version ${{ steps.parse.outputs.version }} \
--output dist
- name: Upload artifact
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: libmoq-${{ matrix.target }}
path: dist/*
release:
name: Release
needs: build
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
fetch-depth: 0
persist-credentials: false
- name: Parse version
id: parse
run: .github/scripts/release.sh parse-version libmoq
- name: Find previous tag
id: prev_tag
run: .github/scripts/release.sh prev-tag libmoq
- name: Download artifacts
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
with:
path: artifacts
merge-multiple: true
- name: Create or update release
env:
GH_TOKEN: ${{ github.token }}
RELEASE_TAG: ${{ github.ref_name }}
RELEASE_TITLE: "libmoq v${{ steps.parse.outputs.version }}"
RELEASE_PREV_TAG: ${{ steps.prev_tag.outputs.tag }}
run: .github/scripts/release.sh create artifacts
# The OBS plugin (cpp/obs) statically links libmoq, so it ships with every
# libmoq release: rebuild it against the release we just published (no
# second cargo build, guaranteed-matching ABI) and cut a parallel
# obs-moq-v<version> release. Runs after `release` so the libmoq archives
# the plugin's CMake fetches are already live.
obs-build:
name: OBS plugin (${{ matrix.target }})
needs: release
runs-on: ${{ matrix.os }}
# macOS + Windows only. These link the ffmpeg the obs-deps bundle ships
# (the same one OBS uses), so the binaries are portable. A Linux build
# would link nix/distro ffmpeg and not be portable, so Linux is
# build-from-source (see doc/bin/obs.md) and ships no prebuilt binary.
strategy:
fail-fast: false
matrix:
include:
- target: aarch64-apple-darwin
os: macos-latest
- target: x86_64-pc-windows-msvc
os: windows-latest
steps:
# Shallow: this job only compiles, it never reads git history or tags.
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
persist-credentials: false
- name: Parse version
id: parse
shell: bash
run: .github/scripts/release.sh parse-version libmoq
# Native Xcode / Visual Studio; libobs/Qt6/ffmpeg come from the obs-deps
# bundle and libmoq from the release we just published (--libmoq-release).
- name: Build and package
shell: bash
env:
TARGET: ${{ matrix.target }}
VERSION: ${{ steps.parse.outputs.version }}
run: |
./cpp/obs/build.sh --target "$TARGET" --libmoq-release "$VERSION" --output dist
- name: Upload artifact
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: obs-moq-${{ matrix.target }}
path: dist/*
obs-release:
name: OBS plugin release
needs: obs-build
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
fetch-depth: 0
persist-credentials: false
- name: Parse version
id: parse
run: .github/scripts/release.sh parse-version libmoq
# Only the obs-moq archives: the libmoq-* artifacts from the build job
# belong to the libmoq release, not this one.
- name: Download artifacts
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
with:
path: artifacts
pattern: obs-moq-*
merge-multiple: true
# release.sh prev-tag keys off the current tag, but the trigger here is a
# libmoq-v* tag, so it can't find the previous obs-moq tag. Take the
# newest existing obs-moq tag (excluding this version, for safe re-runs)
# so the release notes span only since the last obs-moq release.
- name: Find previous obs-moq tag
id: prev_tag
env:
VERSION: ${{ steps.parse.outputs.version }}
run: |
cur="obs-moq-v${VERSION}"
# awk (not grep -vx | head) so an empty result is exit 0, not 1:
# under `set -eo pipefail` the inaugural release has no prior tag and
# grep's exit 1 would fail the step. Empty tag is fine downstream.
prev=$(git tag --list 'obs-moq-v*' --sort=-v:refname | awk -v cur="$cur" '$0 != cur { print; exit }')
echo "tag=${prev}" >>"$GITHUB_OUTPUT"
# Cut a parallel obs-moq-v<version> release at this commit (gh creates
# the tag).
- name: Create or update release
env:
GH_TOKEN: ${{ github.token }}
RELEASE_TAG: "obs-moq-v${{ steps.parse.outputs.version }}"
RELEASE_TITLE: "obs-moq v${{ steps.parse.outputs.version }}"
RELEASE_PREV_TAG: ${{ steps.prev_tag.outputs.tag }}
run: .github/scripts/release.sh create artifacts