-
Notifications
You must be signed in to change notification settings - Fork 0
186 lines (151 loc) · 6.06 KB
/
Copy pathci.yml
File metadata and controls
186 lines (151 loc) · 6.06 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
# SPDX-License-Identifier: GPL-3.0-or-later
name: CI
on:
push:
branches: [main]
tags: ['v*']
pull_request:
branches: [main]
jobs:
build:
name: build + test + package
# Branches and PRs only; tag pushes are handled by the release job below.
if: github.event_name == 'pull_request' || startsWith(github.ref, 'refs/heads/')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install build dependencies
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
cmake g++ pkg-config libasound2-dev liblo-dev lintian file
- name: Configure
run: cmake -B build -DCMAKE_BUILD_TYPE=Release
- name: Build
run: cmake --build build --parallel
- name: Test
run: ctest --test-dir build --output-on-failure
- name: Package (.deb + .tar.gz)
run: cmake --build build --target package # runs CPack (TGZ;DEB)
- name: Lint the .deb
run: lintian --fail-on error,warning build/command8-*-Linux.deb
- name: Upload packages
uses: actions/upload-artifact@v4
with:
name: command8-packages
path: |
build/command8-*-Linux.deb
build/command8-*-Linux.tar.gz
if-no-files-found: error
build-windows:
name: build + test + package (windows)
if: github.event_name == 'pull_request' || startsWith(github.ref, 'refs/heads/')
runs-on: windows-latest
env:
# Cache vcpkg's built packages (rtmidi/liblo static) in the Actions cache.
VCPKG_BINARY_SOURCES: 'clear;x-gha,readwrite'
steps:
- uses: actions/checkout@v4
- name: Export Actions cache env for vcpkg
uses: actions/github-script@v7
with:
script: |
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
# The runner's vcpkg clone may predate our builtin-baseline; fetch it.
- name: Fetch vcpkg baseline commit
run: >
git -C "$env:VCPKG_INSTALLATION_ROOT" fetch origin
(Get-Content vcpkg.json | ConvertFrom-Json).'builtin-baseline'
# Default (Visual Studio) generator: no vcvars needed; static triplet ->
# self-contained exes, matching the shipped zip.
- name: Configure
run: >
cmake -B build
-DCMAKE_TOOLCHAIN_FILE="$env:VCPKG_INSTALLATION_ROOT/scripts/buildsystems/vcpkg.cmake"
-DVCPKG_TARGET_TRIPLET=x64-windows-static
- name: Build
run: cmake --build build --config Release --parallel
- name: Test
run: ctest --test-dir build --build-config Release --output-on-failure
- name: Package (.zip)
run: cd build; cpack -C Release
- name: Upload package
uses: actions/upload-artifact@v4
with:
name: command8-windows-package
path: build/command8-*-win64.zip
if-no-files-found: error
release:
name: release on tag
# Runs only for pushed v* tags; builds with the version taken from the tag.
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
permissions:
contents: write # to create the GitHub Release
steps:
- uses: actions/checkout@v4
- name: Install build dependencies
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
cmake g++ pkg-config libasound2-dev liblo-dev lintian file
- name: Derive version from tag
run: echo "VERSION=${GITHUB_REF_NAME#v}" >> "$GITHUB_ENV" # v1.2.3 -> 1.2.3
- name: Configure
run: cmake -B build -DCMAKE_BUILD_TYPE=Release -DCOMMAND8_VERSION="$VERSION"
- name: Build
run: cmake --build build --parallel
- name: Test
run: ctest --test-dir build --output-on-failure
- name: Package (.deb + .tar.gz)
run: cmake --build build --target package
- name: Lint the .deb
run: lintian --fail-on error,warning build/command8-*-Linux.deb
- name: Create GitHub Release
env:
GH_TOKEN: ${{ github.token }}
run: |
gh release create "$GITHUB_REF_NAME" \
build/command8-*-Linux.deb build/command8-*-Linux.tar.gz \
--title "$GITHUB_REF_NAME" --generate-notes
release-windows:
name: attach windows zip to release
if: startsWith(github.ref, 'refs/tags/v')
needs: release # the release must exist before uploading to it
runs-on: windows-latest
permissions:
contents: write
env:
VCPKG_BINARY_SOURCES: 'clear;x-gha,readwrite'
steps:
- uses: actions/checkout@v4
- name: Export Actions cache env for vcpkg
uses: actions/github-script@v7
with:
script: |
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
- name: Derive version from tag
run: echo "VERSION=$($env:GITHUB_REF_NAME -replace '^v','')" >> $env:GITHUB_ENV
# The runner's vcpkg clone may predate our builtin-baseline; fetch it.
- name: Fetch vcpkg baseline commit
run: >
git -C "$env:VCPKG_INSTALLATION_ROOT" fetch origin
(Get-Content vcpkg.json | ConvertFrom-Json).'builtin-baseline'
- name: Configure
run: >
cmake -B build
-DCMAKE_TOOLCHAIN_FILE="$env:VCPKG_INSTALLATION_ROOT/scripts/buildsystems/vcpkg.cmake"
-DVCPKG_TARGET_TRIPLET=x64-windows-static
-DCOMMAND8_VERSION="$env:VERSION"
- name: Build
run: cmake --build build --config Release --parallel
- name: Test
run: ctest --test-dir build --build-config Release --output-on-failure
- name: Package (.zip)
run: cd build; cpack -C Release
- name: Upload to the release
env:
GH_TOKEN: ${{ github.token }}
run: gh release upload "$env:GITHUB_REF_NAME" (Get-Item build/command8-*-win64.zip)