test #9
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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/ |