-
Notifications
You must be signed in to change notification settings - Fork 20
177 lines (160 loc) · 7.44 KB
/
test.yml
File metadata and controls
177 lines (160 loc) · 7.44 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
name: test
on:
workflow_dispatch:
inputs:
ref:
description: 'Tag to build'
required: true
type: string
project_name:
description: 'The vanagon project to build'
required: true
type: string
platform_list:
description: 'A comma-separated list of platforms to build for. Do not include spaces. If not provided, will use the default list of platforms supported by OpenVox.'
required: false
type: string
vanagon_branch:
description: 'The branch of the vanagon repository to use'
required: false
type: string
default: 'main'
env:
VANAGON_LOCATION: "https://github.com/openvoxproject/vanagon#${{ inputs.vanagon_branch }}"
jobs:
set-matrix:
runs-on: ubuntu-24.04
outputs:
build_matrix: ${{ steps.set-matrix.outputs.build_matrix }}
steps:
- id: set-matrix
run: |
default_list=(
'windows-all-x64'
)
if [[ -n "${{ inputs.platform_list }}" ]]; then
IFS=',' read -r -a platforms <<< "${{ inputs.platform_list }}"
else
platforms=("${default_list[@]}")
fi
build_platforms=()
for platform in "${platforms[@]}"; do
case "$platform" in
macos-*-x86_64)
runner="macos-latest"
shell="arch -x86_64 /bin/bash -e {0}"
;;
macos-*-arm64)
runner="macos-latest"
shell="bash"
;;
windows-*)
runner="windows-latest"
# igncr is required so that Cygwin doesn't get confused by Windows line endings
shell="C:/cygwin64/bin/bash.exe -eo pipefail -o igncr '{0}'"
;;
*-aarch64 | *-arm64)
runner="ubuntu-24.04-arm"
shell="bash"
;;
*)
runner="ubuntu-24.04"
shell="bash"
;;
esac
build_platforms+=("{\"platform\":\"$platform\",\"runner\":\"$runner\",\"shell\":\"$shell\"}")
done
matrix_json="[$(IFS=','; echo "${build_platforms[*]}")]"
echo "build_matrix=$matrix_json" >> "${GITHUB_OUTPUT}"
build:
needs: set-matrix
timeout-minutes: 600
strategy:
fail-fast: false
matrix:
include: ${{ fromJSON(needs.set-matrix.outputs.build_matrix) }}
runs-on: ${{ matrix.runner }}
defaults:
run:
shell: ${{ matrix.shell }}
steps:
- name: Install Ruby (except Windows and macos-all-x86_64)
if: ${{ matrix.platform != 'macos-all-x86_64' && ! startsWith(matrix.platform, 'windows') }}
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.2'
- name: Setup brew and Ruby (MacOS x86_64 only)
if: ${{ matrix.platform == 'macos-all-x86_64' }}
# We must fully uninstall the existing brew install as we need
# the x86_64 version, and then we must install Ruby ourselves
shell: bash
run: |-
echo '*** Removing existing homebrew installation ***'
brew list --cask | xargs -r brew uninstall --cask --force
brew list --formula | xargs -r brew uninstall --force --ignore-dependencies
brew autoremove
sudo /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh)" -- --force
echo '*** Removing /opt/homebrew directory ***'
sudo rm -rf /opt/homebrew
echo '*** Installing x86_64 homebrew and Ruby ***'
arch -x86_64 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
arch -x86_64 /bin/bash -c 'brew install ruby@3.2'
echo '*** Setting up environment variables ***'
eval "$(/usr/local/bin/brew shellenv)"
echo "HOMEBREW_PREFIX=${HOMEBREW_PREFIX}" >> $GITHUB_ENV
echo "HOMEBREW_CELLAR=${HOMEBREW_CELLAR}" >> $GITHUB_ENV
echo "HOMEBREW_REPOSITORY=${HOMEBREW_REPOSITORY}" >> $GITHUB_ENV
echo "MANPATH=${MANPATH}" >> $GITHUB_ENV
echo "INFOPATH=${INFOPATH}" >> $GITHUB_ENV
echo "${HOMEBREW_PREFIX}/bin" >> $GITHUB_PATH
echo "${HOMEBREW_PREFIX}/sbin" >> $GITHUB_PATH
echo '/usr/local/opt/ruby@3.2/bin' >> $GITHUB_PATH
echo '/usr/local/lib/ruby/gems/3.2.0/bin' >> $GITHUB_PATH
- name: Set git params for Windows
if: ${{ startsWith(matrix.platform, 'windows') }}
shell: pwsh
run: |
# Without this, patch.exe fails due to line ending differences
git config --global core.autocrlf false
git config --global core.eol lf
- name: Checkout code at tag
uses: actions/checkout@v5
with:
ref: ${{ inputs.ref }}
- name: Install Cygwin and bootstrap dependencies (Windows only)
if: ${{ startsWith(matrix.platform, 'windows') }}
shell: pwsh
run: |
$url="https://cygwin.com/setup-x86_64.exe"
$dest="C:\setup-x86_64.exe"
Invoke-WebRequest -Uri $url -OutFile $dest
cmd /c setup.bat
# This is to make sure Cygwin binaries are used over preinstalled items
echo "C:\cygwin64\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
# This is to fix file permissions issues when we check out code outside of Cygwin
echo "none /cygdrive cygdrive binary,noacl,posix=0,user 0 0" | Out-File -FilePath C:\cygwin64\etc\fstab -Encoding ASCII
- name: Bundle install
run: bundle install --retry=3
- name: Download test files
run: |-
mkdir -p output
curl -L https://s3.osuosl.org/openvox-artifacts/puppet-runtime/2025-08-23-1/agent-runtime-main-2025.08.23.1.windows-2019-x64-bill-of-materials -o output/agent-runtime-main-9999.99.99.1.windows-all-x64-bill-of-materials
curl -L https://s3.osuosl.org/openvox-artifacts/puppet-runtime/2025-08-23-1/agent-runtime-main-2025.08.23.1.windows-2019-x64.json -o output/agent-runtime-main-9999.99.99.1.windows-all-x64.json
curl -L https://s3.osuosl.org/openvox-artifacts/puppet-runtime/2025-08-23-1/agent-runtime-main-2025.08.23.1.windows-2019-x64.settings.yaml -o output/agent-runtime-main-9999.99.99.1.windows-all-x64.settings.yaml
curl -L https://s3.osuosl.org/openvox-artifacts/puppet-runtime/2025-08-23-1/agent-runtime-main-2025.08.23.1.windows-2019-x64.tar.gz -o output/agent-runtime-main-9999.99.99.1.windows-all-x64.tar.gz
curl -L https://s3.osuosl.org/openvox-artifacts/puppet-runtime/2025-08-23-1/agent-runtime-main-2025.08.23.1.windows-2019-x64.tar.gz.sha1 -o output/agent-runtime-main-9999.99.99.1.windows-all-x64.tar.gz.sha1
- name: Upload output to S3
env:
ENDPOINT_URL: ${{ secrets.S3_ENDPOINT_URL }}
BUCKET_NAME: ${{ secrets.S3_ARTIFACTS_BUCKET_NAME }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
# https://github.com/boto/boto3/issues/4398#issuecomment-2619946229
AWS_REQUEST_CHECKSUM_CALCULATION: "WHEN_REQUIRED"
AWS_RESPONSE_CHECKSUM_VALIDATION: "WHEN_REQUIRED"
run: bundle exec rake vox:upload['9999-99-99-1','${{ matrix.platform }}']
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: build-artifacts
path: output/