Fix release job in build.yml #518
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
name: build | |
permissions: | |
contents: write | |
actions: read | |
on: | |
pull_request: | |
branches: | |
- master | |
push: | |
tags: | |
- 'v*' | |
jobs: | |
build-windows: | |
runs-on: windows-2022 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Install Crystal | |
uses: crystal-lang/install-crystal@v1 | |
with: | |
crystal: 1.13.2 | |
- name: Build SQLite3 static library | |
run: "scripts/sqlite3-static.ps1" | |
- name: Install shards dependencies | |
run: shards install --production | |
- name: Build coverage reporter CLI | |
run: crystal build src\cli.cr -o dist\coveralls --release --static --no-debug --progress | |
- name: Prepare distribution archive | |
run: | | |
cd dist | |
$vsbase = vswhere.exe -products * -property installationPath -latest | |
if (-not $vsbase) { | |
Write-Error "Visual Studio installation not found" | |
exit 1 | |
} | |
$dumpbinPath = Join-Path $vsbase "VC\Tools\MSVC\*\bin\HostX64\x64\dumpbin.exe" | |
$resolvedDumpbin = Get-Item $dumpbinPath | Select-Object -First 1 | |
if (-not $resolvedDumpbin) { | |
Write-Error "dumpbin.exe not found" | |
exit 1 | |
} | |
& $resolvedDumpbin /dependents coveralls.exe | |
tar -acf coveralls-windows.zip coveralls.exe | |
- name: Upload exe | |
uses: actions/upload-artifact@v4 | |
with: | |
name: coveralls-windows.exe | |
path: dist/coveralls.exe | |
if-no-files-found: error | |
- name: Upload zip | |
uses: actions/upload-artifact@v4 | |
with: | |
name: coveralls-windows.zip | |
path: dist/coveralls-windows.zip | |
if-no-files-found: error | |
build-linux: | |
runs-on: ubuntu-latest | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Install Crystal | |
uses: crystal-lang/install-crystal@v1 | |
with: | |
crystal: 1.13.2 | |
- name: Install shards dependencies | |
run: shards install --production | |
- name: Build cross-compilation container | |
run: make build-xbuild-container | |
- name: Build cross-compiled linux binaries | |
id: build | |
run: make compile-and-strip-all | |
- name: Package linux binaries | |
id: package | |
run: make package | |
- name: Upload linux binaries | |
uses: actions/upload-artifact@v4 | |
with: | |
name: coveralls-linux-binaries | |
path: dist/* | |
if-no-files-found: error | |
test-linux-x86_64: | |
runs-on: ubuntu-latest | |
needs: build-linux | |
steps: | |
# We don't technically need to download the coverage-reporter code here | |
# because in these tests we are downloading finished binaries and using them | |
# the same way customers do, but this is a convenient way to get all the | |
# coverage reports in various formats from coverage-reporter's test fixtures | |
# into our environment, making sure the binaries are tested against all | |
# supported coverage report formats. | |
# Removing this step will test each binary only against the latest coverage report | |
# for coverage-reporter itself, from the current CI run (in cobertura XML format). | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Download x86_64 binary | |
uses: actions/download-artifact@v4 | |
with: | |
name: coveralls-linux-binaries | |
path: test/ | |
- name: Smoke test x86_64 binary | |
run: | | |
binary=test/coveralls-linux-x86_64 | |
echo $binary | |
chmod +x $binary | |
$binary --version | |
- name: Download latest coverage report for coverage-reporter from ci.yml | |
uses: dawidd6/action-download-artifact@v3 | |
with: | |
github_token: ${{secrets.GITHUB_TOKEN}} | |
workflow: ci.yml | |
name: coverage-report | |
path: ./coverage/ | |
search_artifacts: true | |
check_artifacts: true | |
if_no_artifact_found: warn | |
- name: Report coverage with x86_64 binary | |
env: | |
COVERALLS_REPO_TOKEN: ${{ github.token }} | |
run: | | |
binary=test/coveralls-linux-x86_64 | |
COVERALLS_SERVICE_NUMBER=rc-x86_64-${{ github.run_id }} $binary report --measure --base-path src/coverage_reporter/ | |
test-linux-aarch64: | |
runs-on: ubuntu-latest | |
needs: build-linux | |
steps: | |
# We don't technically need to download the coverage-reporter code here | |
# because in these tests we are downloading finished binaries and using them | |
# the same way customers do, but this is a convenient way to get all the | |
# coverage reports in various formats from coverage-reporter's test fixtures | |
# into our environment, making sure the binaries are tested against all | |
# supported coverage report formats. | |
# Removing this step will test each binary only against the latest coverage report | |
# for coverage-reporter itself, from the current CI run (in cobertura XML format). | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Download aarch64 binary | |
uses: actions/download-artifact@v4 | |
with: | |
name: coveralls-linux-binaries | |
path: test/ | |
- name: Smoke test aarch64 binary | |
run: | | |
binary=test/coveralls-linux-aarch64 | |
echo $binary | |
chmod +x $binary | |
sudo apt-get update | |
sudo apt-get install -y qemu-user | |
qemu-aarch64 $binary --version | |
- name: Download latest coverage report for coverage-reporter from ci.yml | |
uses: dawidd6/action-download-artifact@v3 | |
with: | |
github_token: ${{secrets.GITHUB_TOKEN}} | |
workflow: ci.yml | |
name: coverage-report | |
path: ./coverage/ | |
search_artifacts: true | |
check_artifacts: true | |
if_no_artifact_found: warn | |
- name: Report coverage with aarch64 binary | |
env: | |
COVERALLS_REPO_TOKEN: ${{ github.token }} | |
run: | | |
binary=test/coveralls-linux-aarch64 | |
COVERALLS_SERVICE_NUMBER=rc-aarch64-${{ github.run_id }} qemu-aarch64 $binary report --measure --base-path src/coverage_reporter/ | |
release: | |
runs-on: ubuntu-latest | |
needs: [build-windows, build-linux] | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/') | |
continue-on-error: true | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Fetch tags | |
run: git fetch --force --tags | |
- name: Download binaries | |
uses: actions/download-artifact@v4 | |
with: | |
path: artifacts/ | |
- name: Extract and prepare files for release | |
run: | | |
mkdir release/ | |
cp -r artifacts/coveralls-linux-binaries/* release/ | |
find artifacts/ -type f -exec cp \{} release/ \; | |
mv release/coveralls.exe release/coveralls-windows.exe | |
sha256sum release/* > release/coveralls-checksums.txt | |
- name: List files in release directory (debug) | |
run: | | |
echo "Listing files in release directory:" | |
ls -l release/ | |
- name: Create Github release | |
env: | |
TAG: ${{ github.ref }} | |
GH_TOKEN: ${{ github.token }} | |
run: > | |
cd release/; | |
gh release create ${TAG} | |
'coveralls-linux#coveralls-linux' | |
'coveralls-linux.tar.gz#coveralls-linux.tar.gz' | |
'coveralls-linux-x86_64#coveralls-linux-x86_64' | |
'coveralls-linux-x86_64.tar.gz#coveralls-linux-x86_64.tar.gz' | |
'coveralls-linux-aarch64#coveralls-linux-aarch64' | |
'coveralls-linux-aarch64.tar.gz#coveralls-linux-aarch64.tar.gz' | |
'coveralls-windows.exe#coveralls-windows.exe' | |
'coveralls-windows.zip#coveralls-windows.zip' | |
'coveralls-checksums.txt#coveralls-checksums.txt' | |
--generate-notes | |
homebrew: | |
runs-on: ubuntu-latest | |
needs: [release] | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/') | |
continue-on-error: true | |
steps: | |
- name: Update Homebrew formula | |
uses: dawidd6/action-homebrew-bump-formula@v3 | |
with: | |
tap: coverallsapp/coveralls | |
formula: coveralls | |
token: ${{ secrets.HOMEBREW_TOKEN }} |