Skip to content

Fix problems with latest release #421

Fix problems with latest release

Fix problems with latest release #421

Workflow file for this run

name: Build
on:
pull_request:
branches:
- master
push:
tags:
- 'v*'
permissions:
contents: write
jobs:
# Build the Windows binary
build-windows:
runs-on: windows-2022
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Crystal
uses: crystal-lang/install-crystal@v1
with:
crystal: 1.13.1
- 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 the Linux binaries for multiple architectures
build-linux:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Docker BuildX
run: |
docker run --rm --privileged docker/binfmt:a7996909642ee92942dcd6cff44b9b95f08dad64
docker buildx create --use
- name: Build x86_64 binary
run: |
docker buildx build \
--no-cache \
--platform linux/amd64 \
--build-arg CRYSTAL_VERSION=1.13.1 \
--target x86_64_binary \
--output type=local,dest=./dist .
- name: (Debug) List contents of dist/
run: |
echo "Contents of dist/x86_64:"
ls -lah dist/
- name: Build aarch64 binary
run: |
docker buildx build \
--no-cache \
--platform linux/arm64 \
--build-arg CRYSTAL_VERSION=1.13.1 \
--target aarch64_binary \
--output type=local,dest=./dist .
- name: (Debug) List contents of dist/
run: |
echo "Contents of dist/aarch64:"
ls -lah dist/
- name: Prepare artifacts for x86_64
run: |
# Ensure the directory exists
if [ -d "dist/x86_64" ]; then
# Create tarball for x86_64
tar -czf dist/coveralls-linux-x86_64.tar.gz -C dist/x86_64 coveralls
# Create generic tarball for backward compatibility
tar -czf dist/coveralls-linux.tar.gz -C dist/x86_64 coveralls
# Create binaries for upload
cp dist/x86_64/coveralls dist/coveralls-linux
cp dist/x86_64/coveralls dist/coveralls-linux-x86_64
else
echo "dist/x86_64 directory does not exist!"
exit 1
fi
- name: Prepare artifacts for aarch64
run: |
# Ensure the directory exists
if [ -d "dist/aarch64" ]; then
# Create tarball for aarch64
tar -czf dist/coveralls-linux-aarch64.tar.gz -C dist/aarch64 coveralls
# Create binary for upload
cp dist/aarch64/coveralls dist/coveralls-linux-aarch64
else
echo "dist/aarch64 directory does not exist!"
exit 1
fi
- name: Upload generic linux binary (x86_64)
uses: actions/upload-artifact@v4
with:
name: coveralls-linux
path: dist/coveralls-linux
if-no-files-found: error
- name: Upload generic linux (x86_64) tar.gz archive
uses: actions/upload-artifact@v4
with:
name: coveralls-linux.tar.gz
path: dist/coveralls-linux.tar.gz
if-no-files-found: error
- name: Upload x86_64-specific binary
uses: actions/upload-artifact@v4
with:
name: coveralls-linux-x86_64
path: dist/coveralls-linux-x86_64
if-no-files-found: error
- name: Upload x86_64-specific tar.gz archive
uses: actions/upload-artifact@v4
with:
name: coveralls-linux-x86_64.tar.gz
path: dist/coveralls-linux-x86_64.tar.gz
if-no-files-found: error
- name: Upload aarch64 binary
uses: actions/upload-artifact@v4
with:
name: coveralls-linux-aarch64
path: dist/coveralls-linux-aarch64
if-no-files-found: error
- name: Upload aarch64 tar.gz archive
uses: actions/upload-artifact@v4
with:
name: coveralls-linux-aarch64.tar.gz
path: dist/coveralls-linux-aarch64.tar.gz
if-no-files-found: error
# Create a GitHub release and attach built artifacts
release:
runs-on: ubuntu-latest
needs: [build-windows, build-linux]
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Fetch tags
run: git fetch --force --tags
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: artifacts/
- name: (Debug) List Contents of Artifacts Directory
run: |
echo "Listing contents of artifacts/ directory:"
ls -lah artifacts/
echo "Verifying files in artifacts/ directory:"
find artifacts/ -type f
- name: Prepare files for release
run: |
mkdir release/
find artifacts/ -type f -exec cp \{} release/ \;
cd release/
mv coveralls.exe coveralls-windows.exe
sha256sum * > coveralls-checksums.txt
- name: (Debug) List Contents of Release Directory
run: |
echo "Listing contents of release/ directory:"
ls -lah release/
echo "Verifying files in release/ directory:"
find release/ -type f
- 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
# Update the Homebrew formula for MacOS releases
homebrew:
runs-on: ubuntu-latest
needs: [release]
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
steps:
- name: Update Homebrew formula
uses: dawidd6/action-homebrew-bump-formula@v3
with:
tap: coverallsapp/coveralls
formula: coveralls
token: ${{ secrets.HOMEBREW_TOKEN }}
force: true