-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Moved get-tested setup to own workflow (#47)
* Moved get-tested setup to own workflow This way it can be reused if one does need it in other places and not only for build matrix generation. * Ensure output directory exists * Added workflow to test actions provided by this repository * Forgot to checkout the repository first * Try setting GH_TOKEN in setup-get-tested action * Download release archive to RUNNER_TEMP * Fixed: steps.setup.path -> steps.setup.outputs.path in setup-get-tested job
- Loading branch information
Showing
3 changed files
with
120 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
name: Test actions pipeline | ||
|
||
on: | ||
pull_request: | ||
branches: ['main'] | ||
|
||
push: | ||
branches: ['main'] | ||
|
||
jobs: | ||
test-action: | ||
name: 'Test get-tested action' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout the repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Extract the tested GHC versions | ||
id: create-matrix | ||
uses: ./ | ||
with: | ||
cabal-file: get-tested.cabal | ||
ubuntu-version: 'latest' | ||
macos-version: 'latest' | ||
|
||
- name: Output matrix | ||
run: | | ||
jq '.' <<< "${{ steps.create-matrix.matrix }}" | ||
test-setup-action: | ||
name: 'Test setup-get-tested action' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout the repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up without options | ||
id: setup | ||
uses: ./setup-get-tested | ||
|
||
- name: Set up with explicit directory | ||
id: setup-with-directory | ||
uses: ./setup-get-tested | ||
with: | ||
directory: "my-bin-dir" | ||
|
||
- name: Output results | ||
run: | | ||
echo "${{ steps.setup.outputs.path }}" | ||
if [[ -x "${{ steps.setup.outputs.path }}" ]]; then | ||
echo "Is executable" | ||
else | ||
echo "Is NOT executable" | ||
exit 1 | ||
fi | ||
echo "${{ steps.setup-with-directory.outputs.path }}" | ||
if [[ -x "${{ steps.setup-with-directory.outputs.path }}" ]]; then | ||
echo "Is executable" | ||
else | ||
echo "Is NOT executable" | ||
exit 1 | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
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 | ||
env: | ||
GH_TOKEN: ${{ github.token }} | ||
run: | | ||
tmpdir="$(mktemp --directory "${RUNNER_TEMP}/setup-get-tested.XXX")" | ||
trap "rm -rf ${tmpdir}" EXIT | ||
gh_release_flags=( | ||
--repo Kleidukos/get-tested | ||
--pattern 'get-tested-*-Linux-static-x86_64.tar.gz' | ||
--output "${tmpdir}/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 | ||
mkdir -p "${{ inputs.directory }}" | ||
tar -x -v -z -f "${tmpdir}/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' |