github: Use job outputs instead of a "versions" artifact/file
This is more idiomatic, requires fewer lines of code and doesn't require passing an actual file along (unless we want to).
This commit is contained in:
1 parent
f0b14f9e20
commit
18bd3665ac
1 file changed
+30
-39
+30
-39
@@ -17,23 +17,19 @@ jobs:
|
||||
get-versions:
|
||||
if: (github.event_name != 'schedule') || (github.repository == 'mstorsjo/llvm-mingw')
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
LLVM_VERSION: ${{steps.get-versions.outputs.LLVM_VERSION}}
|
||||
MINGW_W64_VERSION: ${{steps.get-versions.outputs.MINGW_W64_VERSION}}
|
||||
PYTHON_VERSION_MINGW: ${{steps.get-versions.outputs.PYTHON_VERSION_MINGW}}
|
||||
steps:
|
||||
- name: Touch file
|
||||
run: |
|
||||
touch versions
|
||||
- name: Check latest version
|
||||
if: github.event_name == 'schedule'
|
||||
id: get-versions
|
||||
run: |
|
||||
echo LLVM_VERSION=$(git ls-remote https://github.com/llvm/llvm-project.git | grep 'refs/heads/main$' | awk '{print $1}') >> versions
|
||||
echo MINGW_W64_VERSION=$(git ls-remote https://github.com/mingw-w64/mingw-w64.git | grep 'refs/heads/master$' | awk '{print $1}') >> versions
|
||||
echo PYTHON_VERSION_MINGW=$(git ls-remote https://github.com/msys2-contrib/cpython-mingw.git | grep 'refs/heads/mingw-v3.10.9$' | awk '{print $1}') >> versions
|
||||
cat versions
|
||||
- uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: versions
|
||||
path: |
|
||||
versions
|
||||
retention-days: 7
|
||||
echo LLVM_VERSION=$(git ls-remote https://github.com/llvm/llvm-project.git | grep 'refs/heads/main$' | awk '{print $1}') >> $GITHUB_OUTPUT
|
||||
echo MINGW_W64_VERSION=$(git ls-remote https://github.com/mingw-w64/mingw-w64.git | grep 'refs/heads/master$' | awk '{print $1}') >> $GITHUB_OUTPUT
|
||||
echo PYTHON_VERSION_MINGW=$(git ls-remote https://github.com/msys2-contrib/cpython-mingw.git | grep 'refs/heads/mingw-v3.10.9$' | awk '{print $1}') >> $GITHUB_OUTPUT
|
||||
cat $GITHUB_OUTPUT
|
||||
|
||||
# Build a cross compiler for Linux, targeting Windows.
|
||||
linux:
|
||||
@@ -42,13 +38,11 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/download-artifact@v3
|
||||
if: github.event_name == 'schedule'
|
||||
with:
|
||||
name: versions
|
||||
- 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
|
||||
@@ -80,13 +74,11 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/download-artifact@v3
|
||||
if: github.event_name == 'schedule'
|
||||
with:
|
||||
name: versions
|
||||
- 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
|
||||
@@ -111,13 +103,11 @@ jobs:
|
||||
needs: [get-versions]
|
||||
runs-on: macos-latest
|
||||
steps:
|
||||
- uses: actions/download-artifact@v3
|
||||
if: github.event_name == 'schedule'
|
||||
with:
|
||||
name: versions
|
||||
- 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
|
||||
@@ -169,13 +159,11 @@ jobs:
|
||||
toolchain:p
|
||||
cmake:p
|
||||
ninja:p
|
||||
- uses: actions/download-artifact@v3
|
||||
if: github.event_name == 'schedule'
|
||||
with:
|
||||
name: versions
|
||||
- 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
|
||||
@@ -190,7 +178,7 @@ jobs:
|
||||
# architectures). The binaries built here match actual releases quite closely.
|
||||
linux-cross:
|
||||
if: (github.event_name != 'schedule') || (github.repository == 'mstorsjo/llvm-mingw')
|
||||
needs: [linux]
|
||||
needs: [linux, get-versions]
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
@@ -214,11 +202,14 @@ jobs:
|
||||
- name: Fetch version
|
||||
if: github.event_name == 'schedule'
|
||||
run: |
|
||||
. /opt/llvm-mingw/versions
|
||||
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 /opt/llvm-mingw/versions >> $GITHUB_ENV
|
||||
cat versions >> $GITHUB_ENV
|
||||
mkdir -p install/llvm-mingw-${{matrix.arch}}
|
||||
cp /opt/llvm-mingw/versions install/llvm-mingw-${{matrix.arch}}
|
||||
cp versions install/llvm-mingw-${{matrix.arch}}
|
||||
- name: Build
|
||||
run: |
|
||||
sudo apt-get update && sudo apt-get install autoconf-archive ninja-build
|
||||
@@ -284,7 +275,7 @@ jobs:
|
||||
# The libcxxabi and libunwind tests don't pass on the pinned 16.x branch,
|
||||
# only on git main.
|
||||
if: false
|
||||
needs: [linux-cross]
|
||||
needs: [linux-cross, get-versions]
|
||||
runs-on: windows-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
@@ -307,7 +298,7 @@ jobs:
|
||||
- name: Fetch version
|
||||
if: github.event_name == 'schedule'
|
||||
run: |
|
||||
cat c:\llvm-mingw\versions | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
|
||||
echo LLVM_VERSION=${{needs.get-versions.outputs.LLVM_VERSION}} | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
|
||||
- uses: actions/checkout@v3
|
||||
- name: Checkout llvm-project
|
||||
run: |
|
||||
@@ -341,7 +332,7 @@ jobs:
|
||||
test-openmp:
|
||||
# Only running these tests in scheduled builds.
|
||||
if: (github.event_name == 'schedule') && (github.repository == 'mstorsjo/llvm-mingw')
|
||||
needs: [linux-cross]
|
||||
needs: [linux-cross, get-versions]
|
||||
runs-on: windows-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
@@ -364,7 +355,7 @@ jobs:
|
||||
- name: Fetch version
|
||||
if: github.event_name == 'schedule'
|
||||
run: |
|
||||
cat c:\llvm-mingw\versions | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
|
||||
echo LLVM_VERSION=${{needs.get-versions.outputs.LLVM_VERSION}} | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
|
||||
- uses: actions/checkout@v3
|
||||
- name: Checkout llvm-project
|
||||
run: |
|
||||
@@ -405,7 +396,7 @@ jobs:
|
||||
# These tests don't pass on the pinned 16.x branch, but only on latest
|
||||
# git main - thus only run it for scheduled jobs.
|
||||
if: (github.event_name == 'schedule') && (github.repository == 'mstorsjo/llvm-mingw')
|
||||
needs: [linux-cross]
|
||||
needs: [linux-cross, get-versions]
|
||||
runs-on: windows-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
@@ -428,7 +419,7 @@ jobs:
|
||||
- name: Fetch version
|
||||
if: github.event_name == 'schedule'
|
||||
run: |
|
||||
cat c:\llvm-mingw\versions | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
|
||||
echo LLVM_VERSION=${{needs.get-versions.outputs.LLVM_VERSION}} | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
|
||||
- uses: actions/checkout@v3
|
||||
- name: Checkout llvm-project
|
||||
run: |
|
||||
|
||||
Reference in new issue
Block a user