Skip to content

Commit

Permalink
Remove dependency on GNAT CE when building branch
Browse files Browse the repository at this point in the history
  • Loading branch information
mosteo committed Mar 13, 2024
1 parent 2c67b8f commit 2199b5d
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 6 deletions.
1 change: 1 addition & 0 deletions .github/workflows/selftest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ on: pull_request
jobs:
setup-alire:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
target: [stable, nightly, source]
Expand Down
43 changes: 37 additions & 6 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,44 @@ runs:
id: find-gnat
run: gnat --version && echo "available=true" >> $GITHUB_OUTPUT || echo "available=false" >> $GITHUB_OUTPUT

# Setup a GNAT if necessary to build from branch.
# We cannot use alr-install or setup-alire, as that creates infinite recursion.
- name: Install GNAT
# Setup a GNAT if necessary to build from branch. We cannot use alr-install
# or setup-alire, as that creates infinite recursion. Rather than relying
# on the old action that sets up CE editions, we rely on ourselves to
# install a stable alr and use it to install the toolchain we need.

# BEGIN TOOLCHAIN INSTALLATION

- name: Identify need for GNAT
if: inputs.branch != '' && steps.find-gnat.outputs.available != 'true' && steps.cache-alr.outputs.cache-hit != 'true'
uses: ada-actions/toolchain@ce2020
with:
distrib: community
id: need-GNAT
shell: bash
run: echo "need=true" >> $GITHUB_OUTPUT

- name: Install GNAT (I)
if: steps.need-GNAT.outputs.need == 'true'
uses: alire-project/setup-alire@v3

- name: Install GNAT (II)
if: steps.need-GNAT.outputs.need == 'true'
shell: bash
run: |
alr install gnat_native gprbuild --prefix=$PWD/setup_alire_prefix
rm -rf ./alire_install && echo REMOVED stable alr used for toolchain install
- name: Install GNAT (III) - Add to path (Windows)
if: steps.need-GNAT.outputs.need == 'true' && runner.os == 'Windows'
shell: pwsh
run: |
$Target = Resolve-Path $PWD.Path\setup_alire_prefix\bin
Add-Content $env:GITHUB_PATH $Target
- name: Install GNAT (III) - Add to path (!Windows)
if: steps.need-GNAT.outputs.need == 'true' && runner.os != 'Windows'
shell: bash
run: |
readlink -f "$PWD/setup_alire_prefix/bin" >> $GITHUB_PATH
# END TOOLCHAIN INSTALLATION

# To run the old setup action which is javascript
- name: Setup Node
Expand Down

0 comments on commit 2199b5d

Please sign in to comment.