Skip to content

Commit 22e58ab

Browse files
committed
fix
1 parent 4ee52c9 commit 22e58ab

2 files changed

Lines changed: 206 additions & 0 deletions

File tree

.github/workflows/test.yml

Lines changed: 204 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,204 @@
1+
name: test
2+
3+
on:
4+
push:
5+
workflow_dispatch:
6+
inputs:
7+
ref:
8+
description: 'Tag to build'
9+
required: true
10+
type: string
11+
project_name:
12+
description: 'The vanagon project to build'
13+
required: true
14+
type: string
15+
platform_list:
16+
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.'
17+
required: false
18+
type: string
19+
vanagon_branch:
20+
description: 'The branch of the vanagon repository to use'
21+
required: false
22+
type: string
23+
default: 'main'
24+
25+
env:
26+
VANAGON_LOCATION: "https://github.com/openvoxproject/vanagon#${{ inputs.vanagon_branch }}"
27+
28+
jobs:
29+
set-matrix:
30+
runs-on: ubuntu-24.04
31+
outputs:
32+
build_matrix: ${{ steps.set-matrix.outputs.build_matrix }}
33+
steps:
34+
- id: set-matrix
35+
run: |
36+
default_list=(
37+
'amazon-2-aarch64'
38+
'amazon-2-x86_64'
39+
'amazon-2023-aarch64'
40+
'amazon-2023-x86_64'
41+
'debian-11-aarch64'
42+
'debian-11-amd64'
43+
'debian-12-aarch64'
44+
'debian-12-amd64'
45+
'debian-13-aarch64'
46+
'debian-13-amd64'
47+
'el-7-x86_64'
48+
'el-8-aarch64'
49+
'el-8-x86_64'
50+
'el-9-aarch64'
51+
'el-9-x86_64'
52+
'el-10-x86_64'
53+
'el-10-aarch64'
54+
'fedora-41-x86_64'
55+
'fedora-41-aarch64'
56+
'fedora-42-x86_64'
57+
'fedora-42-aarch64'
58+
'fedora-43-x86_64'
59+
'fedora-43-aarch64'
60+
'macos-all-arm64'
61+
'macos-all-x86_64'
62+
'sles-15-x86_64'
63+
'ubuntu-22.04-aarch64'
64+
'ubuntu-22.04-amd64'
65+
'ubuntu-24.04-aarch64'
66+
'ubuntu-24.04-amd64'
67+
'ubuntu-25.04-amd64'
68+
'ubuntu-25.04-aarch64'
69+
'windows-all-x64'
70+
)
71+
if [[ -n "${{ inputs.platform_list }}" ]]; then
72+
IFS=',' read -r -a platforms <<< "${{ inputs.platform_list }}"
73+
else
74+
platforms=("${default_list[@]}")
75+
fi
76+
77+
build_platforms=()
78+
for platform in "${platforms[@]}"; do
79+
case "$platform" in
80+
macos-*-x86_64)
81+
runner="macos-latest"
82+
shell="arch -x86_64 /bin/bash -e {0}"
83+
;;
84+
macos-*-arm64)
85+
runner="macos-latest"
86+
shell="bash"
87+
;;
88+
windows-*)
89+
runner="windows-latest"
90+
# igncr is required so that Cygwin doesn't get confused by Windows line endings
91+
shell="C:/cygwin64/bin/bash.exe -eo pipefail -o igncr '{0}'"
92+
;;
93+
*-aarch64 | *-arm64)
94+
runner="ubuntu-24.04-arm"
95+
shell="bash"
96+
;;
97+
*)
98+
runner="ubuntu-24.04"
99+
shell="bash"
100+
;;
101+
esac
102+
build_platforms+=("{\"platform\":\"$platform\",\"runner\":\"$runner\",\"shell\":\"$shell\"}")
103+
done
104+
matrix_json="[$(IFS=','; echo "${build_platforms[*]}")]"
105+
echo "build_matrix=$matrix_json" >> "${GITHUB_OUTPUT}"
106+
107+
build:
108+
needs: set-matrix
109+
timeout-minutes: 600
110+
strategy:
111+
fail-fast: false
112+
matrix:
113+
include: ${{ fromJSON(needs.set-matrix.outputs.build_matrix) }}
114+
runs-on: ${{ matrix.runner }}
115+
defaults:
116+
run:
117+
shell: ${{ matrix.shell }}
118+
119+
steps:
120+
- name: Install Ruby (except Windows and macos-all-x86_64)
121+
if: ${{ matrix.platform != 'macos-all-x86_64' && ! startsWith(matrix.platform, 'windows') }}
122+
uses: ruby/setup-ruby@v1
123+
with:
124+
ruby-version: '3.2'
125+
126+
- name: Setup brew and Ruby (MacOS x86_64 only)
127+
if: ${{ matrix.platform == 'macos-all-x86_64' }}
128+
# We must fully uninstall the existing brew install as we need
129+
# the x86_64 version, and then we must install Ruby ourselves
130+
shell: bash
131+
run: |-
132+
echo '*** Removing existing homebrew installation ***'
133+
brew list --cask | xargs -r brew uninstall --cask --force
134+
brew list --formula | xargs -r brew uninstall --force --ignore-dependencies
135+
brew autoremove
136+
sudo /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh)" -- --force
137+
138+
echo '*** Removing /opt/homebrew directory ***'
139+
sudo rm -rf /opt/homebrew
140+
141+
echo '*** Installing x86_64 homebrew and Ruby ***'
142+
arch -x86_64 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
143+
arch -x86_64 /bin/bash -c 'brew install ruby@3.2'
144+
145+
echo '*** Setting up environment variables ***'
146+
eval "$(/usr/local/bin/brew shellenv)"
147+
echo "HOMEBREW_PREFIX=${HOMEBREW_PREFIX}" >> $GITHUB_ENV
148+
echo "HOMEBREW_CELLAR=${HOMEBREW_CELLAR}" >> $GITHUB_ENV
149+
echo "HOMEBREW_REPOSITORY=${HOMEBREW_REPOSITORY}" >> $GITHUB_ENV
150+
echo "MANPATH=${MANPATH}" >> $GITHUB_ENV
151+
echo "INFOPATH=${INFOPATH}" >> $GITHUB_ENV
152+
echo "${HOMEBREW_PREFIX}/bin" >> $GITHUB_PATH
153+
echo "${HOMEBREW_PREFIX}/sbin" >> $GITHUB_PATH
154+
echo '/usr/local/opt/ruby@3.2/bin' >> $GITHUB_PATH
155+
echo '/usr/local/lib/ruby/gems/3.2.0/bin' >> $GITHUB_PATH
156+
157+
- name: Set git params for Windows
158+
if: ${{ startsWith(matrix.platform, 'windows') }}
159+
shell: pwsh
160+
run: |
161+
# Without this, patch.exe fails due to line ending differences
162+
git config --global core.autocrlf false
163+
git config --global core.eol lf
164+
165+
- name: Checkout code at tag
166+
uses: actions/checkout@v5
167+
with:
168+
ref: ${{ inputs.ref }}
169+
170+
- name: Install Cygwin and bootstrap dependencies (Windows only)
171+
if: ${{ startsWith(matrix.platform, 'windows') }}
172+
shell: pwsh
173+
run: |
174+
$url="https://cygwin.com/setup-x86_64.exe"
175+
$dest="C:\setup-x86_64.exe"
176+
Invoke-WebRequest -Uri $url -OutFile $dest
177+
cmd /c setup.bat
178+
# This is to make sure Cygwin binaries are used over preinstalled items
179+
echo "C:\cygwin64\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
180+
# This is to fix file permissions issues when we check out code outside of Cygwin
181+
echo "none /cygdrive cygdrive binary,noacl,posix=0,user 0 0" | Out-File -FilePath C:\cygwin64\etc\fstab -Encoding ASCII
182+
183+
- name: Bundle install
184+
run: bundle install --retry=3
185+
186+
- name: Download test files
187+
run: |-
188+
mkdir -p output
189+
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
190+
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
191+
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
192+
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
193+
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
194+
195+
- name: Upload output to S3
196+
env:
197+
ENDPOINT_URL: ${{ secrets.S3_ENDPOINT_URL }}
198+
BUCKET_NAME: ${{ secrets.S3_ARTIFACTS_BUCKET_NAME }}
199+
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
200+
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
201+
# https://github.com/boto/boto3/issues/4398#issuecomment-2619946229
202+
AWS_REQUEST_CHECKSUM_CALCULATION: "WHEN_REQUIRED"
203+
AWS_RESPONSE_CHECKSUM_VALIDATION: "WHEN_REQUIRED"
204+
run: bundle exec rake vox:upload['${{ inputs.ref }}','${{ matrix.platform }}']

tasks/upload.rake

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ namespace :vox do
1717
run_command("#{s3} ls s3://#{bucket}/")
1818

1919
prepend = File.directory?('/cygdrive/') ? 'C:/cygwin64/' : ''
20+
puts "#{prepend}#{__dir__}/../output/*#{munged_tag}*#{platform}*"
21+
run_command("ls #{prepend}#{__dir__}/../output/")
2022
files = Dir.glob("#{prepend}#{__dir__}/../output/*#{munged_tag}*#{platform}*")
2123
abort 'No files for the given tag found in the output directory.' if files.empty?
2224

0 commit comments

Comments
 (0)