-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make CI not wait for unelated parallel build
- Split OS-dependent steps to a separate sub-pipeline, so they can run without waiting for each other.
- Loading branch information
Showing
2 changed files
with
149 additions
and
134 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,145 @@ | ||
name: Build Pythia binaries | ||
on: | ||
workflow_call: | ||
inputs: | ||
os: | ||
description: "OS to run the build for" | ||
outputs: | ||
image: | ||
description: "Resulting docker image (tagged with commit SHA)" | ||
value: ${{ jobs.set_image_name.outputs.image }} | ||
env: | ||
PYTHON_VERSION: 3.10.9 | ||
jobs: | ||
Create-Interpreters: | ||
runs-on: ${{ inputs.os }} | ||
|
||
steps: | ||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: 3.9 | ||
|
||
- name: Cache interpreters | ||
uses: actions/cache@v3 | ||
id: cache | ||
with: | ||
path: python-${{ env.PYTHON_VERSION }}-${{ runner.os }}.tar | ||
key: interpreters-${{ env.PYTHON_VERSION }}-${{ runner.os }}-${{ secrets.CACHE_VERSION }} | ||
|
||
- name: Check out repository code | ||
if: steps.cache.outputs.cache-hit != 'true' | ||
uses: actions/checkout@v3 | ||
|
||
- name: Install requirements | ||
if: steps.cache.outputs.cache-hit != 'true' | ||
run: pip install -r requirements.txt | ||
|
||
- name: Create interpreters | ||
if: steps.cache.outputs.cache-hit != 'true' | ||
run: python tools/build.py create_interpreters ${{ env.PYTHON_VERSION }} --dest . | ||
|
||
- name: Tar interpreters | ||
if: steps.cache.outputs.cache-hit != 'true' | ||
run: tar cvf python-${{ env.PYTHON_VERSION }}-${{ runner.os }}.tar python-*-embed-* | ||
|
||
- uses: actions/upload-artifact@v3 | ||
with: | ||
name: _Internal_Python_Interpreters | ||
path: python-*.tar | ||
if-no-files-found: error | ||
retention-days: 1 | ||
|
||
Build-Binaries: | ||
needs: Create-Interpreters | ||
runs-on: ${{ inputs.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
arch: [x64, x86] | ||
|
||
steps: | ||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: 3.9 | ||
|
||
- name: Check out repository code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Create the directory | ||
run: mkdir "@Pythia" | ||
|
||
- name: Download the interpreters | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: _Internal_Python_Interpreters | ||
|
||
- name: Untar the interpreter | ||
run: tar xf ../python-${{ env.PYTHON_VERSION }}-${{ runner.os }}.tar | ||
working-directory: "@Pythia" | ||
|
||
# Build the extension | ||
- uses: ilammy/msvc-dev-cmd@v1 | ||
if: ${{ runner.os == 'Windows' }} | ||
with: | ||
arch: ${{ matrix.arch }} | ||
|
||
- name: Perform build | ||
run: python tools/build.py build_binaries ${{ env.PYTHON_VERSION }} ${{ matrix.arch }} ${{ runner.os }} | ||
|
||
- uses: actions/upload-artifact@v3 | ||
with: | ||
name: _Internal_Pythia_Binaries | ||
path: | | ||
@Pythia/*.dll | ||
@Pythia/*.so | ||
@Pythia/*.exe | ||
@Pythia/PythiaTester* | ||
if-no-files-found: error | ||
retention-days: 1 | ||
|
||
Test-Binaries: | ||
needs: Build-Binaries | ||
runs-on: ${{ inputs.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
arch: [x64, x86] | ||
|
||
steps: | ||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: 3.9 | ||
|
||
- name: Check out repository code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Create the directory | ||
run: mkdir "@Pythia" | ||
|
||
- name: Download the interpreters | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: _Internal_Python_Interpreters | ||
|
||
- name: Untar the interpreter | ||
run: tar xf ../python-${{ env.PYTHON_VERSION }}-${{ runner.os }}.tar | ||
working-directory: "@Pythia" | ||
|
||
- name: Download the binaries | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: _Internal_Pythia_Binaries | ||
path: "@Pythia" | ||
|
||
- name: Set testers permissions | ||
run: chmod a+x @Pythia/PythiaTester* | ||
|
||
- name: Install multilib for compiling 32bit Cython extensions (in tests) | ||
if: runner.os == 'Linux' && matrix.arch == 'x86' | ||
run: sudo apt install -y gcc-multilib | ||
|
||
- name: Copy templates | ||
run: python tools/build.py copy_templates ${{ env.PYTHON_VERSION }} | ||
|
||
- name: Run basic tests | ||
run: python tools/build.py run_tests ${{ env.PYTHON_VERSION }} ${{ matrix.arch }} ${{ runner.os }} |
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