Skip to content

Commit

Permalink
Enable aarch64 builds
Browse files Browse the repository at this point in the history
  • Loading branch information
mosteo committed Oct 12, 2024
1 parent b607671 commit c5f1ea2
Show file tree
Hide file tree
Showing 7 changed files with 74 additions and 33 deletions.
File renamed without changes.
47 changes: 34 additions & 13 deletions .github/workflows/selftest.yml
Original file line number Diff line number Diff line change
@@ -1,52 +1,63 @@
# Changes to the v2 branch must be proposed via PRs in the branch
# v2-next. This way we can check the action just as GHA is going to
# use it.

name: Selftest

on:
pull_request:
# branches:
# - disabled
workflow_dispatch:

jobs:
setup-alire:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-12, macos-14, windows-latest]
target: [stable, nightly, source]
os:
- macos-12
- macos-14
- macos-latest
- ubuntu-latest
- windows-latest
target:
- nightly
- source
- stable

runs-on: ${{ matrix.os }}

steps:

- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Setup stable
uses: ./ # This uses the action code in the current PR
if: matrix.target == 'stable'
uses: ./ # This uses the action code in the current PR
with:
cache: false
# We test without cache, as caching is tested in a separate workflow.
# This way we make sure the cache isn't hiding any issue.

- name: Setup nightly
uses: ./
if: matrix.target == 'nightly'
uses: ./
with:
version: nightly
cache: false

- name: Setup from source (master)
uses: ./
if: matrix.target == 'source'
uses: ./
with:
branch: master
cache: false

# Verify proper builds
# Check alr and default toolchains
- run: alr -n version
- run: |
alr -n init --bin alrws
cd alrws
alr exec -- gnat --version
alr exec -- gprbuild --version
# Verify proper OS

- run: alr -n version | grep "os:" | grep LINUX
if: matrix.os == 'ubuntu-latest'
Expand All @@ -59,3 +70,13 @@ jobs:
- run: alr -n version | grep "os:" | grep WINDOWS
if: matrix.os == 'windows-latest'
shell: bash

# Verify proper architecture

- run: alr -n version | grep "arch:" | grep X86_64
if: runner.arch == 'X64'
shell: bash

- run: alr -n version | grep "arch:" | grep AARCH64
if: runner.arch == 'ARM64'
shell: bash
13 changes: 5 additions & 8 deletions .github/workflows/test-cache.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,22 @@
# Changes to the v2 branch must be proposed via PRs in the branch
# v3-next. This way we can check the action just as GHA is going to
# use it.

name: Test cache

on:
pull_request:
# branches:
# - disabled
workflow_dispatch:

jobs:
test-cache:
strategy:
fail-fast: false
matrix:
os:
- macos-12
- macos-14
- macos-latest
- ubuntu-latest
- windows-latest
config:
- version: '2.0.1'
- version: '2.0.2'
branch: ''
- version: '1.2.2'
branch: ''
Expand All @@ -32,7 +29,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4

# This might hit cache

Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,20 @@ Version v2 adds caching to speed up deployment, particularly on Windows.

To use the latest stable release of the Alire project, add this line to your workflow steps:
```yaml
- uses: alire-project/setup-alire@v2
- uses: alire-project/setup-alire@v3
```
To use a precompiled nightly build of the development version, use the following:
```yaml
- uses: alire-project/setup-alire@v2
- uses: alire-project/setup-alire@v3
with:
version: "nightly"
```
To use a development version compiled from sources (if you known what
you are doing), use the following:
```yaml
- uses: alire-project/setup-alire@v2
- uses: alire-project/setup-alire@v3
with:
branch: "master" # or the branch you want to use
```
Expand Down
18 changes: 11 additions & 7 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ inputs:
version:
description: Use this argument to install a stable or nightly release. Use a version number without v prefix, e.g., 1.0.1, 1.1.0, or 'nightly'. This argument will be ignored if a branch argument is supplied. Defaults to the latest stable release.
required: false
default: '2.0.1'
default: '2.0.2'
# Also to be updated in test-cache-yml
branch:
description: Use this argument to install a development branch (e.g., master).
Expand Down Expand Up @@ -113,16 +113,20 @@ runs:
shell: bash
run: |
os_lower=$(echo "${{ runner.os }}" | tr '[:upper:]' '[:lower:]')
alr_version=2.0.1
curl -L -O https://github.com/alire-project/alire/releases/download/v${alr_version}/alr-${alr_version}-bin-x86_64-${os_lower}.zip
unzip -o alr-${alr_version}-bin-x86_64-${os_lower}.zip "bin/alr*" -d tmp_alr
rm alr-${alr_version}-bin-x86_64-${os_lower}.zip
case "${{ runner.arch }}" in
ARM64) arch=aarch64;;
X64) arch=x86_64;;
*) echo "Unknown arch: ${{runner.arch}}"; exit 1;;
esac
alr_version=2.0.2
alr_filename=alr-${alr_version}-bin-${arch}-${os_lower}.zip
curl -L -O https://github.com/alire-project/alire/releases/download/v${alr_version}/${alr_filename}
unzip -o ${alr_filename} "bin/alr*" -d tmp_alr
rm ${alr_filename}
echo "$(pwd -W 2>/dev/null || pwd)/tmp_alr/bin" >> $GITHUB_PATH
# Perform the actual `alr install` and remove the `alr` just used to avoid
# conflicts with the `alr` being built.
# TODO: we use gnat^13 because there seems to be some trouble with gnat^14
# on macOS. Revisit this when the issue is resolved.
- name: Install GNAT (II)
if: steps.need-GNAT.outputs.need == 'true'
shell: bash
Expand Down
11 changes: 10 additions & 1 deletion lib/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,14 +90,23 @@ function install_release(version) {
return __awaiter(this, void 0, void 0, function* () {
const base_url = "https://github.com/alire-project/alire/releases/download";
console.log(`Deploying alr version [${version}]`);
var arch;
var infix;
var platform;
switch (process.arch) {
case 'arm64':
arch = "aarch64";
break;
default:
arch = "x86_64";
break;
}
switch (version) {
case '1.0.1':
infix = "bin";
break;
default:
infix = "bin-x86_64";
infix = `bin-${arch}`;
break;
}
switch (process.platform) {
Expand Down
12 changes: 11 additions & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,25 @@ async function install_release(version : string) {

console.log(`Deploying alr version [${version}]`)

var arch : string;
var infix : string;
var platform : string;

switch (process.arch) {
case 'arm64':
arch = "aarch64";
break;
default:
arch = "x86_64";
break;
}

switch(version) {
case '1.0.1':
infix = "bin";
break;
default:
infix = "bin-x86_64";
infix = `bin-${arch}`;
break;
}

Expand Down

0 comments on commit c5f1ea2

Please sign in to comment.