Skip to content

Commit a4d1341

Browse files
committed
Use Alire to build ALS on GitHub
Ref #1387
1 parent 47fd3fb commit a4d1341

25 files changed

+815
-401
lines changed

.github/workflows/build-binaries.sh

-169
This file was deleted.

.github/workflows/build-binaries.yml

+48-110
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,19 @@
11
on:
22
push:
3-
branches:
4-
- edge
53
tags:
64
- 2*.*.*
5+
workflow_dispatch:
6+
77
name: Build binaries
88
env:
99
DEFAULT_TAG: 24.0.999
10-
AWS_DEFAULT_REGION: eu-west-1
1110
jobs:
1211
build:
1312
name: Build and deploy
1413
strategy:
1514
fail-fast: false
16-
matrix: # Build debug and/or production
17-
debug: [''] # '' if production, 'debug' for debug
18-
os: [macos-11, ubuntu-20.04, windows-latest]
19-
cross: ['', aarch64]
20-
exclude:
21-
- os: windows-latest
22-
cross: aarch64
15+
matrix:
16+
os: [macos-12, macos-14, ubuntu-20.04, windows-latest]
2317
runs-on: ${{ matrix.os }}
2418
steps:
2519
- name: Setup Python
@@ -35,128 +29,72 @@ jobs:
3529
else
3630
echo "TAG=$DEFAULT_TAG" >> $GITHUB_ENV
3731
fi
38-
- name: Install cross toolchain (Linux)
39-
if: ${{ matrix.cross != '' && runner.os == 'Linux' }}
40-
env:
41-
AWS_ACCESS_KEY_ID: ${{secrets.GHA_CACHE_ACCESS_KEY_ID}}
42-
AWS_SECRET_ACCESS_KEY: ${{secrets.GHA_CACHE_SECRET}}
43-
AWS_DEFAULT_REGION: eu-west-1
44-
run: |
45-
sudo apt install -y libc6-dev-arm64-cross linux-libc-dev-arm64-cross binutils-aarch64-linux-gnu
46-
aws s3 cp s3://adacore-gha-tray-eu-west-1/toolchain/${{ matrix.cross }}-${{ runner.os }}-gcc-13.2.tar.bz2 . --sse=AES256
47-
aws s3 cp s3://adacore-gha-tray-eu-west-1/toolchain/${{ matrix.cross }}-${{ runner.os }}-gmp-6.2.1.tar.bz2 . --sse=AES256
48-
sudo tar xjf ${{ matrix.cross }}-${{ runner.os }}-gcc-13.2.tar.bz2 -C /
49-
sudo tar xjf ${{ matrix.cross }}-${{ runner.os }}-gmp-6.2.1.tar.bz2 -C /
50-
- name: Install cross toolchain (MacOS)
51-
if: ${{ matrix.cross != '' && runner.os != 'Linux' }}
52-
env:
53-
AWS_ACCESS_KEY_ID: ${{secrets.GHA_CACHE_ACCESS_KEY_ID}}
54-
AWS_SECRET_ACCESS_KEY: ${{secrets.GHA_CACHE_SECRET}}
55-
AWS_DEFAULT_REGION: eu-west-1
56-
run: |
57-
aws s3 cp s3://adacore-gha-tray-eu-west-1/toolchain/${{ matrix.cross }}-${{ runner.os }}-gcc-13.2.tar.bz2 . --sse=AES256
58-
aws s3 cp s3://adacore-gha-tray-eu-west-1/toolchain/${{ matrix.cross }}-${{ runner.os }}-gmp-6.2.1.tar.bz2 . --sse=AES256
59-
sudo tar xjf ${{ matrix.cross }}-${{ runner.os }}-gcc-13.2.tar.bz2 --strip-components=3 -C /usr/local
60-
sudo tar xjf ${{ matrix.cross }}-${{ runner.os }}-gmp-6.2.1.tar.bz2 --strip-components=3 -C /usr/local
6132
- name: Force Alire use preinstalled MSYS2
6233
shell: bash
6334
if: ${{ runner.os == 'Windows' }}
6435
run: |
6536
mkdir -p ~/.config/alire
6637
echo '[msys2]' >> ~/.config/alire/config.toml
6738
echo 'install_dir = "C:\\msys64"' >> ~/.config/alire/config.toml
68-
- name: Install iconv and gmp (Windows only)
69-
run: pacman --noconfirm -S mingw64/mingw-w64-x86_64-libiconv mingw64/mingw-w64-x86_64-gmp
70-
if: ${{ runner.os == 'Windows' }}
71-
shell: c:\msys64\usr\bin\bash.exe -l -e -o pipefail {0}
72-
env:
73-
MSYSTEM: MINGW64
7439
- name: Get als
7540
uses: actions/checkout@v3
7641
with:
7742
fetch-depth: 0
78-
- name: Get Spawn
79-
uses: actions/checkout@v3
80-
with:
81-
repository: AdaCore/spawn
82-
path: subprojects/spawn
83-
- name: Get LAL_Tools
84-
uses: actions/checkout@v3
85-
with:
86-
repository: AdaCore/libadalang-tools
87-
path: subprojects/libadalang-tools
88-
- name: Get Templates Parser
89-
uses: actions/checkout@v3
90-
with:
91-
repository: AdaCore/templates-parser
92-
path: subprojects/templates-parser
93-
- name: Get GNATdoc
94-
uses: actions/checkout@v3
95-
with:
96-
repository: AdaCore/gnatdoc
97-
path: subprojects/gnatdoc
98-
ref: edge
99-
- name: Get LAL Refactor
100-
uses: actions/checkout@v3
101-
with:
102-
repository: AdaCore/lal-refactor
103-
path: subprojects/lal-refactor
104-
ref: edge
105-
- uses: actions/cache@v3
106-
with:
107-
path: ./cached_gnat
108-
key: ${{ runner.os }}-alire-2023
109-
restore-keys: ${{ runner.os }}-alire-2023
110-
- name: Get GNAT toolchain with alire
111-
uses: alire-project/setup-alire@v2
43+
- name: Get GNAT toolchain with alire (AArch64)
44+
if: ${{ matrix.os == 'macos-14' }}
45+
run: |
46+
# alire-project/setup-alire doesn't work for ARM64 Mac OS X for now.
47+
# https://github.com/alire-project/setup-alire/pull/74
48+
curl -L -O https://github.com/alire-project/alire/releases/download/nightly/alr-nightly-bin-aarch64-macos.zip
49+
unzip alr-nightly-bin-aarch64-macos.zip
50+
bin/alr index --reset-community
51+
bin/alr toolchain --select gnat_native^14 gprbuild
52+
echo $PWD/bin >> $GITHUB_PATH
53+
- name: Get GNAT toolchain with alire (x86_64)
54+
if: ${{ matrix.os != 'macos-14' }}
55+
uses: alire-project/setup-alire@v3
11256
with:
113-
toolchain: gnat_native^13 gprbuild^22
114-
toolchain_dir: ./cached_gnat
57+
toolchain: gnat_native^14 gprbuild
11558
- name: Build
11659
shell: bash
117-
env:
118-
AWS_ACCESS_KEY_ID: ${{secrets.GHA_CACHE_ACCESS_KEY_ID}}
119-
AWS_SECRET_ACCESS_KEY: ${{secrets.GHA_CACHE_SECRET}}
12060
run: |
121-
# This is to avoid locking .sh on win that prevents its updating
122-
cp .github/workflows/build-binaries.sh .github/workflows/build-binaries.sh_
123-
.github/workflows/build-binaries.sh_ "${{ matrix.debug }}" ${{ runner.os }} ${{ env.TAG }} "" "${{ matrix.cross }}"
61+
alr settings --global --set dependencies.shared false
62+
pip3 install e3-testsuite
63+
scripts/build_als.sh all "$TAG"
12464
- name: Archive ALS binary
125-
if: ${{ github.event_name == 'push' }}
126-
uses: actions/upload-artifact@v3
65+
uses: actions/upload-artifact@v4
12766
with:
128-
name: als-${{ runner.os }}-${{ matrix.debug }}${{ matrix.cross }}
67+
name: als-${{ matrix.os }}
12968
# We know that only one of the following entries will match on a given
13069
# run, so we use globs here to try to avoid warnings on unmatched
13170
# entries
13271
path: |
13372
integration/vscode/ada/arm*
13473
integration/vscode/ada/x64*
135-
package:
136-
if: ${{ github.event_name == 'push' }}
137-
needs: build
138-
runs-on: ubuntu-latest
139-
steps:
140-
- name: Get als
141-
uses: actions/checkout@v3
142-
with:
143-
fetch-depth: 0
144-
- name: Download all workflow run artifacts
145-
uses: actions/download-artifact@v3
146-
- name: Pack vscode extension
74+
commits.txt
75+
- name: Upload release
76+
shell: bash
77+
if: ${{ env.TAG != env.DEFAULT_TAG }}
14778
run: |
148-
if [[ ${GITHUB_REF##*/} = 2*.[0-9]*.[0-9]* ]]; then
149-
TAG="${GITHUB_REF##*/}"
150-
.github/workflows/release.sh "" "${{ secrets.GITHUB_TOKEN }}" $TAG
151-
# .github/workflows/release.sh "debug" "${{ secrets.GITHUB_TOKEN }}" $TAG
152-
else
153-
TAG="$DEFAULT_TAG"
154-
fi
155-
echo "TAG=$TAG" >> $GITHUB_ENV
156-
.github/workflows/pack-binaries.sh "" "${{secrets.VSCE_TOKEN}}" "${{secrets.OPENVSX_TOKEN}}" $TAG
157-
# .github/workflows/pack-binaries.sh "debug" "${{secrets.VSCE_TOKEN}}" "${{secrets.OPENVSX_TOKEN}}" $TAG
158-
- name: Archive ALS vsix
159-
uses: actions/upload-artifact@v3
79+
.github/workflows/release.sh "${{ secrets.GITHUB_TOKEN }}" $TAG ""
80+
- name: Package
81+
shell: bash
82+
run: |
83+
.github/workflows/pack-binaries.sh "$TAG"
84+
- name: Archive VSIX binary
85+
uses: actions/upload-artifact@v4
16086
with:
161-
name: als-vsix-${{ matrix.debug }}${{ env.TAG }}
162-
path: '*.vsix'
87+
name: vsix-${{ matrix.os }}
88+
path: "*.vsix"
89+
- name: Upload result to AWS
90+
shell: bash
91+
if: ${{ github.repository == 'AdaCore/ada_language_server' && startsWith(matrix.os, 'macos-') }}
92+
env:
93+
AWS_ACCESS_KEY_ID: ${{secrets.GHA_PUBLISH_ACCESS_KEY_ID}}
94+
AWS_SECRET_ACCESS_KEY: ${{secrets.GHA_PUBLISH_SECRET}}
95+
AWS_DEFAULT_REGION: eu-west-1
96+
run: |
97+
for FILE in *.vsix ; do
98+
aws s3 cp ${FILE} s3://adacore-gha-tray-eu-west-1/vscode-extension/${TAG}/ --sse=AES256
99+
done
100+
aws s3 ls s3://adacore-gha-tray-eu-west-1/vscode-extension/${TAG}/

0 commit comments

Comments
 (0)