Release - Swift Toolchain Binary Sizes #2129
Workflow file for this run
This file contains 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
# Uploads a toolchain release's binary size metrics to DataDog. | |
# | |
# To target a specific Swift Toolchain Release, run: | |
# | |
# $TOOLCHAIN_VERSION="..." | |
# gh workflow run "Release - Swift Toolchain Binary Sizes" ` | |
# -f toolchain_version=${TOOLCHAIN_VERSION} ` | |
# -R github.com/thebrowsercompany/swift-build ` | |
# | |
name: Release - Swift Toolchain Binary Sizes | |
on: | |
pull_request: | |
paths: | |
- .github/workflows/release-swift-toolchain-binary-sizes.yml | |
release: | |
types: [created, edited] | |
workflow_call: | |
inputs: | |
toolchain_version: | |
description: 'Use this swift toolchain release version' | |
required: false | |
type: string | |
default: '' | |
dry_run: | |
description: 'Whether to generate data but skip uploads.' | |
required: false | |
type: boolean | |
default: true | |
workflow_dispatch: | |
inputs: | |
toolchain_version: | |
description: 'Use this swift toolchain release version' | |
required: false | |
type: string | |
default: '' | |
dry_run: | |
description: 'Whether to generate data but skip uploads.' | |
required: false | |
type: boolean | |
default: true | |
env: | |
SOURCE_ROOT: ${{ github.workspace }}/source | |
BUILD_ROOT: ${{ github.workspace }}/build | |
jobs: | |
context: | |
runs-on: windows-latest | |
outputs: | |
matrix: ${{ steps.matrix.outputs.matrix }} | |
toolchain_version: ${{ steps.toolchain-version.outputs.toolchain_version }} | |
upload: ${{ steps.upload.outputs.upload }} | |
steps: | |
- id: matrix | |
run: | | |
$Matrix = @" | |
[ | |
{ | |
"arch": "amd64", | |
"os": "windows-latest", | |
"is_cirun": "false" | |
}, | |
{ | |
"arch": "arm64", | |
"os": "cirun-win11-23h2-pro-arm64-16-2024-06-17", | |
"is_cirun": "true" | |
} | |
] | |
"@ | |
# Cirun kill switch. | |
# Edit https://github.com/thebrowsercompany/swift-build/settings/variables/actions to override. | |
if ("${{ vars.USE_CIRUN }}" -eq "false") { | |
$Matrix="$Matrix" | jq '[ .[] | select(.is_cirun == "false") ]' | |
} | |
# Minify output so Github can parse it. | |
$Matrix=$Matrix | jq -c | |
echo "Generated matrix: $Matrix" | |
"matrix=$Matrix" | Out-File -Encoding utf8 -Append $env:GITHUB_OUTPUT | |
- name: Determine Swift toolchain version | |
id: toolchain-version | |
env: | |
# This version is arbitrarily chosen. | |
TEST_SWIFT_TOOLCHAIN_VERSION: "20240509.3" | |
run: | | |
if ( "${{ inputs.toolchain_version }}" ) { | |
$ToolchainVersion="${{ inputs.toolchain_version }}" | |
} elseif ( "${{ github.event_name == 'pull_request' }}" -eq "true" ) { | |
$ToolchainVersion="${{ env.TEST_SWIFT_TOOLCHAIN_VERSION }}" | |
} else { | |
$ToolchainVersion="${{ github.ref_name }}" | |
} | |
"toolchain_version=$ToolchainVersion" | Out-File -Encoding utf8 -Append $env:GITHUB_OUTPUT | |
binary_size_data: | |
name: Generate Swift toolchain binary size data | |
needs: [context] | |
permissions: | |
contents: read | |
# required to make OIDC work | |
id-token: write | |
env: | |
BLOATY_OPTIONS_FILE: ${{ github.workspace }}/bloaty.textproto | |
runs-on: cirun-win11-23h2-pro-arm64-16-2024-06-17 | |
steps: | |
# For scripts/python/binary_sizes | |
- name: Install Python dependencies | |
run: | | |
python3 -m pip install --upgrade pip | |
python3 -m pip install --upgrade setuptools | |
python3 -m pip install google-cloud-bigquery | |
python3 -m pip install google-auth-oathlib | |
python3 -m pip install pandas | |