diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3f11491..9f9a532 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -12,9 +12,6 @@ on: tags: - 'v*' -permissions: - contents: write - jobs: build-windows: runs-on: windows-2022 @@ -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 @@ -94,15 +86,13 @@ 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: @@ -110,54 +100,83 @@ jobs: 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 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b84d0e3..92a3973 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 + \ No newline at end of file diff --git a/.github/workflows/test-binaries-qemu.yml b/.github/workflows/test-binaries-qemu.yml deleted file mode 100644 index 910812d..0000000 --- a/.github/workflows/test-binaries-qemu.yml +++ /dev/null @@ -1,65 +0,0 @@ -name: test-binaries-qemu - -permissions: - contents: read - actions: read - -on: - workflow_run: - workflows: [build] - types: - - completed - -jobs: - test-x86_64: - runs-on: ubuntu-22.04 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - steps: - # Debug step to list artifacts for the run - - name: List available artifacts - run: | - echo "Available artifacts:" - curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ - "https://api.github.com/repos/${{ github.repository }}/actions/runs/${{ github.event.workflow_run.id }}/artifacts" | jq '.artifacts[] | .name' - - name: Download coveralls-linux-x86_64 binary - uses: actions/download-artifact@v4 - with: - run-id: ${{ github.event.workflow_run.id }} - name: coveralls-linux-x86_64 - path: ./artifacts - - name: Test binary - env: - COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }} - run: | - chmod +x ./artifacts/coveralls-linux-x86_64 - ./artifacts/coveralls-linux-x86_64 --version - ./artifacts/coveralls-linux-x86_64 report --measure --base-path src/coverage_reporter/ - - test-aarch64: - runs-on: ubuntu-22.04 - steps: - # Debug step to list artifacts for the run - - name: List available artifacts - run: | - echo "Available artifacts:" - curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ - "https://api.github.com/repos/${{ github.repository }}/actions/runs/${{ github.event.workflow_run.id }}/artifacts" | jq '.artifacts[] | .name' - - name: Set up QEMU for aarch64 emulation - uses: docker/setup-qemu-action@v3 - with: - platforms: linux/arm64 # Or qemu-aarch64? - - name: Download coveralls-linux-aarch64 binary - uses: actions/download-artifact@v4 - with: - run-id: ${{ github.event.workflow_run.id }} - name: coveralls-linux-aarch64 - path: ./artifacts - - name: Test binary - env: - COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }} - run: | - chmod +x ./artifacts/coveralls-linux-aarch64 - ./artifacts/coveralls-linux-aarch64 --version - ./artifacts/coveralls-linux-aarch64 report --measure --base-path src/coverage_reporter/ diff --git a/.github/workflows/test-binaries.yml b/.github/workflows/test-binaries.yml deleted file mode 100644 index 2076811..0000000 --- a/.github/workflows/test-binaries.yml +++ /dev/null @@ -1,75 +0,0 @@ -name: test-binaries - -permissions: - contents: read - actions: read - -on: - workflow_run: - workflows: [build] - types: - - completed - -jobs: - test_binaries: - name: Test Multi-Arch Binaries - runs-on: ubuntu-22.04 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - strategy: - matrix: - arch: [x86_64, aarch64] - - steps: - - name: Checkout code - uses: actions/checkout@v4 - - # Debug step to list artifacts for the run - - name: List available artifacts - run: | - echo "Available artifacts:" - curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ - "https://api.github.com/repos/${{ github.repository }}/actions/runs/${{ github.event.workflow_run.id }}/artifacts" | jq '.artifacts[] | .name' - - # - name: Download built artifacts (linux binaries) - # uses: actions/download-artifact@v4 - # with: - # run-id: ${{ github.event.workflow_run.id }} - # name: coveralls-linux-binaries - # path: ./binaries/ - - - name: Download built x86_64 binary - uses: actions/download-artifact@v4 - with: - run-id: ${{ github.event.workflow_run.id }} - name: coveralls-linux-x86_64 - path: ./binaries/ - - - name: Download built aarch64 binary - uses: actions/download-artifact@v4 - with: - run-id: ${{ github.event.workflow_run.id }} - name: coveralls-linux-aarch64 - path: ./binaries/ - - # Debug step to list available artifacts - - name: List available artifacts in ./binaries/ - run: ls -la ./binaries/ - - - name: Download coverage report - uses: actions/download-artifact@v4 - with: - name: coverage-report # Assuming this is the name of the artifact from the build.yml run - path: ./coverage/ - - # Run the binary inside a Docker container with the correct architecture - - name: Test Binary in Architecture-Specific Docker Container - run: | - if [ "${{ matrix.arch }}" = "x86_64" ]; then - make ubuntu-x86_64 && ./binaries/coveralls-linux-x86_64 report --measure --base-path src/coverage_reporter/; - elif [ "${{ matrix.arch }}" = "aarch64" ]; then - make ubuntu-aarch64 && ./binaries/coveralls-linux-aarch64 report --measure --base-path src/coverage_reporter/; - fi - env: - COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }} diff --git a/.github/workflows/test-trigger-workflow.yml b/.github/workflows/test-trigger-workflow.yml deleted file mode 100644 index d4359e0..0000000 --- a/.github/workflows/test-trigger-workflow.yml +++ /dev/null @@ -1,13 +0,0 @@ -name: test-trigger-workflow - -on: - workflow_run: - workflows: [build] - types: - - completed - -jobs: - test: - runs-on: ubuntu-latest - steps: - - run: echo "Trigger worked"