Skip to content

Commit

Permalink
Support new gcov2lcov artefact naming (starting with v1.1.0) (#16)
Browse files Browse the repository at this point in the history
support new gcov2lcov artifact naming scheme
starting with v1.1.0 gcov2lcov uses go-releaser, which
is the reason, the names of the artifacts change a bit.
we support both the new and the old scheme.
  • Loading branch information
jandelgado authored Oct 11, 2024
1 parent 9a62e29 commit 69ef3d5
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog for gcov2lcov-action

## 1.1.0 [2024-10-10]

- prepare for new gcov2lcov version 1.1.0, which will change artifact names

## 1.0.9 [2022-05-23]

- fix: always set `GOROOT` before invoking `gcov2lcov` (#13)
Expand Down
20 changes: 14 additions & 6 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,20 @@ runs:
using: composite
steps:
- shell: bash
run: 'set -x && curl -sLf "$([ ${{inputs.version}} == latest ] && echo $LATEST_RELEASE || echo $RELEASE)/${NAME}.tar.gz" | tar zxf - --strip 1'
run: |
set -xe
if [ "${{inputs.version}}" == "latest" ]; then
URL="https://api.github.com/repos/jandelgado/gcov2lcov/releases/latest"
else
URL="https://api.github.com/repos/jandelgado/gcov2lcov/releases/tags/${{inputs.version}}"
fi
# starting with version v1.1.0 gcov2lcov changed it's artefact naming a bit.
# we are gentle and support also the old naming convetion
PACKAGE_URL=$(curl "$URL" | jq -r '.assets[] | select(.name | test("gcov2lcov.*linux.amd64.tar.gz")) | .browser_download_url')
curl -sLf "$PACKAGE_URL" | tar zxf -
mv bin/gcov2lcov-linux-amd64 gcov2lcov > /dev/null 2>&1 || true # before v1.1.0
working-directory: /tmp
env:
NAME: "gcov2lcov-linux-amd64"
RELEASE: "https://github.com/jandelgado/gcov2lcov/releases/download/${{inputs.version}}"
LATEST_RELEASE: "https://github.com/jandelgado/gcov2lcov/releases/latest/download"
- shell: bash
run: 'set -x && GOROOT=$(go env GOROOT) /tmp/gcov2lcov-linux-amd64 -infile "${{ inputs.infile }}" -outfile "${{ inputs.outfile }}"'
run: 'set -x && GOROOT=$(go env GOROOT) /tmp/gcov2lcov -infile "${{ inputs.infile }}" -outfile "${{ inputs.outfile }}"'
working-directory: ${{ inputs.working-directory }}

0 comments on commit 69ef3d5

Please sign in to comment.