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:
|
get-versions:
|
||||||
if: (github.event_name != 'schedule') || (github.repository == 'mstorsjo/llvm-mingw')
|
if: (github.event_name != 'schedule') || (github.repository == 'mstorsjo/llvm-mingw')
|
||||||
runs-on: ubuntu-latest
|
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:
|
steps:
|
||||||
- name: Touch file
|
|
||||||
run: |
|
|
||||||
touch versions
|
|
||||||
- name: Check latest version
|
- name: Check latest version
|
||||||
if: github.event_name == 'schedule'
|
if: github.event_name == 'schedule'
|
||||||
|
id: get-versions
|
||||||
run: |
|
run: |
|
||||||
echo LLVM_VERSION=$(git ls-remote https://github.com/llvm/llvm-project.git | grep 'refs/heads/main$' | awk '{print $1}') >> versions
|
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}') >> versions
|
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}') >> 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}') >> $GITHUB_OUTPUT
|
||||||
cat versions
|
cat $GITHUB_OUTPUT
|
||||||
- uses: actions/upload-artifact@v3
|
|
||||||
with:
|
|
||||||
name: versions
|
|
||||||
path: |
|
|
||||||
versions
|
|
||||||
retention-days: 7
|
|
||||||
|
|
||||||
# Build a cross compiler for Linux, targeting Windows.
|
# Build a cross compiler for Linux, targeting Windows.
|
||||||
linux:
|
linux:
|
||||||
@@ -42,13 +38,11 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
- uses: actions/download-artifact@v3
|
|
||||||
if: github.event_name == 'schedule'
|
|
||||||
with:
|
|
||||||
name: versions
|
|
||||||
- name: Set build env vars
|
- name: Set build env vars
|
||||||
if: github.event_name == 'schedule'
|
if: github.event_name == 'schedule'
|
||||||
run: |
|
run: |
|
||||||
|
echo LLVM_VERSION=${{needs.get-versions.outputs.LLVM_VERSION}} >> versions
|
||||||
|
echo MINGW_W64_VERSION=${{needs.get-versions.outputs.MINGW_W64_VERSION}} >> versions
|
||||||
. versions
|
. versions
|
||||||
echo Building llvm-project $LLVM_VERSION mingw-w64 $MINGW_W64_VERSION
|
echo Building llvm-project $LLVM_VERSION mingw-w64 $MINGW_W64_VERSION
|
||||||
cat versions >> $GITHUB_ENV
|
cat versions >> $GITHUB_ENV
|
||||||
@@ -80,13 +74,11 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
- uses: actions/download-artifact@v3
|
|
||||||
if: github.event_name == 'schedule'
|
|
||||||
with:
|
|
||||||
name: versions
|
|
||||||
- name: Set build env vars
|
- name: Set build env vars
|
||||||
if: github.event_name == 'schedule'
|
if: github.event_name == 'schedule'
|
||||||
run: |
|
run: |
|
||||||
|
echo LLVM_VERSION=${{needs.get-versions.outputs.LLVM_VERSION}} >> versions
|
||||||
|
echo MINGW_W64_VERSION=${{needs.get-versions.outputs.MINGW_W64_VERSION}} >> versions
|
||||||
. versions
|
. versions
|
||||||
echo Building llvm-project $LLVM_VERSION mingw-w64 $MINGW_W64_VERSION, with assertions enabled
|
echo Building llvm-project $LLVM_VERSION mingw-w64 $MINGW_W64_VERSION, with assertions enabled
|
||||||
cat versions >> $GITHUB_ENV
|
cat versions >> $GITHUB_ENV
|
||||||
@@ -111,13 +103,11 @@ jobs:
|
|||||||
needs: [get-versions]
|
needs: [get-versions]
|
||||||
runs-on: macos-latest
|
runs-on: macos-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/download-artifact@v3
|
|
||||||
if: github.event_name == 'schedule'
|
|
||||||
with:
|
|
||||||
name: versions
|
|
||||||
- name: Set build env vars
|
- name: Set build env vars
|
||||||
if: github.event_name == 'schedule'
|
if: github.event_name == 'schedule'
|
||||||
run: |
|
run: |
|
||||||
|
echo LLVM_VERSION=${{needs.get-versions.outputs.LLVM_VERSION}} >> versions
|
||||||
|
echo MINGW_W64_VERSION=${{needs.get-versions.outputs.MINGW_W64_VERSION}} >> versions
|
||||||
. versions
|
. versions
|
||||||
echo Building llvm-project $LLVM_VERSION mingw-w64 $MINGW_W64_VERSION
|
echo Building llvm-project $LLVM_VERSION mingw-w64 $MINGW_W64_VERSION
|
||||||
cat versions >> $GITHUB_ENV
|
cat versions >> $GITHUB_ENV
|
||||||
@@ -169,13 +159,11 @@ jobs:
|
|||||||
toolchain:p
|
toolchain:p
|
||||||
cmake:p
|
cmake:p
|
||||||
ninja:p
|
ninja:p
|
||||||
- uses: actions/download-artifact@v3
|
|
||||||
if: github.event_name == 'schedule'
|
|
||||||
with:
|
|
||||||
name: versions
|
|
||||||
- name: Set build env vars
|
- name: Set build env vars
|
||||||
if: github.event_name == 'schedule'
|
if: github.event_name == 'schedule'
|
||||||
run: |
|
run: |
|
||||||
|
echo LLVM_VERSION=${{needs.get-versions.outputs.LLVM_VERSION}} >> versions
|
||||||
|
echo MINGW_W64_VERSION=${{needs.get-versions.outputs.MINGW_W64_VERSION}} >> versions
|
||||||
. versions
|
. versions
|
||||||
echo Building llvm-project $LLVM_VERSION mingw-w64 $MINGW_W64_VERSION
|
echo Building llvm-project $LLVM_VERSION mingw-w64 $MINGW_W64_VERSION
|
||||||
cat versions >> $GITHUB_ENV
|
cat versions >> $GITHUB_ENV
|
||||||
@@ -190,7 +178,7 @@ jobs:
|
|||||||
# architectures). The binaries built here match actual releases quite closely.
|
# architectures). The binaries built here match actual releases quite closely.
|
||||||
linux-cross:
|
linux-cross:
|
||||||
if: (github.event_name != 'schedule') || (github.repository == 'mstorsjo/llvm-mingw')
|
if: (github.event_name != 'schedule') || (github.repository == 'mstorsjo/llvm-mingw')
|
||||||
needs: [linux]
|
needs: [linux, get-versions]
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
@@ -214,11 +202,14 @@ jobs:
|
|||||||
- name: Fetch version
|
- name: Fetch version
|
||||||
if: github.event_name == 'schedule'
|
if: github.event_name == 'schedule'
|
||||||
run: |
|
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
|
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}}
|
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
|
- name: Build
|
||||||
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
|
||||||
@@ -284,7 +275,7 @@ jobs:
|
|||||||
# The libcxxabi and libunwind tests don't pass on the pinned 16.x branch,
|
# The libcxxabi and libunwind tests don't pass on the pinned 16.x branch,
|
||||||
# only on git main.
|
# only on git main.
|
||||||
if: false
|
if: false
|
||||||
needs: [linux-cross]
|
needs: [linux-cross, get-versions]
|
||||||
runs-on: windows-latest
|
runs-on: windows-latest
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
@@ -307,7 +298,7 @@ jobs:
|
|||||||
- name: Fetch version
|
- name: Fetch version
|
||||||
if: github.event_name == 'schedule'
|
if: github.event_name == 'schedule'
|
||||||
run: |
|
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
|
- uses: actions/checkout@v3
|
||||||
- name: Checkout llvm-project
|
- name: Checkout llvm-project
|
||||||
run: |
|
run: |
|
||||||
@@ -341,7 +332,7 @@ jobs:
|
|||||||
test-openmp:
|
test-openmp:
|
||||||
# Only running these tests in scheduled builds.
|
# Only running these tests in scheduled builds.
|
||||||
if: (github.event_name == 'schedule') && (github.repository == 'mstorsjo/llvm-mingw')
|
if: (github.event_name == 'schedule') && (github.repository == 'mstorsjo/llvm-mingw')
|
||||||
needs: [linux-cross]
|
needs: [linux-cross, get-versions]
|
||||||
runs-on: windows-latest
|
runs-on: windows-latest
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
@@ -364,7 +355,7 @@ jobs:
|
|||||||
- name: Fetch version
|
- name: Fetch version
|
||||||
if: github.event_name == 'schedule'
|
if: github.event_name == 'schedule'
|
||||||
run: |
|
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
|
- uses: actions/checkout@v3
|
||||||
- name: Checkout llvm-project
|
- name: Checkout llvm-project
|
||||||
run: |
|
run: |
|
||||||
@@ -405,7 +396,7 @@ jobs:
|
|||||||
# These tests don't pass on the pinned 16.x branch, but only on latest
|
# These tests don't pass on the pinned 16.x branch, but only on latest
|
||||||
# git main - thus only run it for scheduled jobs.
|
# git main - thus only run it for scheduled jobs.
|
||||||
if: (github.event_name == 'schedule') && (github.repository == 'mstorsjo/llvm-mingw')
|
if: (github.event_name == 'schedule') && (github.repository == 'mstorsjo/llvm-mingw')
|
||||||
needs: [linux-cross]
|
needs: [linux-cross, get-versions]
|
||||||
runs-on: windows-latest
|
runs-on: windows-latest
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
@@ -428,7 +419,7 @@ jobs:
|
|||||||
- name: Fetch version
|
- name: Fetch version
|
||||||
if: github.event_name == 'schedule'
|
if: github.event_name == 'schedule'
|
||||||
run: |
|
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
|
- uses: actions/checkout@v3
|
||||||
- name: Checkout llvm-project
|
- name: Checkout llvm-project
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
Reference in new issue
Block a user