Skip to content

Commit ac6c75f

Browse files
committed
fix
1 parent 4ee52c9 commit ac6c75f

2 files changed

Lines changed: 179 additions & 2 deletions

File tree

.github/workflows/test.yml

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

tasks/upload.rake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ namespace :vox do
1616
# Ensure the AWS CLI isn't going to fail with the given parameters
1717
run_command("#{s3} ls s3://#{bucket}/")
1818

19-
prepend = File.directory?('/cygdrive/') ? 'C:/cygwin64/' : ''
20-
files = Dir.glob("#{prepend}#{__dir__}/../output/*#{munged_tag}*#{platform}*")
19+
files = Dir.glob("#{__dir__}/../output/*#{munged_tag}*#{platform}*")
2120
abort 'No files for the given tag found in the output directory.' if files.empty?
2221

2322
path = "s3://#{bucket}/#{repo}/#{args[:tag]}"
2423
files.each do |f|
24+
f = `cygpath -m #{f}`.chomp if platform =~ /windows-/
2525
run_command("#{s3} cp #{f} #{path}/#{File.basename(f)}", silent: false)
2626
end
2727
end

0 commit comments

Comments
 (0)