-
Notifications
You must be signed in to change notification settings - Fork 128
128 lines (114 loc) · 4.11 KB
/
Copy pathrelease-binary.yml
File metadata and controls
128 lines (114 loc) · 4.11 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
name: Release
on:
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+*" # Push events to matching vX.X.X*, e.g. v0.9.8-beta
env:
LLVM_VERSION: "22.1.6"
jobs:
build:
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}
timeout-minutes: 180
permissions:
contents: write
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-24.04
name: Linux x86_64
artifact: extempore-linux-x86_64
- os: ubuntu-24.04-arm
name: Linux aarch64
artifact: extempore-linux-aarch64
- os: macos-15
name: macOS aarch64
artifact: extempore-macos-aarch64
- os: windows-2022
name: Windows x86_64
artifact: extempore-windows-x86_64
steps:
- uses: actions/checkout@v6
- name: Restore LLVM cache
id: cache-llvm
uses: actions/cache/restore@v5
with:
path: |
build/_deps
build/.ninja_log
build/.ninja_deps
key: ${{ matrix.os }}-llvm-${{ env.LLVM_VERSION }}-v7
- name: Install dependencies (Linux)
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y libasound2-dev xorg-dev libglu1-mesa-dev
- name: Set up MSVC (Windows)
if: runner.os == 'Windows'
uses: TheMrMilchmann/setup-msvc-dev@v4
with:
arch: x64
- name: Configure
# EXT_SHARE_DIR=. so the released binary locates runtime/, libs/, etc.
# relative to CWD instead of the (long-gone) CI worker's source path.
run: cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTS=OFF -DASSETS=ON -DEXT_SHARE_DIR=. -DEXTEMPORE_VERSION=${{ github.ref_name }}
- name: Build LLVM
if: steps.cache-llvm.outputs.cache-hit != 'true'
run: cmake --build build --target llvm-libs
- name: Save LLVM cache
if: steps.cache-llvm.outputs.cache-hit != 'true'
uses: actions/cache/save@v5
with:
path: |
build/_deps
build/.ninja_log
build/.ninja_deps
key: ${{ matrix.os }}-llvm-${{ env.LLVM_VERSION }}-v7
- name: Build
run: cmake --build build --parallel 2
- name: Package (Unix)
if: runner.os != 'Windows'
env:
ARTIFACT: ${{ matrix.artifact }}
REF_NAME: ${{ github.ref_name }}
run: |
set -eu
STAGE="${ARTIFACT}-${REF_NAME}"
mkdir -p "dist/${STAGE}"
cp build/extempore "dist/${STAGE}/"
for d in libs runtime examples assets; do
[ -d "$d" ] && cp -r "$d" "dist/${STAGE}/"
done
for f in README.md BUILDING.md CHANGELOG.md; do
[ -f "$f" ] && cp "$f" "dist/${STAGE}/"
done
(cd dist && zip -r "../build/extempore.zip" "${STAGE}")
- name: Package (Windows)
if: runner.os == 'Windows'
shell: pwsh
env:
ARTIFACT: ${{ matrix.artifact }}
REF_NAME: ${{ github.ref_name }}
run: |
$stage = "$env:ARTIFACT-$env:REF_NAME"
New-Item -ItemType Directory -Force -Path "dist/$stage" | Out-Null
# On Windows extempore.exe is placed at the source-dir root, not build/
Copy-Item extempore.exe "dist/$stage/"
foreach ($d in 'libs','runtime','examples','assets') {
if (Test-Path $d) { Copy-Item -Recurse $d "dist/$stage/" }
}
foreach ($f in 'README.md','BUILDING.md','CHANGELOG.md') {
if (Test-Path $f) { Copy-Item $f "dist/$stage/" }
}
New-Item -ItemType Directory -Force -Path build | Out-Null
Compress-Archive -Path "dist/$stage" -DestinationPath build/extempore.zip
- name: Upload to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: build/extempore.zip
asset_name: ${{ matrix.artifact }}-${{ github.ref_name }}.zip
tag: ${{ github.ref }}
overwrite: true
prerelease: ${{ contains(github.ref_name, '-') }}