From c5f1ea206647b087a240cf15c1b57a604ac02b8c Mon Sep 17 00:00:00 2001 From: "Alejandro R. Mosteo" Date: Sat, 12 Oct 2024 10:11:57 +0200 Subject: [PATCH] Enable aarch64 builds --- .../{ => disabled}/cache-minimal.yml | 0 .github/workflows/selftest.yml | 47 ++++++++++++++----- .github/workflows/test-cache.yml | 13 ++--- README.md | 6 +-- action.yml | 18 ++++--- lib/main.js | 11 ++++- src/main.ts | 12 ++++- 7 files changed, 74 insertions(+), 33 deletions(-) rename .github/workflows/{ => disabled}/cache-minimal.yml (100%) diff --git a/.github/workflows/cache-minimal.yml b/.github/workflows/disabled/cache-minimal.yml similarity index 100% rename from .github/workflows/cache-minimal.yml rename to .github/workflows/disabled/cache-minimal.yml diff --git a/.github/workflows/selftest.yml b/.github/workflows/selftest.yml index fbce260b..c8f8c5e2 100644 --- a/.github/workflows/selftest.yml +++ b/.github/workflows/selftest.yml @@ -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' @@ -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 diff --git a/.github/workflows/test-cache.yml b/.github/workflows/test-cache.yml index 86fcf296..003c042e 100644 --- a/.github/workflows/test-cache.yml +++ b/.github/workflows/test-cache.yml @@ -1,13 +1,8 @@ -# 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: @@ -15,11 +10,13 @@ jobs: 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: '' @@ -32,7 +29,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 # This might hit cache diff --git a/README.md b/README.md index cf2d540b..69928686 100644 --- a/README.md +++ b/README.md @@ -8,12 +8,12 @@ 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" ``` @@ -21,7 +21,7 @@ To use a precompiled nightly build of the development version, use the following 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 ``` diff --git a/action.yml b/action.yml index 2dae233d..29b5665f 100644 --- a/action.yml +++ b/action.yml @@ -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). @@ -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 diff --git a/lib/main.js b/lib/main.js index 8054dcf2..6cb684ab 100644 --- a/lib/main.js +++ b/lib/main.js @@ -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) { diff --git a/src/main.ts b/src/main.ts index 5f9d75bc..6eb947a0 100644 --- a/src/main.ts +++ b/src/main.ts @@ -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; }