github: Set the versions to build in scheduled builds via the GHA "env" field

For non scheduled builds, those env variables are just left empty.

This is much neater than using the "versions" file, and uses much
fewer lines of code.

We still probably want to bundle a file labelling what versions
it contains in the built packages though; give that file a
.txt suffix.
This commit is contained in:
Martin Storsjö committed 2023-04-25 09:58:25 +03:00
1 parent 18bd3665ac
commit 8d1d6f9947
2 files changed
+40 -59

No files matched your search

+27 -59
View File
@@ -38,20 +38,14 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: Set build env vars
if: github.event_name == 'schedule'
run: |
echo LLVM_VERSION=${{needs.get-versions.outputs.LLVM_VERSION}} >> versions
echo MINGW_W64_VERSION=${{needs.get-versions.outputs.MINGW_W64_VERSION}} >> versions
. versions
echo Building llvm-project $LLVM_VERSION mingw-w64 $MINGW_W64_VERSION
cat versions >> $GITHUB_ENV
mkdir -p install/llvm-mingw
cp versions install/llvm-mingw
- name: Build - name: Build
env:
LLVM_VERSION: ${{needs.get-versions.outputs.LLVM_VERSION}}
MINGW_W64_VERSION: ${{needs.get-versions.outputs.MINGW_W64_VERSION}}
run: | run: |
sudo apt-get update && sudo apt-get install ninja-build sudo apt-get update && sudo apt-get install ninja-build
./build-all.sh $(pwd)/install/llvm-mingw --disable-clang-tools-extra --disable-lldb ./build-all.sh $(pwd)/install/llvm-mingw --disable-clang-tools-extra --disable-lldb
.github/workflows/store-version.sh install/llvm-mingw/versions.txt
cd install cd install
tar -Jcf ../llvm-mingw-linux.tar.xz llvm-mingw tar -Jcf ../llvm-mingw-linux.tar.xz llvm-mingw
- uses: actions/upload-artifact@v3 - uses: actions/upload-artifact@v3
@@ -74,20 +68,14 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: Set build env vars
if: github.event_name == 'schedule'
run: |
echo LLVM_VERSION=${{needs.get-versions.outputs.LLVM_VERSION}} >> versions
echo MINGW_W64_VERSION=${{needs.get-versions.outputs.MINGW_W64_VERSION}} >> versions
. versions
echo Building llvm-project $LLVM_VERSION mingw-w64 $MINGW_W64_VERSION, with assertions enabled
cat versions >> $GITHUB_ENV
mkdir -p install/llvm-mingw
cp versions install/llvm-mingw
- name: Build - name: Build
env:
LLVM_VERSION: ${{needs.get-versions.outputs.LLVM_VERSION}}
MINGW_W64_VERSION: ${{needs.get-versions.outputs.MINGW_W64_VERSION}}
run: | run: |
sudo apt-get update && sudo apt-get install ninja-build sudo apt-get update && sudo apt-get install ninja-build
./build-all.sh $(pwd)/install/llvm-mingw --disable-clang-tools-extra --disable-lldb --enable-asserts ./build-all.sh $(pwd)/install/llvm-mingw --disable-clang-tools-extra --disable-lldb --enable-asserts
.github/workflows/store-version.sh install/llvm-mingw/versions.txt
cd install cd install
tar -Jcf ../llvm-mingw-linux.tar.xz llvm-mingw tar -Jcf ../llvm-mingw-linux.tar.xz llvm-mingw
- uses: actions/upload-artifact@v3 - uses: actions/upload-artifact@v3
@@ -103,16 +91,11 @@ jobs:
needs: [get-versions] needs: [get-versions]
runs-on: macos-latest runs-on: macos-latest
steps: steps:
- name: Set build env vars
if: github.event_name == 'schedule'
run: |
echo LLVM_VERSION=${{needs.get-versions.outputs.LLVM_VERSION}} >> versions
echo MINGW_W64_VERSION=${{needs.get-versions.outputs.MINGW_W64_VERSION}} >> versions
. versions
echo Building llvm-project $LLVM_VERSION mingw-w64 $MINGW_W64_VERSION
cat versions >> $GITHUB_ENV
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: Build - name: Build
env:
LLVM_VERSION: ${{needs.get-versions.outputs.LLVM_VERSION}}
MINGW_W64_VERSION: ${{needs.get-versions.outputs.MINGW_W64_VERSION}}
run: | run: |
brew install ninja brew install ninja
# Building with MACOS_REDIST=1 (building universal binaries) without # Building with MACOS_REDIST=1 (building universal binaries) without
@@ -121,6 +104,7 @@ jobs:
# Disable use of zstd too - it's also available, but only in native # Disable use of zstd too - it's also available, but only in native
# form. # form.
MACOS_REDIST=1 LLVM_CMAKEFLAGS="-DLLVM_ENABLE_ZSTD=OFF" ./build-all.sh $(pwd)/install/llvm-mingw --disable-clang-tools-extra --disable-lldb MACOS_REDIST=1 LLVM_CMAKEFLAGS="-DLLVM_ENABLE_ZSTD=OFF" ./build-all.sh $(pwd)/install/llvm-mingw --disable-clang-tools-extra --disable-lldb
.github/workflows/store-version.sh install/llvm-mingw/versions.txt
cd install cd install
tar -Jcf ../llvm-mingw-macos.tar.xz llvm-mingw tar -Jcf ../llvm-mingw-macos.tar.xz llvm-mingw
- uses: actions/upload-artifact@v3 - uses: actions/upload-artifact@v3
@@ -159,18 +143,14 @@ jobs:
toolchain:p toolchain:p
cmake:p cmake:p
ninja:p ninja:p
- name: Set build env vars
if: github.event_name == 'schedule'
run: |
echo LLVM_VERSION=${{needs.get-versions.outputs.LLVM_VERSION}} >> versions
echo MINGW_W64_VERSION=${{needs.get-versions.outputs.MINGW_W64_VERSION}} >> versions
. versions
echo Building llvm-project $LLVM_VERSION mingw-w64 $MINGW_W64_VERSION
cat versions >> $GITHUB_ENV
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: Build - name: Build
env:
LLVM_VERSION: ${{needs.get-versions.outputs.LLVM_VERSION}}
MINGW_W64_VERSION: ${{needs.get-versions.outputs.MINGW_W64_VERSION}}
run: | run: |
./build-all.sh $(pwd)/install/llvm-mingw --disable-clang-tools-extra --disable-lldb ./build-all.sh $(pwd)/install/llvm-mingw --disable-clang-tools-extra --disable-lldb
.github/workflows/store-version.sh install/llvm-mingw/versions.txt
./run-tests.sh $(pwd)/install/llvm-mingw ./run-tests.sh $(pwd)/install/llvm-mingw
# Use the Linux cross compilers built in the first step to cross compile # Use the Linux cross compilers built in the first step to cross compile
@@ -199,21 +179,15 @@ jobs:
sudo mv llvm-mingw /opt/llvm-mingw sudo mv llvm-mingw /opt/llvm-mingw
echo /opt/llvm-mingw/bin >> $GITHUB_PATH echo /opt/llvm-mingw/bin >> $GITHUB_PATH
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: Fetch version
if: github.event_name == 'schedule'
run: |
echo LLVM_VERSION=${{needs.get-versions.outputs.LLVM_VERSION}} >> versions
echo MINGW_W64_VERSION=${{needs.get-versions.outputs.MINGW_W64_VERSION}} >> versions
echo PYTHON_VERSION_MINGW=${{needs.get-versions.outputs.PYTHON_VERSION_MINGW}} >> versions
. versions
echo Building llvm-project $LLVM_VERSION mingw-w64 $MINGW_W64_VERSION cpython-mingw $PYTHON_VERSION_MINGW
cat versions >> $GITHUB_ENV
mkdir -p install/llvm-mingw-${{matrix.arch}}
cp versions install/llvm-mingw-${{matrix.arch}}
- name: Build - name: Build
env:
LLVM_VERSION: ${{needs.get-versions.outputs.LLVM_VERSION}}
MINGW_W64_VERSION: ${{needs.get-versions.outputs.MINGW_W64_VERSION}}
PYTHON_VERSION_MINGW: ${{needs.get-versions.outputs.PYTHON_VERSION_MINGW}}
run: | run: |
sudo apt-get update && sudo apt-get install autoconf-archive ninja-build sudo apt-get update && sudo apt-get install autoconf-archive ninja-build
./build-cross-tools.sh /opt/llvm-mingw $(pwd)/install/llvm-mingw-${{matrix.arch}} ${{matrix.arch}} --with-python ./build-cross-tools.sh /opt/llvm-mingw $(pwd)/install/llvm-mingw-${{matrix.arch}} ${{matrix.arch}} --with-python
.github/workflows/store-version.sh install/llvm-mingw-${{matrix.arch}}/versions.txt
cd install cd install
zip -9rq ../llvm-mingw-${{matrix.arch}}.zip llvm-mingw-${{matrix.arch}} zip -9rq ../llvm-mingw-${{matrix.arch}}.zip llvm-mingw-${{matrix.arch}}
- uses: actions/upload-artifact@v3 - uses: actions/upload-artifact@v3
@@ -295,12 +269,10 @@ jobs:
echo "c:\llvm-mingw\bin" | Out-File -FilePath $Env:GITHUB_PATH -Encoding utf8 -Append echo "c:\llvm-mingw\bin" | Out-File -FilePath $Env:GITHUB_PATH -Encoding utf8 -Append
echo "c:\llvm-mingw\python\bin" | Out-File -FilePath $Env:GITHUB_PATH -Encoding utf8 -Append echo "c:\llvm-mingw\python\bin" | Out-File -FilePath $Env:GITHUB_PATH -Encoding utf8 -Append
echo "PYTHON_EXE=c:/llvm-mingw/python/bin/python3.exe" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append echo "PYTHON_EXE=c:/llvm-mingw/python/bin/python3.exe" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
- name: Fetch version
if: github.event_name == 'schedule'
run: |
echo LLVM_VERSION=${{needs.get-versions.outputs.LLVM_VERSION}} | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: Checkout llvm-project - name: Checkout llvm-project
env:
LLVM_VERSION: ${{needs.get-versions.outputs.LLVM_VERSION}}
run: | run: |
bash -c "CHECKOUT_ONLY=1 ./build-llvm.sh" bash -c "CHECKOUT_ONLY=1 ./build-llvm.sh"
- name: Build and test libcxx - name: Build and test libcxx
@@ -352,12 +324,10 @@ jobs:
echo "c:\llvm-mingw\bin" | Out-File -FilePath $Env:GITHUB_PATH -Encoding utf8 -Append echo "c:\llvm-mingw\bin" | Out-File -FilePath $Env:GITHUB_PATH -Encoding utf8 -Append
echo "c:\llvm-mingw\python\bin" | Out-File -FilePath $Env:GITHUB_PATH -Encoding utf8 -Append echo "c:\llvm-mingw\python\bin" | Out-File -FilePath $Env:GITHUB_PATH -Encoding utf8 -Append
echo "PYTHON_EXE=c:/llvm-mingw/python/bin/python3.exe" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append echo "PYTHON_EXE=c:/llvm-mingw/python/bin/python3.exe" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
- name: Fetch version
if: github.event_name == 'schedule'
run: |
echo LLVM_VERSION=${{needs.get-versions.outputs.LLVM_VERSION}} | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: Checkout llvm-project - name: Checkout llvm-project
env:
LLVM_VERSION: ${{needs.get-versions.outputs.LLVM_VERSION}}
run: | run: |
bash -c "CHECKOUT_ONLY=1 ./build-llvm.sh" bash -c "CHECKOUT_ONLY=1 ./build-llvm.sh"
- name: Build test executables - name: Build test executables
@@ -416,12 +386,10 @@ jobs:
echo "c:\llvm-mingw\bin" | Out-File -FilePath $Env:GITHUB_PATH -Encoding utf8 -Append echo "c:\llvm-mingw\bin" | Out-File -FilePath $Env:GITHUB_PATH -Encoding utf8 -Append
echo "c:\llvm-mingw\python\bin" | Out-File -FilePath $Env:GITHUB_PATH -Encoding utf8 -Append echo "c:\llvm-mingw\python\bin" | Out-File -FilePath $Env:GITHUB_PATH -Encoding utf8 -Append
echo "PYTHON_EXE=c:/llvm-mingw/python/bin/python3.exe" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append echo "PYTHON_EXE=c:/llvm-mingw/python/bin/python3.exe" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
- name: Fetch version
if: github.event_name == 'schedule'
run: |
echo LLVM_VERSION=${{needs.get-versions.outputs.LLVM_VERSION}} | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: Checkout llvm-project - name: Checkout llvm-project
env:
LLVM_VERSION: ${{needs.get-versions.outputs.LLVM_VERSION}}
run: | run: |
git config --global core.autocrlf false git config --global core.autocrlf false
bash -c "CHECKOUT_ONLY=1 ./build-llvm.sh" bash -c "CHECKOUT_ONLY=1 ./build-llvm.sh"
+13
View File
@@ -0,0 +1,13 @@
#!/bin/sh
OUT="$1"
if [ -n "$LLVM_VERSION" ]; then
echo "Nightly $(TZ=UTC date +%Y-%m-%d)" >> $OUT
for i in LLVM_VERSION MINGW_W64_VERSION PYTHON_VERSION_MINGW; do
eval val=\"\$$i\"
if [ -n "$val" ]; then
echo "$i=$val" >> $OUT
fi
done
fi