Nightly tests #69
This file contains hidden or 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
| name: Nightly tests | |
| on: | |
| schedule: | |
| - cron: '30 5 * * *' # Runs at 5:30am UTC | |
| workflow_dispatch: | |
| jobs: | |
| wheels: | |
| name: Build and test wheels | |
| uses: ./.github/workflows/build_wheels.yaml | |
| with: | |
| build_type: Release | |
| cudaq_wheels: Custom | |
| cache_key_suffix: nightly | |
| secrets: inherit | |
| resolve-cudaq-main: | |
| name: Resolve CUDA-Q main | |
| runs-on: ubuntu-latest | |
| outputs: | |
| repo: ${{ steps.resolve.outputs.repo }} | |
| ref: ${{ steps.resolve.outputs.ref }} | |
| steps: | |
| - name: Resolve latest CUDA-Q commit | |
| id: resolve | |
| run: | | |
| repo=NVIDIA/cuda-quantum | |
| ref=$(git ls-remote "https://github.com/${repo}.git" refs/heads/main | awk '{print $1}') | |
| if [[ -z "$ref" ]]; then | |
| echo "Failed to resolve ${repo}@main" | |
| exit 1 | |
| fi | |
| echo "Using CUDA-Q source: ${repo}@${ref}" | |
| echo "repo=$repo" >> $GITHUB_OUTPUT | |
| echo "ref=$ref" >> $GITHUB_OUTPUT | |
| shell: bash | |
| build-cudaq-main: | |
| name: Build CUDA-Q main | |
| needs: resolve-cudaq-main | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| platform: ['amd64', 'arm64'] | |
| cuda_version: ['12.6', '13.0'] | |
| runs-on: ${{ startsWith(github.repository, 'NVIDIA/cudaqx') && format('linux-{0}-cpu32', matrix.platform) || 'ubuntu-latest' }} | |
| container: ghcr.io/nvidia/cuda-quantum-devcontainer:${{ matrix.platform }}-cu${{ matrix.cuda_version }}-gcc12-main | |
| permissions: | |
| actions: write | |
| contents: read | |
| steps: | |
| - name: Get code | |
| uses: actions/checkout@v4 | |
| with: | |
| set-safe-directory: true | |
| - name: Configure | |
| id: config | |
| run: | | |
| cuda_major=$(echo ${{ matrix.cuda_version }} | cut -d . -f1) | |
| echo "cuda_major=$cuda_major" >> $GITHUB_OUTPUT | |
| - name: Get CUDAQ build | |
| uses: ./.github/actions/get-cudaq-build | |
| with: | |
| repo: ${{ needs.resolve-cudaq-main.outputs.repo }} | |
| ref: ${{ needs.resolve-cudaq-main.outputs.ref }} | |
| token: ${{ secrets.CUDAQ_ACCESS_TOKEN }} | |
| cache-key-suffix: nightly | |
| save-build: true | |
| save-ccache: false | |
| platform: ${{ matrix.platform }}-cu${{ steps.config.outputs.cuda_major }} | |
| cudaq-main-all-libs: | |
| name: All libs against CUDA-Q main | |
| needs: [resolve-cudaq-main, build-cudaq-main] | |
| uses: ./.github/workflows/all_libs.yaml | |
| with: | |
| cudaq_repo: ${{ needs.resolve-cudaq-main.outputs.repo }} | |
| cudaq_ref: ${{ needs.resolve-cudaq-main.outputs.ref }} | |
| cache_key_suffix: nightly | |
| secrets: inherit | |
| cudaq-main-qec: | |
| name: QEC against CUDA-Q main | |
| needs: [resolve-cudaq-main, build-cudaq-main] | |
| uses: ./.github/workflows/lib_qec.yaml | |
| with: | |
| cudaq_repo: ${{ needs.resolve-cudaq-main.outputs.repo }} | |
| cudaq_ref: ${{ needs.resolve-cudaq-main.outputs.ref }} | |
| cache_key_suffix: nightly | |
| secrets: inherit | |
| cudaq-main-solvers: | |
| name: Solvers against CUDA-Q main | |
| needs: [resolve-cudaq-main, build-cudaq-main] | |
| uses: ./.github/workflows/lib_solvers.yaml | |
| with: | |
| cudaq_repo: ${{ needs.resolve-cudaq-main.outputs.repo }} | |
| cudaq_ref: ${{ needs.resolve-cudaq-main.outputs.ref }} | |
| cache_key_suffix: nightly | |
| secrets: inherit | |
| cudaq-main-docs: | |
| name: Docs against CUDA-Q main | |
| needs: [resolve-cudaq-main, build-cudaq-main] | |
| uses: ./.github/workflows/docs.yaml | |
| with: | |
| cudaq_repo: ${{ needs.resolve-cudaq-main.outputs.repo }} | |
| cudaq_ref: ${{ needs.resolve-cudaq-main.outputs.ref }} | |
| cache_key_suffix: nightly | |
| secrets: inherit | |
| cleanup-nightly-cache: | |
| name: Clean up nightly cache | |
| if: ${{ always() }} | |
| needs: | |
| - wheels | |
| - resolve-cudaq-main | |
| - build-cudaq-main | |
| - cudaq-main-all-libs | |
| - cudaq-main-qec | |
| - cudaq-main-solvers | |
| - cudaq-main-docs | |
| runs-on: ubuntu-latest | |
| permissions: | |
| actions: write | |
| contents: read | |
| steps: | |
| - name: Delete nightly cache entries | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| shell: bash | |
| run: | | |
| # Fetch the list of cache keys | |
| cache_keys=$(gh cache list --repo ${{ github.repository }} --limit 1000 | cut -f 2) | |
| for key in $cache_keys | |
| do | |
| if [[ $key =~ -nightly$ ]]; then | |
| gh cache delete $key --repo ${{ github.repository }} | |
| echo "Deleted cache entry: $key" | |
| fi | |
| done |