Build binaries #1481
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on: | |
push: | |
tags: | |
- 2*.*.* | |
workflow_dispatch: | |
name: Build binaries | |
env: | |
DEFAULT_TAG: 24.0.999 | |
jobs: | |
build: | |
name: Build and deploy | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [macos-12, macos-14, ubuntu-20.04, windows-latest] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Setup Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10' | |
- name: Initialize TAG and git autocrlf | |
shell: bash | |
run: | | |
git config --global core.autocrlf input | |
if [[ ${GITHUB_REF##*/} = 2*.[0-9]*.[0-9]* ]]; then | |
echo "TAG=${GITHUB_REF##*/}" >> $GITHUB_ENV | |
else | |
echo "TAG=$DEFAULT_TAG" >> $GITHUB_ENV | |
fi | |
- name: Force Alire use preinstalled MSYS2 | |
shell: bash | |
if: ${{ runner.os == 'Windows' }} | |
run: | | |
mkdir -p ~/.config/alire | |
echo '[msys2]' >> ~/.config/alire/config.toml | |
echo 'install_dir = "C:\\msys64"' >> ~/.config/alire/config.toml | |
- name: Get als | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Get GNAT toolchain with alire | |
shell: bash | |
run: | | |
# alire-project/setup-alire works for ARM64 Mac OS X now. Shall we use it? | |
if [[ "$RUNNER_ARCH" == ARM64 ]] ; then | |
ZIP=v2.0.2/alr-2.0.2-bin-aarch64-${RUNNER_OS}.zip | |
else | |
ZIP=v2.0.2/alr-2.0.2-bin-x86_64-${RUNNER_OS}.zip | |
fi | |
curl -L -O https://github.com/alire-project/alire/releases/download/$ZIP | |
unzip $(basename $ZIP) | |
bin/alr index --reset-community | |
bin/alr toolchain --select gnat_native gprbuild | |
echo $PWD/bin >> $GITHUB_PATH | |
- name: Get cross GNAT toolchain (Linux) | |
if: ${{ runner.os == 'Linux' }} | |
env: | |
AWS_ACCESS_KEY_ID: ${{secrets.GHA_CACHE_ACCESS_KEY_ID}} | |
AWS_SECRET_ACCESS_KEY: ${{secrets.GHA_CACHE_SECRET}} | |
AWS_DEFAULT_REGION: eu-west-1 | |
run: | | |
sudo apt install -y libc6-dev-arm64-cross linux-libc-dev-arm64-cross binutils-aarch64-linux-gnu | |
aws s3 cp s3://adacore-gha-tray-eu-west-1/toolchain/aarch64-Linux-gcc-14.2.tar.bz2 . --sse=AES256 | |
aws s3 cp s3://adacore-gha-tray-eu-west-1/toolchain/aarch64-Linux-gmp-6.2.1.tar.bz2 . --sse=AES256 | |
sudo tar xjf aarch64-Linux-gcc-14.2.tar.bz2 -C / | |
sudo tar xjf aarch64-Linux-gmp-6.2.1.tar.bz2 -C / | |
- name: Fetch dependency commits numbers | |
shell: bash | |
if: ${{ env.TAG != env.DEFAULT_TAG }} | |
run: | | |
# For tags `actions/checkout@v2` action fetches a tag's commit, but | |
# not the tag annotation itself. Let's refetch the tag from origin. | |
# This makes `git show --no-patch --format=%n $TAG` work again. | |
git tag --delete $TAG | |
git fetch --tags | |
git show --no-patch --format=%n $TAG > deps.txt | |
- name: Build | |
shell: bash | |
run: | | |
alr settings --global --set dependencies.shared false | |
pip3 install e3-testsuite | |
scripts/build_als.sh all "$TAG" | |
- name: Build ALS with cross (Linux) | |
if: ${{ runner.os == 'Linux' }} | |
run: | | |
if alr exec -- gprconfig --show-targets | grep aarch64-linux; then | |
export GPRBUILD_EXTRA=--target=aarch64-linux | |
export NODE_ARCH_PLATFORM=arm64/linux | |
find . -name '*.ali' -delete | |
find . -name '*.[ao]' -delete | |
scripts/build_als.sh build_als "$TAG" arm64/linux | |
scripts/build_als.sh strip_debug "$TAG" arm64/linux | |
else | |
echo "No AArch64 cross compiler found:" | |
alr exec -- gprconfig --show-targets || true | |
fi | |
- name: Archive ALS binary | |
uses: actions/upload-artifact@v4 | |
with: | |
name: als-${{ matrix.os }} | |
# We know that only one of the following entries will match on a given | |
# run, so we use globs here to try to avoid warnings on unmatched | |
# entries | |
path: | | |
integration/vscode/ada/arm* | |
integration/vscode/ada/x64* | |
- name: Upload release | |
shell: bash | |
if: ${{ env.TAG != env.DEFAULT_TAG }} | |
run: | | |
.github/workflows/release.sh "${{ secrets.GITHUB_TOKEN }}" $TAG "" | |
if [ -f integration/vscode/ada/arm64/linux/ada_language_server ] ; then | |
.github/workflows/release.sh "${{ secrets.GITHUB_TOKEN }}" $TAG arm64/linux | |
fi | |
- name: Package | |
shell: bash | |
run: | | |
.github/workflows/pack-binaries.sh "$TAG" | |
- name: Archive VSIX binary | |
uses: actions/upload-artifact@v4 | |
with: | |
name: vsix-${{ matrix.os }} | |
path: "*.vsix" | |
- name: Upload result to AWS | |
shell: bash | |
if: ${{ github.repository == 'AdaCore/ada_language_server' && startsWith(matrix.os, 'macos-') }} | |
env: | |
AWS_ACCESS_KEY_ID: ${{secrets.GHA_PUBLISH_ACCESS_KEY_ID}} | |
AWS_SECRET_ACCESS_KEY: ${{secrets.GHA_PUBLISH_SECRET}} | |
AWS_DEFAULT_REGION: eu-west-1 | |
run: | | |
for FILE in *.vsix ; do | |
aws s3 cp ${FILE} s3://als-publish-adacore-eu-west-1/vscode-extension/${TAG}/ --sse=AES256 | |
done | |
aws s3 ls s3://als-publish-adacore-eu-west-1/vscode-extension/${TAG}/ |