From 41e9bd4e359d6f63395e1e9767423beb58b192d6 Mon Sep 17 00:00:00 2001 From: James Kessler Date: Thu, 22 Aug 2024 21:30:17 -0700 Subject: [PATCH] Fix problems with latest release (#146) * Revise build-linux job to ensure all tar archives contain a coveralls binary. * Update README for new, dual architecture linux binaries. * Fix syntax error per ameba linting. * Force homebrew formula update to avoid issues with existing PRs. --- .github/workflows/build.yml | 52 ++++++++++++++++++++++++++++++------- Dockerfile | 12 +++------ README.md | 22 +++++++++++++++- src/coverage_reporter.cr | 1 - 4 files changed, 67 insertions(+), 20 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9012a18..5c77705 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -83,7 +83,12 @@ jobs: --platform linux/amd64 \ --build-arg CRYSTAL_VERSION=1.13.1 \ --target x86_64_binary \ - --output type=local,dest=./dist . + --output type=local,dest=./dist/x86_64 . + + - name: (Debug) List contents of dist/x86_64 + run: | + echo "Contents of dist/x86_64:" + ls -lah dist/x86_64/ - name: Build aarch64 binary run: | @@ -92,15 +97,41 @@ jobs: --platform linux/arm64 \ --build-arg CRYSTAL_VERSION=1.13.1 \ --target aarch64_binary \ - --output type=local,dest=./dist . + --output type=local,dest=./dist/aarch64 . - - name: Rename and prepare artifacts + - name: (Debug) List contents of dist/aarch64 run: | - cd dist - cp coveralls-linux-x86_64 coveralls-linux # Create the "generic" linux binary for backward compatibility - tar -czf coveralls-linux.tar.gz coveralls-linux - tar -czf coveralls-linux-x86_64.tar.gz coveralls-linux-x86_64 - tar -czf coveralls-linux-aarch64.tar.gz coveralls-linux-aarch64 + echo "Contents of dist/aarch64:" + ls -lah dist/aarch64/ + + - 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 @@ -178,7 +209,7 @@ jobs: mv coveralls.exe coveralls-windows.exe sha256sum * > coveralls-checksums.txt - - name: (Debug) List Contents Release Directory + - name: (Debug) List Contents of Release Directory run: | echo "Listing contents of release/ directory:" ls -lah release/ @@ -199,7 +230,7 @@ jobs: '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.zi'p + 'coveralls-windows.zip#coveralls-windows.zip' 'coveralls-checksums.txt#coveralls-checksums.txt' --generate-notes @@ -215,3 +246,4 @@ jobs: tap: coverallsapp/coveralls formula: coveralls token: ${{ secrets.HOMEBREW_TOKEN }} + force: true diff --git a/Dockerfile b/Dockerfile index 416b8e0..1196661 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,7 +11,7 @@ RUN sed -i '/ameba/d' shard.yml \ && sed -i '/crystal-kcov/d' shard.yml \ && shards install --ignore-crystal-version \ && mkdir -p /app/bin \ - && crystal build --release src/coverage_reporter.cr -o /app/bin/coveralls-linux-x86_64 + && crystal build --release src/coverage_reporter.cr -o /app/bin/coveralls # Stage 2: Build for aarch64 FROM 84codes/crystal:${CRYSTAL_VERSION}-${BASE_IMAGE_TAG} AS builder-aarch64 @@ -25,16 +25,12 @@ RUN sed -i '/ameba/d' shard.yml \ && rm -rf .shards \ && shards install --ignore-crystal-version \ && mkdir -p /app/bin \ - && crystal build --release src/coverage_reporter.cr -o /app/bin/coveralls-linux-aarch64 + && crystal build --release src/coverage_reporter.cr -o /app/bin/coveralls # Stage 3a: Export Binary for x86_64 FROM scratch AS x86_64_binary -COPY --from=builder-x86_64 /app/bin/coveralls-linux-x86_64 / +COPY --from=builder-x86_64 /app/bin/coveralls /coveralls # Stage 3b: Export Binary for aarch64 FROM scratch AS aarch64_binary -COPY --from=builder-aarch64 /app/bin/coveralls-linux-aarch64 / - -# Stage 4: Final stage to create a generic binary for backward compatibility -FROM scratch AS final -COPY --from=x86_64_binary /coveralls-linux-x86_64 /coveralls-linux +COPY --from=builder-aarch64 /app/bin/coveralls /coveralls diff --git a/README.md b/README.md index feb08c8..7dd9316 100644 --- a/README.md +++ b/README.md @@ -18,12 +18,32 @@ Auto-detects your coverage artifact files and CI environment to post to [Coveral ### Linux -You can omit `-C /usr/local/bin` argument to keep it in current directory. +#### For x86_64 Architecture + +You can choose to download and install from either the generic Linux archive or the `x86_64`-specific archive. + +To install the generic Linux binary (which is for `x86_64`): ```bash curl -L https://coveralls.io/coveralls-linux.tar.gz | tar -xz -C /usr/local/bin ``` +To install the `x86_64`-specific binary: + +```bash +curl -L https://coveralls.io/coveralls-linux-x86_64.tar.gz | tar -xz -C /usr/local/bin +``` + +#### For aarch64 Architecture + +To install the `aarch64` binary: + +```bash +curl -L https://coveralls.io/coveralls-linux-aarch64.tar.gz | tar -xz -C /usr/local/bin +``` + +**Note**: You can omit the `-C /usr/local/bin` argument to keep the binary in the current directory. + ### MacOS ```bash diff --git a/src/coverage_reporter.cr b/src/coverage_reporter.cr index 19da21b..17b0006 100644 --- a/src/coverage_reporter.cr +++ b/src/coverage_reporter.cr @@ -2,5 +2,4 @@ require "./coverage_reporter/*" module CoverageReporter VERSION = "0.6.14" - end