Skip to content

Commit

Permalink
Test Linux Binaries after they're built in CI (Cont'd) (#162)
Browse files Browse the repository at this point in the history
* Add jobs to test multi-arch binaries to build.yml workflow after the build-linux job. 
* Remove the separate workflows initially created to test the binaries, which got triggered by workflow_run but only ran in the default branch. This was extremely difficult to manage, and the testing of the binaries didn't add much processing time to the existing build.yml workflow.
* The two (2) new binary testing jobs now send two (2) new "release candidate" builds to Coveralls.io for each newly built `x86_64` and `aarch64` binary. 
* The binaries are tested not only against the new coverage report from the current CI run of coverage-reporter, but also against all the coverage reports in different formats included in the test fixtures of coverage-reporter's code base, which provides verification that the new binaries can process all known formats.
* Use dawidd6/action-download-artifact@v3 action instead of actions/download-artifact@v4 to share artifacts across workflows. (actions/download-artifact@v4 officially supports this now, but we couldn't get it to work.)
  • Loading branch information
afinetooth authored Oct 1, 2024
1 parent 42ed611 commit 01bb3e9
Show file tree
Hide file tree
Showing 5 changed files with 90 additions and 210 deletions.
133 changes: 76 additions & 57 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@ on:
tags:
- 'v*'

permissions:
contents: write

jobs:
build-windows:
runs-on: windows-2022
Expand Down Expand Up @@ -74,11 +71,6 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
# # Debug step to verify event context
# - name: Print event context for build-linux
# run: |
# echo "${{ toJson(github.event) }}"

- name: Checkout code
uses: actions/checkout@v4

Expand All @@ -94,70 +86,97 @@ jobs:
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

# Debug step to verify what files are in the dist/ directory
- name: List files in dist/ directory
run: ls -la dist/

- name: Upload linux binaries
uses: actions/upload-artifact@v4
with:
name: coveralls-linux-binaries
path: dist/*
if-no-files-found: error

- name: Create Trigger File
run: echo "test-binaries-trigger" > test-binaries-trigger.txt
test-linux-x86_64:
runs-on: ubuntu-latest
needs: build-linux
steps:
# - name: Checkout code
# uses: actions/checkout@v4

- name: Upload Trigger Artifact
uses: actions/upload-artifact@v4
- name: Download x86_64 binary
uses: actions/download-artifact@v4
with:
name: test-binaries-trigger
path: test-binaries-trigger.txt

# - name: Upload coveralls-linux
# uses: actions/upload-artifact@v4
# with:
# name: coveralls-linux
# path: dist/coveralls-linux
#
# - name: Upload coveralls-linux.tar.gz
# uses: actions/upload-artifact@v4
# with:
# name: coveralls-linux.tar.gz
# path: dist/coveralls-linux.tar.gz
#
- name: Upload coveralls-linux-x86_64
uses: actions/upload-artifact@v4
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:
name: coveralls-linux-x86_64
path: dist/coveralls-linux-x86_64
#
# - name: Upload coveralls-linux-x86_64.tar.gz
# uses: actions/upload-artifact@v4
# with:
# name: coveralls-linux-x86_64.tar.gz
# path: dist/coveralls-linux-x86_64.tar.gz
#
- name: Upload coveralls-linux-aarch64
uses: actions/upload-artifact@v4
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:
# - 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:
name: coveralls-linux-aarch64
path: dist/coveralls-linux-aarch64
#
# - name: Upload coveralls-linux-aarch64.tar.gz
# uses: actions/upload-artifact@v4
# with:
# name: coveralls-linux-aarch64.tar.gz
# path: dist/coveralls-linux-aarch64.tar.gz

# Debug step to verify what files are in the dist/ directory
- name: List files in dist/ directory
run: ls -la dist/
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
Expand Down
14 changes: 14 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,17 @@ jobs:
run: |
cd coverage
../bin/coveralls report --measure --base-path src/coverage_reporter/
- name: Capture and export coverage report file as env variable
run: |
COVERAGE_FILE=$(find ${{ github.workspace }}/coverage -name "*.xml" | grep cobertura.xml)
echo "Found coverage file(s): $COVERAGE_FILE"
echo "COVERAGE_FILE=$COVERAGE_FILE" >> $GITHUB_ENV
- name: Upload coverage report
uses: actions/upload-artifact@v4
with:
name: coverage-report
path: ${{ env.COVERAGE_FILE }}
retention-days: 5

65 changes: 0 additions & 65 deletions .github/workflows/test-binaries-qemu.yml

This file was deleted.

75 changes: 0 additions & 75 deletions .github/workflows/test-binaries.yml

This file was deleted.

13 changes: 0 additions & 13 deletions .github/workflows/test-trigger-workflow.yml

This file was deleted.

0 comments on commit 01bb3e9

Please sign in to comment.