Skip to content

Commit

Permalink
feat: arch/linking safeguards in workflows (#1775)
Browse files Browse the repository at this point in the history
  • Loading branch information
mosteo authored Oct 11, 2024
1 parent 68d701c commit dba60d1
Show file tree
Hide file tree
Showing 6 changed files with 69 additions and 13 deletions.
9 changes: 9 additions & 0 deletions .github/workflows/ci-appimage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ jobs:
- name: Install FSF toolchain
run: sudo apt-get install -y gnat-10 gprbuild

- name: Check toolchain architecture
uses: mosteo-actions/gnat-toolchain-arch-checker@v1

- name: Set up gcc on the PATH to be gcc-10
run: |
mkdir -p $HOME/.local/bin
Expand Down Expand Up @@ -98,6 +101,12 @@ jobs:
- name: Rename AppImage
run: mv alr*AppImage alr.AppImage

- name: Test AppImage without the toolchain installed
run: |
chmod +x ./alr.AppImage
sudo apt-get remove -y gnat-10 gprbuild
which gnat || { echo "Toolchain purged"; ./alr.AppImage version; }
- name: Upload AppImage asset
if: (github.event_name == 'release')
uses: actions/upload-release-asset@v1
Expand Down
11 changes: 11 additions & 0 deletions .github/workflows/ci-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ jobs:
uses: alire-project/alr-install@v1
with:
crates: gnat_native gprbuild
prefix: alire_prefix

- name: Check toolchain architecture
uses: mosteo-actions/gnat-toolchain-arch-checker@v1

- name: Install Python 3.x (required for the testsuite)
uses: actions/setup-python@v2
Expand All @@ -47,6 +51,13 @@ jobs:
BRANCH: ${{ github.base_ref }}
INDEX: ""

# Ascertain whether alr can run without the toolchain that built it
- name: Check standalone alr
uses: mosteo-actions/alr-standalone-checker@v1
with:
alr_path: bin
toolchain_path: alire_prefix

- name: Upload binaries
uses: actions/upload-artifact@v4
with:
Expand Down
11 changes: 11 additions & 0 deletions .github/workflows/ci-macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ jobs:
uses: alire-project/alr-install@v1
with:
crates: gnat_native gprbuild
prefix: alire_prefix

- name: Install FSF toolchain (AArch64)
if: ${{ matrix.os == 'macos-14' }}
Expand All @@ -49,6 +50,9 @@ jobs:
echo $PWD/alire_prefix/bin >> $GITHUB_PATH
echo "ARCH=aarch64" >> $GITHUB_ENV
- name: Check toolchain architecture
uses: mosteo-actions/gnat-toolchain-arch-checker@v1

- name: Install Python 3.x (required for the testsuite)
uses: actions/setup-python@v2
with:
Expand All @@ -61,6 +65,13 @@ jobs:
BRANCH: ${{ github.base_ref }}
INDEX: ""

# Ascertain whether alr can run without the toolchain that built it
- name: Check standalone alr
uses: mosteo-actions/alr-standalone-checker@v1
with:
alr_path: bin
toolchain_path: alire_prefix

- name: Upload binaries
uses: actions/upload-artifact@v4
with:
Expand Down
11 changes: 11 additions & 0 deletions .github/workflows/ci-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ jobs:
uses: alire-project/alr-install@v1
with:
crates: gnat_native gprbuild
prefix: alire_prefix

- name: Check toolchain architecture
uses: mosteo-actions/gnat-toolchain-arch-checker@v1

- name: Build alr
run: gprbuild -j0 -p -P alr_env
Expand Down Expand Up @@ -66,6 +70,13 @@ jobs:
- name: Install alr
run: gprinstall -p -P alr_env --prefix=${{ runner.temp }}/alr_install

# Ascertain whether alr can run without the toolchain that built it
- name: Check standalone alr
uses: mosteo-actions/alr-standalone-checker@v1
with:
alr_path: bin
toolchain_path: alire_prefix

- name: Install qt-installer-framework in msys2
run: ${{env.PACMAN}} -S mingw64/mingw-w64-x86_64-qt-installer-framework

Expand Down
25 changes: 13 additions & 12 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,41 +21,42 @@ jobs:
fail-fast: false # Attempt to generate as many of them as possible
matrix:
os:
- macos-14
- macos-12
- macos-14
- ubuntu-20.04
- windows-latest

steps:
- name: Check out repository
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
submodules: true

- name: Install FSF toolchain
uses: alire-project/alr-install@v1
with:
crates: gnat_native gprbuild
prefix: alire_prefix

- name: Replace toolchain with aarch64
if: ${{ runner.arch == 'ARM64' }}
run: |
curl -L https://github.com/alire-project/GNAT-FSF-builds/releases/download/gnat-14.1.0-3/gnat-aarch64-darwin-14.1.0-3.tar.gz \
| tar xzf - --strip-components=1 -C /Users/runner/work/alire/alire/alire_prefix
curl -L https://github.com/alire-project/GNAT-FSF-builds/releases/download/gprbuild-24.0.0-1/gprbuild-aarch64-darwin-24.0.0-1.tar.gz \
| tar xzf - --strip-components=1 -C /Users/runner/work/alire/alire/alire_prefix
which gcc
gcc -v
- name: Check toolchain architecture
uses: mosteo-actions/gnat-toolchain-arch-checker@v1

- name: Install Python 3.x (required for the testsuite)
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: '3.x'

- name: Run test script
run: scripts/ci-github.sh
shell: bash

# Ascertain whether alr can run without the toolchain that built it
- name: Check standalone alr
uses: mosteo-actions/alr-standalone-checker@v1
with:
alr_path: bin
toolchain_path: alire_prefix

- name: Upload logs (if failed)
if: failure()
uses: actions/upload-artifact@v4
Expand Down
15 changes: 14 additions & 1 deletion scripts/ci-github.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,19 @@ fi
# Patch version
scripts/version-patcher.sh

# Use -static-libgcc only on macOS.
ALR_LINKER_ARGS=
if [ "$(get_OS)" == "macos" ]; then
ALR_LINKER_ARGS="-static-libgcc"
fi

# Build alr if no argument is "build=false"
if [[ " $* " == *" build=false "* ]]; then
echo "Skipping alr build, explicitly disabled via arguments"
else
export ALIRE_OS=$(get_OS)
gprbuild -j0 -p -P alr_env
echo "Using ALR_LINKER_ARGS=$ALR_LINKER_ARGS"
gprbuild -j0 -p -P alr_env -largs $ALR_LINKER_ARGS
fi

# Disable distro detection if supported
Expand Down Expand Up @@ -70,6 +77,12 @@ echo ALR SEARCH:
alr -q -d search --list --external
echo ............................

# Exit without testing if some argument is "test=false"
if [[ " $* " == *" test=false "* ]]; then
echo "SKIPPING testsuite, explicitly disabled via arguments"
exit 0
fi

echo TESTSUITE:
# Run e3.testsuite
echo
Expand Down

0 comments on commit dba60d1

Please sign in to comment.