diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 90515a07c..3e620460d 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -4,10 +4,7 @@ on: push: branches: - 'main' - - 'release-' - tags: '*' - paths-ignore: - 'docs/**' pull_request: @@ -16,92 +13,15 @@ on: concurrency: group: ${{ github.workflow }}-${{ github.ref }} - # Cancel intermediate builds: only if it is a pull request build. cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }} jobs: - setup-matrix: - runs-on: ubuntu-latest - outputs: - groups: ${{ steps.mk.outputs.groups }} - version: ${{ steps.mk.outputs.version }} - os: ${{ steps.mk.outputs.os }} - steps: - - uses: actions/checkout@v6 - - id: mk - shell: bash - run: | - # Auto-discover test groups from all subdirectory names. - groups=$(find test -mindepth 1 -maxdepth 1 -type d \ - | xargs -I{} basename {} | sort \ - | jq -R -s -c '[split("\n")[] | select(length > 0)]') - - echo "groups=${groups}" >> "$GITHUB_OUTPUT" - - # Draft PR: only run ubuntu-latest + version=1 - if [[ "${{ github.event_name }}" == "pull_request" && "${{ github.event.pull_request.draft }}" == "true" ]]; then - echo 'version=["1"]' >> "$GITHUB_OUTPUT" - echo 'os=["ubuntu-latest"]' >> "$GITHUB_OUTPUT" - else - echo 'version=["lts","1"]' >> "$GITHUB_OUTPUT" - echo 'os=["ubuntu-latest","macOS-latest","windows-latest"]' >> "$GITHUB_OUTPUT" - fi - - test: - name: "Tests (${{ matrix.group }}, ${{ matrix.os }}, Julia ${{ matrix.version }})" - needs: setup-matrix - strategy: - fail-fast: false - matrix: - version: ${{ fromJSON(needs.setup-matrix.outputs.version) }} - os: ${{ fromJSON(needs.setup-matrix.outputs.os) }} - group: ${{ fromJSON(needs.setup-matrix.outputs.groups) }} - runs-on: ${{ matrix.os }} - timeout-minutes: 120 - steps: - - uses: actions/checkout@v6 - - uses: julia-actions/setup-julia@v3 - with: - version: ${{ matrix.version }} - - uses: julia-actions/cache@v3 - - uses: julia-actions/julia-buildpkg@v1 - - uses: julia-actions/julia-runtest@v1 - with: - test_args: '${{ matrix.group }}${{ github.event.pull_request.draft == true && '' --fast'' || '''' }}' - env: - JULIA_NUM_THREADS: "4" - - uses: julia-actions/julia-processcoverage@v1 - with: - directories: 'src,ext' - - uses: codecov/codecov-action@v6 - with: - files: lcov.info - token: ${{ secrets.CODECOV_TOKEN }} - fail_ci_if_error: false - - # test-nightly: - # name: "Tests (${{ matrix.group }}, ${{ matrix.os }}, Julia nightly)" - # needs: [setup-matrix, test] - # if: github.event.pull_request.draft != true - # strategy: - # fail-fast: false - # matrix: - # version: - # - 'nightly' - # group: ${{ fromJSON(needs.setup-matrix.outputs.groups) }} - # os: - # - ubuntu-latest - # - macOS-latest - # - windows-latest - # runs-on: ${{ matrix.os }} - # timeout-minutes: 120 - # steps: - # - uses: actions/checkout@v6 - # - uses: julia-actions/setup-julia@v3 - # with: - # version: ${{ matrix.version }} - # - uses: julia-actions/cache@v3 - # - uses: julia-actions/julia-buildpkg@v1 - # - uses: julia-actions/julia-runtest@v1 - # with: - # test_args: '${{ matrix.group }}' + tests: + name: "Tests" + uses: "QuantumKitHub/QuantumKitHubActions/.github/workflows/TestGroups.yml@main" + with: + fast: "${{ github.event.pull_request.draft == true }}" + exclude: '["cuda", "amd"]' + timeout-minutes: 120 + secrets: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} diff --git a/.github/workflows/CompatCheck.yml b/.github/workflows/CompatCheck.yml index eaafae6b5..e9956217a 100644 --- a/.github/workflows/CompatCheck.yml +++ b/.github/workflows/CompatCheck.yml @@ -14,6 +14,9 @@ on: pull_request: types: [opened, synchronize, reopened, ready_for_review, converted_to_draft] + paths: + - 'Project.toml' + - 'test/Project.toml' workflow_dispatch: concurrency: diff --git a/test/runtests.jl b/test/runtests.jl index af49ce2f8..a7d2e2373 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -26,18 +26,19 @@ if (Sys.isapple() && get(ENV, "CI", "false") == "true") || !isempty(VERSION.prer filter!(!startswith("mooncake") ∘ first, testsuite) end +args = parse_args(ARGS; custom = ["fast"]) # --fast: skip AD tests and inject fast_tests=true into each worker sandbox -fast = "--fast" in ARGS -filtered_args = filter(!=("--fast"), ARGS) -# if fast -# filter!(!startswith("chainrules") ∘ first, testsuite) -# filter!(!startswith("mooncake") ∘ first, testsuite) -# end +fast = !isnothing(args.custom["fast"]) + setup_path = joinpath(@__DIR__, "setup.jl") -init_code = quote +const init_worker_code = quote const fast_tests = $fast include($setup_path) using .TestSetup end +const init_code = quote + using ..TestSetup + const fast_tests = $fast +end -ParallelTestRunner.runtests(TensorKit, filtered_args; testsuite, init_code) +ParallelTestRunner.runtests(TensorKit, args; init_worker_code, init_code)