Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable aarch64 builds #82

Merged
merged 1 commit into from
Oct 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
19 changes: 11 additions & 8 deletions .github/workflows/test-cache.yml
Original file line number Diff line number Diff line change
@@ -1,38 +1,41 @@
# 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: ''
- version: 'nightly'
branch: ''
- version: ''
branch: 'master'
# Exclude combos that do not make sense (we dont have aarm64 for 1.2.2)
exclude:
- os: macos-14
config: {version: '1.2.2', branch: ''}
- os: macos-latest
config: {version: '1.2.2', branch: ''}

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

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
20 changes: 12 additions & 8 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,21 +113,25 @@ 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
run: |
alr install gnat_native^13 gprbuild^22 --prefix=$PWD/setup_alire_prefix
alr install gnat_native gprbuild --prefix=$PWD/setup_alire_prefix
echo REMOVAL TARGET: $(which alr)
rm -rf tmp_alr && echo REMOVED stable alr used for toolchain install

Expand Down
13 changes: 11 additions & 2 deletions lib/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,22 +82,31 @@ function install_branch(branch) {
process.env.ALIRE_OS = "unknown";
break;
}
yield exec.exec(`gprbuild -j0 -p -P alr_env.gpr -cargs -fPIC`);
yield exec.exec(`gprbuild -j0 -p -P alr_env.gpr -cargs -fPIC -largs -static-libgcc`);
process.chdir(start_path);
});
}
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
14 changes: 12 additions & 2 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ async function install_branch(branch : string) {
break;
}

await exec.exec(`gprbuild -j0 -p -P alr_env.gpr -cargs -fPIC`);
await exec.exec(`gprbuild -j0 -p -P alr_env.gpr -cargs -fPIC -largs -static-libgcc`);
process.chdir(start_path)
}

Expand All @@ -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
Loading