Use different compilers based on target architecture #104
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
on: | |
pull_request: | |
push: | |
workflow_dispatch: | |
env: | |
BLOATY_VERSION: 34f4a66559ad4938c1e629e9b5f54630b2b4d7b0 # Mar 2024 | |
# The tests below won't fail as long as bloaty runs succesfully. | |
# Eyeball the bloaty output at the end of each job and make sure | |
# it's as expected. | |
jobs: | |
test-build-and-run: | |
strategy: | |
matrix: | |
os: [windows-latest] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
path: ${{ github.workspace }}/source/ | |
- name: Create test program | |
run: gcc ${{ github.workspace }}/source/test/main.c -o main | |
- name: Store abs path to program | |
run: echo "BINARY_PATH=${{ github.workspace }}/main.exe" | %{ $_ -replace '\\','/' } | Out-File $env:GITHUB_ENV -Encoding utf8 -Append | |
- name: Build and run google/bloaty | |
uses: thebrowsercompany/gha-google-bloaty@main | |
with: | |
bloaty-version: ${{ env.BLOATY_VERSION }} | |
bloaty-args: -d inputfiles,segments ${{ env.BINARY_PATH }} | |
bloaty-output-file: ${{ github.workspace }}/bloaty-output.txt | |
- name: Show bloaty output | |
run: Get-Content ${{ github.workspace }}/bloaty-output.txt | |
test-bloaty-input-files: | |
strategy: | |
matrix: | |
os: [windows-latest] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
path: ${{ github.workspace }}/source/ | |
- name: Create test programs | |
run: | | |
gcc ${{ github.workspace }}/source/test/main.c -o main | |
New-Item -Path ${{ github.workspace }}/root/child/grandchild -ItemType "directory" | |
New-Item -Path ${{ github.workspace }}/neighbor/ -ItemType "directory" | |
Copy-Item main.exe ${{ github.workspace }}/neighbor/main.exe | |
Copy-Item main.exe ${{ github.workspace }}/root/main.1.exe | |
Copy-Item main.exe ${{ github.workspace }}/root/child/grandchild/main.2.exe | |
New-Item -Path ${{ github.workspace }}/root/ignored.txt -ItemType "file" | |
New-Item -Path ${{ github.workspace }}/root/child/ignored.txt -ItemType "file" | |
New-Item -Path ${{ github.workspace }}/root/child/grandchild/ignored.txt -ItemType "file" | |
- name: Build and run google/bloaty | |
uses: thebrowsercompany/gha-google-bloaty@main | |
with: | |
bloaty-version: ${{ env.BLOATY_VERSION }} | |
bloaty-args: -d inputfiles,segments | |
# Users should be able to pass a combo of filenames and recursive glob patterns | |
bloaty-input-files: | | |
${{ github.workspace }}/root/**/*.1.exe | |
${{ github.workspace }}/root/**/*.2.exe | |
${{ github.workspace }}/neighbor/main.exe | |
bloaty-output-file: ${{ github.workspace }}/bloaty-output.txt | |
cache-bloaty: 'true' | |
- name: Show bloaty output | |
run: Get-Content ${{ github.workspace }}/bloaty-output.txt | |
test-cache-bloaty: | |
strategy: | |
matrix: | |
os: [windows-latest] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
path: ${{ github.workspace }}/source/ | |
- name: Create test program | |
run: gcc ${{ github.workspace }}/source/test/main.c -o ${{ github.workspace }}/main | |
- name: Store abs path to program | |
run: echo "BINARY_PATH=${{ github.workspace }}/main.exe" | %{ $_ -replace '\\','/' } | Out-File $env:GITHUB_ENV -Encoding utf8 -Append | |
- name: Build and run google/bloaty (should create the cache) | |
uses: thebrowsercompany/gha-google-bloaty@main | |
with: | |
bloaty-version: ${{ env.BLOATY_VERSION }} | |
bloaty-args: -d inputfiles,segments ${{ env.BINARY_PATH }} | |
bloaty-output-file: ${{ github.workspace }}/bloaty-output.txt | |
cache-bloaty: 'true' | |
# Make sure we don't reuse caches across this job's test runs. | |
cache-bloaty-key: test-bloaty-${{ github.sha }} | |
- name: Show bloaty output | |
run: Get-Content ${{ github.workspace }}/bloaty-output.txt | |
- name: Assert bloaty cache exists | |
uses: actions/cache/restore@v3 | |
id: assert-cache | |
continue-on-error: false | |
with: | |
key: test-bloaty-${{ github.sha }} | |
path: .caches/bloaty | |
- name: Run google/bloaty (should cache-hit) | |
uses: thebrowsercompany/gha-google-bloaty@main | |
with: | |
bloaty-version: main | |
bloaty-args: -d inputfiles,segments ${{ env.BINARY_PATH }} | |
cache-bloaty: 'true' | |
cache-bloaty-key: test-bloaty-${{ github.sha }} | |
- name: Show bloaty output | |
run: Get-Content ${{ github.workspace }}/bloaty-output.txt |