[gh] Integration tests workflow #2013
Workflow file for this run
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
on: | |
workflow_dispatch: | |
inputs: | |
export_environment: | |
type: boolean | |
description: Export the build environment as tar artifact that can be imported with Docker. | |
pull_request: | |
branches: | |
- 'main' | |
- 'releases/*' | |
name: CI # do not change name without updating workflow_run triggers | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
setup: | |
name: Load dependencies | |
strategy: | |
matrix: | |
toolchain: [llvm, clang16, gcc12] | |
fail-fast: false | |
uses: ./.github/workflows/dev_environment.yml | |
with: | |
dockerfile: build/devdeps.Dockerfile | |
toolchain: ${{ matrix.toolchain }} | |
# needed only for the cloudposse GitHub action | |
matrix_key: ${{ matrix.toolchain }} | |
wheeldeps: | |
name: Load wheel dependencies | |
uses: ./.github/workflows/dev_environment.yml | |
with: | |
dockerfile: build/devdeps.manylinux.Dockerfile | |
toolchain: x86_64 | |
build_args: | | |
manylinux_image=quay.io/pypa/manylinux_2_28_x86_64:latest | |
# This job is needed only when using the cloudposse GitHub action to read | |
# the output of a matrix job. This is a workaround due to current GitHub | |
# limitations that may not be needed if the work started here concludes: | |
# https://github.com/actions/runner/pull/2477 | |
config: | |
name: Configure build | |
runs-on: ubuntu-latest | |
needs: setup | |
outputs: | |
json: "${{ steps.read_json.outputs.result }}" | |
steps: | |
- uses: cloudposse/[email protected] | |
id: read_json | |
with: | |
matrix-step-name: dev_environment | |
build_and_test: | |
name: Build and test | |
needs: config | |
strategy: | |
matrix: | |
toolchain: [llvm, clang16, gcc12] | |
fail-fast: false | |
uses: ./.github/workflows/test_in_devenv.yml | |
with: | |
devdeps_cache: ${{ fromJson(needs.config.outputs.json).cache_key[format('{0}', matrix.toolchain)] }} | |
devdeps_archive: ${{ fromJson(needs.config.outputs.json).tar_archive[format('{0}', matrix.toolchain)] }} | |
export_environment: ${{ github.event_name == 'workflow_dispatch' && inputs.export_environment }} | |
docker_image: | |
name: Create Docker images | |
needs: config | |
uses: ./.github/workflows/docker_images.yml | |
with: | |
devdeps_cache: ${{ fromJson(needs.config.outputs.json).cache_key.gcc12 }} | |
devdeps_archive: ${{ fromJson(needs.config.outputs.json).tar_archive.gcc12 }} | |
python_wheels: | |
name: Create Python wheels | |
needs: wheeldeps | |
strategy: | |
matrix: | |
python_version: ['3.8', '3.10'] | |
fail-fast: false | |
uses: ./.github/workflows/python_wheels.yml | |
with: | |
python_version: ${{ matrix.python_version }} | |
devdeps_cache: ${{ needs.wheeldeps.outputs.cache_key }} | |
devdeps_archive: ${{ needs.wheeldeps.outputs.tar_archive }} | |
clean_up: | |
name: Prepare cache clean-up | |
runs-on: ubuntu-latest | |
needs: [config, build_and_test, docker_image, wheeldeps, python_wheels] | |
# We need to clean up even if the workflow is cancelled or fails. | |
if: always() | |
steps: | |
- name: Save cache keys | |
id: workflow_inputs | |
run: | | |
set -e | |
key_matrix='${{ needs.config.outputs.json }}' | |
keys=`echo $key_matrix | jq '.cache_key | to_entries | .[].value' --raw-output` | |
keys+=" ${{ needs.wheeldeps.outputs.cache_key }}" | |
echo "$keys" >> cache_keys.txt | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: cache_keys_ci | |
path: cache_keys.txt | |
retention-days: 1 | |
if-no-files-found: error |