Skip to content

Commit

Permalink
Make --oldest and --newest available to the Workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
Kleidukos committed Sep 6, 2024
1 parent fb0c1fa commit 302a21b
Showing 1 changed file with 51 additions and 12 deletions.
63 changes: 51 additions & 12 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,14 @@ inputs:
description: "Enable Ubuntu runner. If both `ubuntu` and `ubuntu-version` inputs are set, the explicit version will take priority"
required: false
default: ""
newest:
description: "Enable only the newest GHC version found in the cabal file"
required: false
default: false
oldest:
description: "Enable only the oldest GHC version found in the cabal file"
required: false
default: false

outputs:
matrix:
Expand All @@ -53,51 +61,82 @@ runs:
with:
version: ${{ inputs.version }}

- name: Set up options
- name: Set up Windows options
shell: bash
run: |
echo "::debug:: macOS: ${{ inputs.macos-version }}"
echo "::debug:: windows: ${{ inputs.windows-version }}"
echo "::debug:: ubuntu: ${{ inputs.ubuntu-version }}"
echo "::debug::windows: ${{ inputs.windows-version }}"
if [[ "${{ inputs.windows-version }}" != "" ]]
then
echo "::debug:: Windows explicit enabled: ${{ inputs.windows-version }}"
echo "::debug::Windows explicit enabled: ${{ inputs.windows-version }}"
echo "WINDOWS=--windows-version=${{ inputs.windows-version }}" >> $GITHUB_ENV
elif [[ ${{ inputs.windows }} == "true" ]]
then
echo "::debug:: Windows fallback enabled: ${{ inputs.windows }}"
echo "::warning title=Legacy option `windows`::Windows fallback enabled: ${{ inputs.windows }}"
echo "WINDOWS=--windows" >> $GITHUB_ENV
else echo "WINDOWS=" >> $GITHUB_ENV
fi
- name: Set up macOS options
shell: bash
run: |
echo "::debug::macOS: ${{ inputs.macos-version }}"
if [[ "${{ inputs.macos-version }}" != "" ]]
then
echo "::debug:: macOS explicit version enabled: ${{ inputs.macos-version }}"
echo "::debug::macOS explicit version enabled: ${{ inputs.macos-version }}"
echo "MACOS=--macos-version=${{ inputs.macos-version }}" >> $GITHUB_ENV
elif [[ ${{ inputs.macos }} == "true" ]]
then
echo "::debug:: macOS fallback enabled: ${{ inputs.macos }}"
echo "::warning title=Legacy option `macos`::macOS fallback enabled: ${{ inputs.macos }}"
echo "MACOS=--macos" >> $GITHUB_ENV
else echo "MACOS=" >> $GITHUB_ENV
fi
- name: Set up Ubuntu options
shell: bash
run: |
echo "::debug::ubuntu: ${{ inputs.ubuntu-version }}"
if [[ "${{ inputs.ubuntu-version }}" != "" ]]
then
echo "::debug:: Ubuntu explicit version enabled: ${{ inputs.ubuntu-version }}"
echo "::debug::Ubuntu explicit version enabled: ${{ inputs.ubuntu-version }}"
echo "UBUNTU=--ubuntu-version=${{ inputs.ubuntu-version }}" >> $GITHUB_ENV
elif [[ ${{ inputs.ubuntu }} == "true" ]]
then
echo "::debug:: Ubuntu fallback enabled: ${{ inputs.ubuntu }}"
echo "::warning title=Legacy option `ubuntu`::Ubuntu fallback enabled: ${{ inputs.ubuntu }}"
echo "UBUNTU=--ubuntu" >> $GITHUB_ENV
else echo "UBUNTU=" >> $GITHUB_ENV
fi
- name: Set up `oldest` and `newest` options
shell: bash
run: |
echo "::debug::Is --newest enabled: ${{ inputs.newest }}"
echo "::debug::Is --oldest enabled: ${{ inputs.oldest }}"
if [[ "${{ inputs.oldest}} == "true" " && "${{ inputs.newest }}" == "true" ]]
then
echo "::error title=Incompatible options::You cannot use the 'oldest' and 'newest' options together!"
exit 1
fi
if [[ -n ${{ inputs.oldest }} ]]
then
echo "::debug::oldest version enabled"
echo "RELATIVE_VERSION=--oldest" >> $GITHUB_ENV
elif [[ -n ${{ inputs.newest }} ]]
then
echo "::debug::newest version enabled"
echo "RELATIVE_VERSION=--newest" >> $GITHUB_ENV
else
echo "::debug::No relative version selected"
fi
- name: Extract the tested GHC versions
id: set-matrix
shell: bash
run: |
./get-tested $WINDOWS $MACOS $UBUNTU ${{ inputs.cabal-file }} >> $GITHUB_OUTPUT
./get-tested $WINDOWS $MACOS $UBUNTU $RELATIVE_VERSION ${{ inputs.cabal-file }} >> $GITHUB_OUTPUT
branding:
icon: 'list'
Expand Down

0 comments on commit 302a21b

Please sign in to comment.