Fix #344 - add support for std::uint8_t kernel argument #1510
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 }} | |
# 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/github-action-matrix-outputs-read@0.1.1 | |
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 }} | |
build_and_test_python: | |
name: Build and test (Python 3.10) | |
needs: config | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Restore environment | |
uses: actions/cache/restore@v3 | |
with: | |
path: ${{ fromJson(needs.config.outputs.json).tar_archive.llvm }} | |
key: ${{ fromJson(needs.config.outputs.json).cache_key.llvm }} | |
fail-on-cache-miss: true | |
- name: Load environment | |
id: python_env_load | |
run: | | |
tar_archive=${{ fromJson(needs.config.outputs.json).tar_archive.llvm }} | |
loaded=`docker load --input "$tar_archive" | grep -o 'Loaded image: \S*:\S*' | cut -d ' ' -f 3` | |
docker build -t cuda-quantum-dev:local -f docker/build/cudaq.dev.Dockerfile . \ | |
--build-arg base_image=$loaded | |
echo "loaded_image=cuda-quantum-dev:local" >> $GITHUB_OUTPUT | |
- name: Test CUDA Quantum | |
uses: addnab/docker-run-action@v3 | |
with: | |
image: ${{ steps.python_env_load.outputs.loaded_image }} | |
shell: bash | |
run: | | |
cd $CUDAQ_REPO_ROOT | |
echo $PWD | |
pip install . --user -vvv | |
python3 -m pytest python/tests/ | |
RESULT_B=$? | |
if [ $RESULT_B -eq 0 ] | |
then | |
exit 0 | |
else | |
echo "pytest failure = " $RESULT_B | |
exit 1 | |
fi | |
docker_image: | |
name: Create Docker images | |
needs: config | |
uses: ./.github/workflows/docker_images.yml | |
with: | |
devdeps_cache: ${{ fromJson(needs.config.outputs.json).cache_key.llvm }} | |
devdeps_archive: ${{ fromJson(needs.config.outputs.json).tar_archive.llvm }} | |
clean_up: | |
name: Prepare cache clean-up | |
runs-on: ubuntu-latest | |
needs: [config, build_and_test, docker_image] | |
# 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` | |
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 |