Skip to content

Commit

Permalink
Moved get-tested setup to own workflow
Browse files Browse the repository at this point in the history
This way it can be reused if one does need it in other places and not
only for build matrix generation.
  • Loading branch information
mmhat committed Aug 13, 2024
1 parent 1382333 commit 3a013a5
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 15 deletions.
22 changes: 7 additions & 15 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ inputs:
description: "The path to your cabal file, e.g. somefolder/myproject.cabal"
required: true
version:
description: "Version of the tool"
description: "Version of the get-tested tool"
required: false
default: ""
windows:
Expand Down Expand Up @@ -44,23 +44,15 @@ runs:
steps:
- name: Checkout base repo
uses: actions/checkout@v4

- name: Set up get-tested
uses: ./setup-get-tested
with:
version: ${{ inputs.version }}

- name: Set up options
shell: bash
run: |
gh_release_flags=(
--repo Kleidukos/get-tested
--pattern 'get-tested-*-Linux-static-x86_64.tar.gz'
--output get-tested.tar.gz
)
if [[ "${{ inputs.version }}" != "" ]]
then
gh release download "v${{ inputs.version }}" "${gh_release_flags[@]}"
else
gh release download "${gh_release_flags[@]}"
fi
tar -xzvf get-tested.tar.gz
chmod +x get-tested
echo "::debug:: macOS: ${{ inputs.macos-version }}"
echo "::debug:: windows: ${{ inputs.windows-version }}"
echo "::debug:: ubuntu: ${{ inputs.ubuntu-version }}"
Expand Down
45 changes: 45 additions & 0 deletions setup-get-tested/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: "Set up get-tested"
description: "Fetches the get-tested tool"

inputs:
version:
description: "The version of the get-tested tool. Defaults to 'latest' if unspecified."
required: false
default: ""
directory:
description: "The directory where the get-tested executable should be placed."
required: false
default: "."

outputs:
path:
description: "The path to the get-tested executable."
value: ${{ steps.setup.outputs.path }}

runs:
using: "composite"
steps:
- name: Set up get-tested
id: setup
shell: bash
run: |
gh_release_flags=(
--repo Kleidukos/get-tested
--pattern 'get-tested-*-Linux-static-x86_64.tar.gz'
--output get-tested.tar.gz
)
if [[ "${{ inputs.version }}" != "" ]]; then
gh release download "v${{ inputs.version }}" "${gh_release_flags[@]}"
else
gh release download "${gh_release_flags[@]}"
fi
tar -x -v -z -f get-tested.tar.gz -C "${{ inputs.directory }}"
path="${{ inputs.directory }}/get-tested"
chmod a+x "${path}"
echo "path=${path}" >> "${GITHUB_OUTPUT}"
branding:
icon: 'list'
color: 'blue'

0 comments on commit 3a013a5

Please sign in to comment.