diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index ab47ede..2c00e63 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -1,212 +1,26 @@ steps: - - group: ":julia: CUDA GPU" - steps: - - label: ":julia: Julia {{matrix.julia}} + CUDA GPU" - plugins: - - JuliaCI/julia#v1: - version: "{{matrix.julia}}" - - JuliaCI/julia-test#v1: - test_args: "--quickfail" - - JuliaCI/julia-coverage#v1: - codecov: true - dirs: - - src - - ext - agents: - queue: "juliagpu" - cuda: "*" - env: - BACKEND_GROUP: "CUDA" - if: build.message !~ /\[skip tests\]/ - timeout_in_minutes: 60 - matrix: - setup: - julia: - - "1" - - - group: ":telescope: Downstream CUDA" - steps: - - label: ":julia: {{matrix.repo}} (Julia {{matrix.julia}} + CUDA GPU)" - plugins: - - JuliaCI/julia#v1: - version: "{{matrix.julia}}" - - JuliaCI/julia-coverage#v1: - codecov: true - dirs: - - src - - ext - command: | - julia --code-coverage=user --color=yes --project -e ' - using Pkg - - repo = ENV["DOWNSTREAM_TEST_REPO"] - - println("--- :julia: Instantiating project") - withenv("JULIA_PKG_PRECOMPILE_AUTO" => 0) do - Pkg.instantiate() - - try - Pkg.develop(repo) - println("+++ :julia: Running tests") - Pkg.test("$(repo)"; coverage=true) - catch err - err isa Pkg.Resolve.ResolverError || rethrow() - @info "Not compatible with this release. No problem." exception=err - exit(0) - end - end - - println("+++ :julia: Finished Downstream Test")' - agents: - queue: "juliagpu" - cuda: "*" - env: - BACKEND_GROUP: "CUDA" - DOWNSTREAM_TEST_REPO: "{{matrix.repo}}" - if: build.message !~ /\[skip tests\]/ || build.message !~ /\[skip downstream\]/ - timeout_in_minutes: 240 - matrix: - setup: - julia: - - "1" - repo: - - "Lux" - - "Boltz" - - - group: ":julia: AMD GPU" - steps: - - label: ":julia: Julia: {{matrix.julia}} + AMD GPU" - plugins: - - JuliaCI/julia#v1: - version: "{{matrix.julia}}" - - JuliaCI/julia-test#v1: - test_args: "--quickfail" - - JuliaCI/julia-coverage#v1: - codecov: true - dirs: - - src - - ext - env: - JULIA_AMDGPU_CORE_MUST_LOAD: "1" - JULIA_AMDGPU_HIP_MUST_LOAD: "1" - JULIA_AMDGPU_DISABLE_ARTIFACTS: "1" - BACKEND_GROUP: "AMDGPU" - agents: - queue: "juliagpu" - rocm: "*" - rocmgpu: "*" - if: build.message !~ /\[skip tests\]/ - timeout_in_minutes: 60 - matrix: - setup: - julia: - - "1" - - - group: ":telescope: Downstream AMD GPU" - steps: - - label: ":julia: {{matrix.repo}} (Julia {{matrix.julia}} + AMD GPU)" - plugins: - - JuliaCI/julia#v1: - version: "{{matrix.julia}}" - - JuliaCI/julia-coverage#v1: - codecov: true - dirs: - - src - - ext - command: | - julia --code-coverage=user --color=yes --project -e ' - using Pkg - - repo = ENV["DOWNSTREAM_TEST_REPO"] - - println("--- :julia: Instantiating project") - withenv("JULIA_PKG_PRECOMPILE_AUTO" => 0) do - Pkg.instantiate() - - try - Pkg.develop(repo) - println("+++ :julia: Running tests") - Pkg.test("$(repo)"; coverage=true) - catch err - err isa Pkg.Resolve.ResolverError || rethrow() - @info "Not compatible with this release. No problem." exception=err - exit(0) - end - end - - println("+++ :julia: Finished Downstream Test")' - agents: - queue: "juliagpu" - rocm: "*" - rocmgpu: "*" - env: - BACKEND_GROUP: "AMDGPU" - JULIA_AMDGPU_CORE_MUST_LOAD: "1" - JULIA_AMDGPU_HIP_MUST_LOAD: "1" - JULIA_AMDGPU_DISABLE_ARTIFACTS: "1" - DOWNSTREAM_TEST_REPO: "{{matrix.repo}}" - if: build.message !~ /\[skip tests\]/ || build.message !~ /\[skip downstream\]/ - timeout_in_minutes: 240 - matrix: - setup: - julia: - - "1" - repo: - - "Lux" - - "Boltz" - - - group: ":julia: Metal GPU" - steps: - - label: ":julia: Julia: {{matrix.julia}} + Metal" - plugins: - - JuliaCI/julia#v1: - version: "{{matrix.julia}}" - - JuliaCI/julia-test#v1: - test_args: "--quickfail" - # - JuliaCI/julia-coverage#v1: - # codecov: true - # dirs: - # - src - # - ext - agents: - queue: "juliaecosystem" - os: "macos" - arch: "aarch64" - env: - BACKEND_GROUP: "Metal" - if: build.message !~ /\[skip tests\]/ - timeout_in_minutes: 60 - matrix: - setup: - julia: - - "1" - - - group: ":julia: oneAPI GPU" - steps: - - label: ":julia: Julia: {{matrix.julia}} + oneAPI" - plugins: - - JuliaCI/julia#v1: - version: "{{matrix.julia}}" - - JuliaCI/julia-test#v1: - test_args: "--quickfail" - - JuliaCI/julia-coverage#v1: - codecov: true - dirs: - - src - - ext - env: - BACKEND_GROUP: "oneAPI" - agents: - queue: "juliagpu" - intel: "*" - if: build.message !~ /\[skip tests\]/ - timeout_in_minutes: 60 - matrix: - setup: - julia: - - "1" - -env: - RETESTITEMS_NWORKERS: 8 - RETESTITEMS_NWORKER_THREADS: 2 - SECRET_CODECOV_TOKEN: "PxSr3Y7vdbiwaoX51uGykPsogxmP1IOBt5Z8TwP9GqDxIrvFocEVV2DR4Bebee12G/HYvXtQTyYXH49DpzlsfJ7ri1GQZxd9WRr+aM1DDYmzfDCfpadp4hMoJ5NQvmc/PzeGrNWOOaewaLTUP1eEaG4suygZN0lc5q9BCchIJeqoklGms5DVt/HtfTmwoD/s4wGoIJINi4RoFgnCAkzSh11hTAkyjVerfBGWEi/8E6+WBq3UKwaW4HnT02wG9qFnD4XkHpIpjMxJTpdBn5ufKI+QoJ7qJHlwqgDCtsOCblApccLTjH/BnTahNoSb/b0wdS/cblOTrtdPGzZ5UvmQ4Q==;U2FsdGVkX1/Ji2Nqeq3tqTYCBik6iXILP+rriPRqj/qxhFu4vBWWT3UnlfqDzj6oVdXyuKt0+5e+x33x2S0mBw==" + - label: "Triggering Pipelines (Pull Request)" + if: "build.pull_request.base_branch == 'main'" + agents: + queue: "juliagpu" + plugins: + - monebag/monorepo-diff#v2.5.9: + diff: ".buildkite/scripts/diff.sh $BUILDKITE_COMMIT" + interpolation: false + watch: + - path: + - "src/" + - "ext/" + - "test/" + - "Project.toml" + - ".buildkite/" + config: + command: "buildkite-agent pipeline upload .buildkite/testing.yml" + agents: + queue: "juliagpu" + + - label: "Triggering Pipelines (Main Branch / Tag)" + if: build.branch == "main" || build.tag != null + agents: + queue: "juliagpu" + command: "buildkite-agent pipeline upload .buildkite/testing.yml" diff --git a/.buildkite/scripts/diff.sh b/.buildkite/scripts/diff.sh new file mode 100755 index 0000000..b73437f --- /dev/null +++ b/.buildkite/scripts/diff.sh @@ -0,0 +1,13 @@ +#!/bin/bash +set -ueo pipefail + +# Script to output the diff where the branch was created +# Usage: ./diff.sh $BUILDKITE_COMMIT + +COMMIT_HASH=$1 +SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) + +BRANCH_POINT_COMMIT=$($SCRIPT_DIR/find_branch_point.sh "$COMMIT_HASH") +echo >&2 "Cannot find latest build. Running diff against: $BRANCH_POINT_COMMIT" +diff=$(git diff --name-only "$BRANCH_POINT_COMMIT") +echo "$diff" diff --git a/.buildkite/scripts/downstream.jl b/.buildkite/scripts/downstream.jl new file mode 100644 index 0000000..2948deb --- /dev/null +++ b/.buildkite/scripts/downstream.jl @@ -0,0 +1,25 @@ +using Pkg + +repo = ARGS[1] +if contains(repo, "#") + repo, group = split(repo, "#") +else + group = ARGS[2] +end + +println("--- :julia: Instantiating project") +withenv("JULIA_PKG_PRECOMPILE_AUTO" => 0, "GROUP" => group, "BACKEND_GROUP" => group) do + Pkg.instantiate() + + try + Pkg.develop(repo) + println("+++ :julia: Running tests") + Pkg.test("$(repo)"; coverage=true) + catch err + err isa Pkg.Resolve.ResolverError || rethrow() + @info "Not compatible with this release. No problem." exception=err + exit(0) + end +end + +println("+++ :julia: Finished Downstream Test") diff --git a/.buildkite/scripts/find_branch_point.sh b/.buildkite/scripts/find_branch_point.sh new file mode 100755 index 0000000..f829535 --- /dev/null +++ b/.buildkite/scripts/find_branch_point.sh @@ -0,0 +1,6 @@ +#!/bin/bash +set -ue + +diff -u <(git rev-list --first-parent "$1") \ + <(git rev-list --first-parent main) | \ + sed -ne 's/^ //p' | head -1 diff --git a/.buildkite/testing.yml b/.buildkite/testing.yml new file mode 100644 index 0000000..3802e0a --- /dev/null +++ b/.buildkite/testing.yml @@ -0,0 +1,167 @@ +steps: + - group: ":julia: CUDA GPU" + steps: + - label: ":julia: Julia {{matrix.julia}} + CUDA GPU" + plugins: + - JuliaCI/julia#v1: + version: "{{matrix.julia}}" + - JuliaCI/julia-test#v1: + test_args: "--quickfail" + - JuliaCI/julia-coverage#v1: + codecov: true + dirs: + - src + - ext + agents: + queue: "juliagpu" + cuda: "*" + env: + BACKEND_GROUP: "CUDA" + if: build.message !~ /\[skip tests\]/ && build.message !~ /\[skip ci\]/ + timeout_in_minutes: 60 + matrix: + setup: + julia: + - "1" + + - group: ":telescope: Downstream CUDA" + steps: + - label: ":julia: {{matrix.repo}} (Julia 1 + CUDA GPU)" + plugins: + - JuliaCI/julia#v1: + version: "1" + - JuliaCI/julia-coverage#v1: + codecov: true + dirs: + - src + - ext + command: julia --code-coverage=user --color=yes --project .buildkite/scripts/downstream.jl "{{matrix.repo}}" "CUDA" + agents: + queue: "juliagpu" + cuda: "*" + env: + RETESTITEMS_NWORKERS: 2 + if: build.message !~ /\[skip tests\]/ && build.message !~ /\[skip downstream\]/ && build.message !~ /\[skip ci\]/ && build.pull_request.labels includes "run downstream test" + timeout_in_minutes: 60 + matrix: + setup: + repo: + - "Boltz" + - "Lux" + + - group: ":julia: AMD GPU" + steps: + - label: ":julia: Julia: {{matrix.julia}} + AMD GPU" + plugins: + - JuliaCI/julia#v1: + version: "{{matrix.julia}}" + - JuliaCI/julia-test#v1: + test_args: "--quickfail" + - JuliaCI/julia-coverage#v1: + codecov: true + dirs: + - src + - ext + env: + JULIA_AMDGPU_CORE_MUST_LOAD: "1" + JULIA_AMDGPU_HIP_MUST_LOAD: "1" + JULIA_AMDGPU_DISABLE_ARTIFACTS: "1" + BACKEND_GROUP: "AMDGPU" + agents: + queue: "juliagpu" + rocm: "*" + rocmgpu: "*" + if: build.message !~ /\[skip tests\]/ && build.message !~ /\[skip ci\]/ + timeout_in_minutes: 60 + matrix: + setup: + julia: + - "1" + + - group: ":telescope: Downstream AMD GPU" + steps: + - label: ":julia: {{matrix.repo}} (Julia 1 + AMD GPU)" + plugins: + - JuliaCI/julia#v1: + version: "1" + - JuliaCI/julia-coverage#v1: + codecov: true + dirs: + - src + - ext + command: julia --code-coverage=user --color=yes --project .buildkite/scripts/downstream.jl "{{matrix.repo}}" "AMDGPU" + agents: + queue: "juliagpu" + rocm: "*" + rocmgpu: "*" + env: + JULIA_AMDGPU_CORE_MUST_LOAD: "1" + JULIA_AMDGPU_HIP_MUST_LOAD: "1" + JULIA_AMDGPU_DISABLE_ARTIFACTS: "1" + RETESTITEMS_NWORKERS: 2 + if: build.message !~ /\[skip tests\]/ && build.message !~ /\[skip downstream\]/ && build.message !~ /\[skip ci\]/ && build.pull_request.labels includes "run downstream test" + timeout_in_minutes: 60 + matrix: + setup: + repo: + - "Boltz" + - "Lux" + + - group: ":julia: Metal GPU" + steps: + - label: ":julia: Julia: {{matrix.julia}} + Metal" + plugins: + - JuliaCI/julia#v1: + version: "{{matrix.julia}}" + - JuliaCI/julia-test#v1: + test_args: "--quickfail" + # - JuliaCI/julia-coverage#v1: + # codecov: true + # dirs: + # - src + # - ext + agents: + queue: "juliaecosystem" + os: "macos" + arch: "aarch64" + env: + BACKEND_GROUP: "Metal" + if: build.message !~ /\[skip tests\]/ + timeout_in_minutes: 60 + matrix: + setup: + julia: + - "1" + + - group: ":julia: oneAPI GPU" + steps: + - label: ":julia: Julia: {{matrix.julia}} + oneAPI" + plugins: + - JuliaCI/julia#v1: + version: "{{matrix.julia}}" + - JuliaCI/julia-test#v1: + test_args: "--quickfail" + - JuliaCI/julia-coverage#v1: + codecov: true + dirs: + - src + - ext + env: + BACKEND_GROUP: "oneAPI" + agents: + queue: "juliagpu" + intel: "*" + if: build.message !~ /\[skip tests\]/ + timeout_in_minutes: 60 + matrix: + setup: + julia: + - "1" + +env: + RETESTITEMS_NWORKERS: 8 + RETESTITEMS_NWORKER_THREADS: 2 + RETESTITEMS_TESTITEM_TIMEOUT: 3600 + JULIA_PKG_SERVER: "" + JULIA_NUM_THREADS: 4 + SECRET_CODECOV_TOKEN: "PxSr3Y7vdbiwaoX51uGykPsogxmP1IOBt5Z8TwP9GqDxIrvFocEVV2DR4Bebee12G/HYvXtQTyYXH49DpzlsfJ7ri1GQZxd9WRr+aM1DDYmzfDCfpadp4hMoJ5NQvmc/PzeGrNWOOaewaLTUP1eEaG4suygZN0lc5q9BCchIJeqoklGms5DVt/HtfTmwoD/s4wGoIJINi4RoFgnCAkzSh11hTAkyjVerfBGWEi/8E6+WBq3UKwaW4HnT02wG9qFnD4XkHpIpjMxJTpdBn5ufKI+QoJ7qJHlwqgDCtsOCblApccLTjH/BnTahNoSb/b0wdS/cblOTrtdPGzZ5UvmQ4Q==;U2FsdGVkX1/Ji2Nqeq3tqTYCBik6iXILP+rriPRqj/qxhFu4vBWWT3UnlfqDzj6oVdXyuKt0+5e+x33x2S0mBw==" diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 8d4a003..6d7fa8d 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -3,23 +3,36 @@ on: pull_request: branches: - main + paths: + - "src/**" + - "ext/**" + - "test/**" + - "Project.toml" + - ".github/workflows/CI.yml" push: branches: - main + concurrency: # Skip intermediate builds: always. # Cancel intermediate builds: only if it is a pull request build. group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }} + jobs: - test-general: - name: Julia ${{ matrix.version }} - ubuntu-latest - ${{ github.event_name }} - runs-on: ubuntu-latest + ci: + name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ github.event_name }} + if: ${{ !contains(github.event.head_commit.message, '[skip tests]') }} + runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: version: - "1" + os: + - ubuntu-latest + - macos-latest + - windows-latest steps: - uses: actions/checkout@v4 - uses: julia-actions/setup-julia@v2 @@ -47,9 +60,62 @@ jobs: verbose: true fail_ci_if_error: true - test-mac-intel: # This is mostly for coverage purposes - name: Julia ${{ matrix.version }} - macos-latest - ${{ github.event_name }} - runs-on: macos-latest + downstream: + name: Downstream ${{ matrix.package.repo }}/${{ matrix.package.group }} + if: ${{ !contains(github.event.head_commit.message, '[skip tests]') && contains(github.event.pull_request.labels.*.name, 'run downstream test') }} + runs-on: ${{ matrix.os }} + timeout-minutes: 60 + env: + GROUP: ${{ matrix.package.group }} + strategy: + fail-fast: false + matrix: + julia-version: ["1"] + os: [ubuntu-latest] + package: + - { user: LuxDL, repo: Lux.jl, group: All } + - { user: LuxDL, repo: Boltz.jl, group: All } + steps: + - uses: actions/checkout@v4 + - uses: julia-actions/setup-julia@v2 + with: + version: ${{ matrix.julia-version }} + arch: x64 + - uses: julia-actions/julia-buildpkg@v1 + - name: Clone Downstream + uses: actions/checkout@v4 + with: + repository: ${{ matrix.package.user }}/${{ matrix.package.repo }} + path: downstream + - name: Load this and run the downstream tests + shell: julia --code-coverage=user --color=yes --project=downstream {0} + run: | + using Pkg + try + # force it to use this PR's version of the package + Pkg.develop(PackageSpec(path=".")) # resolver may fail with main deps + Pkg.update() + Pkg.test(; coverage=true) # resolver may fail with test time deps + catch err + err isa Pkg.Resolve.ResolverError || rethrow() + # If we can't resolve that means this is incompatible by SemVer and this is fine + # It means we marked this as a breaking change, so we don't need to worry about + # Mistakenly introducing a breaking change, as we have intentionally made one + @info "Not compatible with this release. No problem." exception=err + exit(0) # Exit immediately, as a success + end + - uses: julia-actions/julia-processcoverage@v1 + - uses: codecov/codecov-action@v4 + with: + files: lcov.info + token: ${{ secrets.CODECOV_TOKEN }} + verbose: true + fail_ci_if_error: true + + downgrade: + if: ${{ !contains(github.event.head_commit.message, '[skip tests]') && github.base_ref == github.event.repository.default_branch }} + name: Downgrade Julia ${{ matrix.version }} - ${{ github.event_name }} + runs-on: ubuntu-latest strategy: fail-fast: false matrix: @@ -60,20 +126,9 @@ jobs: - uses: julia-actions/setup-julia@v2 with: version: ${{ matrix.version }} - - uses: actions/cache@v4 - env: - cache-name: cache-artifacts - with: - path: ~/.julia/artifacts - key: ${{ runner.os }}-test-${{ env.cache-name }}-${{ hashFiles('**/Project.toml') }} - restore-keys: | - ${{ runner.os }}-test-${{ env.cache-name }}- - ${{ runner.os }}-test- - ${{ runner.os }}- + - uses: julia-actions/julia-downgrade-compat@v1 - uses: julia-actions/julia-buildpkg@v1 - uses: julia-actions/julia-runtest@v1 - env: - BACKEND_GROUP: Metal - uses: julia-actions/julia-processcoverage@v1 with: directories: src,ext @@ -82,4 +137,38 @@ jobs: files: lcov.info token: ${{ secrets.CODECOV_TOKEN }} verbose: true - fail_ci_if_error: true \ No newline at end of file + fail_ci_if_error: true + + invalidations: + # Only run on PRs to the default branch. + # In the PR trigger above branches can be specified only explicitly whereas this check should work for master, main, or any other default branch + if: github.base_ref == github.event.repository.default_branch + runs-on: ubuntu-latest + steps: + - uses: julia-actions/setup-julia@v2 + with: + version: "1" + - uses: actions/checkout@v4 + - uses: julia-actions/julia-buildpkg@v1 + - uses: julia-actions/julia-invalidations@v1 + id: invs_pr + + - uses: actions/checkout@v4 + with: + ref: ${{ github.event.repository.default_branch }} + - uses: julia-actions/julia-buildpkg@v1 + - uses: julia-actions/julia-invalidations@v1 + id: invs_default + + - name: Report invalidation counts + run: | + echo "Invalidations on default branch: ${{ steps.invs_default.outputs.total }} (${{ steps.invs_default.outputs.deps }} via deps)" >> $GITHUB_STEP_SUMMARY + echo "This branch: ${{ steps.invs_pr.outputs.total }} (${{ steps.invs_pr.outputs.deps }} via deps)" >> $GITHUB_STEP_SUMMARY + - name: Check if the PR does increase number of invalidations + if: steps.invs_pr.outputs.total > steps.invs_default.outputs.total + run: exit 1 + +env: + BACKEND_GROUP: "CPU" + RETESTITEMS_NWORKERS: 4 + RETESTITEMS_NWORKER_THREADS: 2 diff --git a/.github/workflows/Downgrade.yml b/.github/workflows/Downgrade.yml deleted file mode 100644 index c130098..0000000 --- a/.github/workflows/Downgrade.yml +++ /dev/null @@ -1,40 +0,0 @@ -name: Downgrade -on: - pull_request: - branches: - - main - paths-ignore: - - 'docs/**' - push: - branches: - - master - paths-ignore: - - 'docs/**' -jobs: - test: - runs-on: ubuntu-latest - strategy: - matrix: - version: ['1'] - steps: - - uses: actions/checkout@v4 - - uses: julia-actions/setup-julia@v2 - with: - version: ${{ matrix.version }} - - uses: cjdoris/julia-downgrade-compat-action@v1 - with: - skip: Pkg,TOML - - uses: julia-actions/julia-buildpkg@v1 - - uses: julia-actions/julia-runtest@v1 - env: - RETESTITEMS_NWORKERS: 4 - RETESTITEMS_NWORKER_THREADS: 2 - - uses: julia-actions/julia-processcoverage@v1 - with: - directories: src,ext - - uses: codecov/codecov-action@v4 - with: - files: lcov.info - token: ${{ secrets.CODECOV_TOKEN }} - verbose: true - fail_ci_if_error: true \ No newline at end of file diff --git a/.github/workflows/Downstream.yml b/.github/workflows/Downstream.yml deleted file mode 100644 index a3256ea..0000000 --- a/.github/workflows/Downstream.yml +++ /dev/null @@ -1,69 +0,0 @@ -name: Downstream -on: - pull_request: - branches: - - main - push: - branches: - - main -concurrency: - # Skip intermediate builds: always. - # Cancel intermediate builds: only if it is a pull request build. - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }} -jobs: - test: - name: ${{ matrix.package.repo }}/${{ matrix.package.group }} - runs-on: ${{ matrix.os }} - env: - BACKEND_GROUP: ${{ matrix.package.group }} - strategy: - fail-fast: false - matrix: - julia-version: ["1"] - os: [ubuntu-latest] - package: - - { user: LuxDL, repo: Lux.jl, group: CPU } - - { user: LuxDL, repo: Boltz.jl, group: CPU } - - { user: LuxDL, repo: LuxTestUtils.jl, group: CPU } - steps: - - uses: actions/checkout@v4 - - uses: julia-actions/setup-julia@v2 - with: - version: ${{ matrix.julia-version }} - arch: x64 - - uses: julia-actions/julia-buildpkg@v1 - - name: Clone Downstream - uses: actions/checkout@v4 - with: - repository: ${{ matrix.package.user }}/${{ matrix.package.repo }} - path: downstream - - name: Load this and run the downstream tests - shell: julia --code-coverage=user --color=yes --project=downstream {0} - run: | - using Pkg - try - # force it to use this PR's version of the package - Pkg.develop(PackageSpec(path=".")) # resolver may fail with main deps - Pkg.update() - Pkg.test() # resolver may fail with test time deps - catch err - err isa Pkg.Resolve.ResolverError || rethrow() - # If we can't resolve that means this is incompatible by SemVer and this is fine - # It means we marked this as a breaking change, so we don't need to worry about - # Mistakenly introducing a breaking change, as we have intentionally made one - @info "Not compatible with this release. No problem." exception=err - exit(0) # Exit immediately, as a success - end - env: - RETESTITEMS_NWORKERS: 4 - RETESTITEMS_NWORKER_THREADS: 2 - - uses: julia-actions/julia-processcoverage@v1 - with: - directories: src,ext - - uses: codecov/codecov-action@v4 - with: - files: lcov.info - token: ${{ secrets.CODECOV_TOKEN }} - verbose: true - fail_ci_if_error: true \ No newline at end of file diff --git a/.github/workflows/FormatCheck.yml b/.github/workflows/FormatCheck.yml deleted file mode 100644 index 0ddeb4e..0000000 --- a/.github/workflows/FormatCheck.yml +++ /dev/null @@ -1,9 +0,0 @@ -name: Format suggestions - -on: [pull_request] - -jobs: - code-style: - runs-on: ubuntu-latest - steps: - - uses: julia-actions/julia-format@v3 diff --git a/.github/workflows/Invalidations.yml b/.github/workflows/Invalidations.yml deleted file mode 100644 index 7ed9990..0000000 --- a/.github/workflows/Invalidations.yml +++ /dev/null @@ -1,40 +0,0 @@ -name: Invalidations - -on: - pull_request: - -concurrency: - # Skip intermediate builds: always. - # Cancel intermediate builds: always. - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - -jobs: - evaluate: - # Only run on PRs to the default branch. - # In the PR trigger above branches can be specified only explicitly whereas this check should work for master, main, or any other default branch - if: github.base_ref == github.event.repository.default_branch - runs-on: ubuntu-latest - steps: - - uses: julia-actions/setup-julia@v2 - with: - version: "1" - - uses: actions/checkout@v4 - - uses: julia-actions/julia-buildpkg@v1 - - uses: julia-actions/julia-invalidations@v1 - id: invs_pr - - - uses: actions/checkout@v4 - with: - ref: ${{ github.event.repository.default_branch }} - - uses: julia-actions/julia-buildpkg@v1 - - uses: julia-actions/julia-invalidations@v1 - id: invs_default - - - name: Report invalidation counts - run: | - echo "Invalidations on default branch: ${{ steps.invs_default.outputs.total }} (${{ steps.invs_default.outputs.deps }} via deps)" >> $GITHUB_STEP_SUMMARY - echo "This branch: ${{ steps.invs_pr.outputs.total }} (${{ steps.invs_pr.outputs.deps }} via deps)" >> $GITHUB_STEP_SUMMARY - - name: Check if the PR does increase number of invalidations - if: steps.invs_pr.outputs.total > steps.invs_default.outputs.total - run: exit 1 diff --git a/.github/workflows/QualityCheck.yml b/.github/workflows/QualityCheck.yml new file mode 100644 index 0000000..72323bd --- /dev/null +++ b/.github/workflows/QualityCheck.yml @@ -0,0 +1,19 @@ +name: Code Quality Check + +on: [pull_request] + +jobs: + code-style: + name: Format Suggestions + runs-on: ubuntu-latest + steps: + - uses: julia-actions/julia-format@v3 + + typos-check: + name: Spell Check with Typos + runs-on: ubuntu-latest + steps: + - name: Checkout Actions Repository + uses: actions/checkout@v4 + - name: Check spelling + uses: crate-ci/typos@v1.23.1 diff --git a/Project.toml b/Project.toml index c330162..af22874 100644 --- a/Project.toml +++ b/Project.toml @@ -40,7 +40,7 @@ LuxDeviceUtilsZygoteExt = "Zygote" LuxDeviceUtilsoneAPIExt = ["GPUArrays", "oneAPI"] [compat] -AMDGPU = "0.8.4, 0.9" +AMDGPU = "0.9.6" Adapt = "4" Aqua = "0.8.4" ArrayInterface = "7.11" @@ -48,7 +48,7 @@ CUDA = "5.2" ChainRulesCore = "1.23" ChainRulesTestUtils = "1.13.0" ComponentArrays = "0.15.8" -ExplicitImports = "1.4.1" +ExplicitImports = "1.9.0" FillArrays = "1" ForwardDiff = "0.10.36" Functors = "0.4.4" @@ -64,7 +64,6 @@ ReverseDiff = "1.15" SafeTestsets = "0.1" SparseArrays = "1.10" Test = "1.10" -TestSetExtensions = "3" Tracker = "0.2.34" Zygote = "0.6.69" julia = "1.10" @@ -86,9 +85,8 @@ ReverseDiff = "37e2e3b7-166d-5795-8a7a-e32c996b4267" SafeTestsets = "1bc83da4-3b8d-516f-aca4-4fe02f6d838f" SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" -TestSetExtensions = "98d24dd4-01ad-11ea-1b02-c9a08f80db04" Tracker = "9f7883ad-71c0-57eb-9f7f-b5c9e6d3789c" Zygote = "e88e6eb3-aa80-5325-afca-941959d7151f" [targets] -test = ["Aqua", "ArrayInterface", "ChainRulesTestUtils", "ComponentArrays", "ExplicitImports", "FillArrays", "ForwardDiff", "LuxCore", "Pkg", "Random", "RecursiveArrayTools", "ReverseDiff", "SafeTestsets", "SparseArrays", "Test", "TestSetExtensions", "Tracker", "Zygote"] +test = ["Aqua", "ArrayInterface", "ChainRulesTestUtils", "ComponentArrays", "ExplicitImports", "FillArrays", "ForwardDiff", "LuxCore", "Pkg", "Random", "RecursiveArrayTools", "ReverseDiff", "SafeTestsets", "SparseArrays", "Test", "Tracker", "Zygote"] diff --git a/codecov.yml b/codecov.yml deleted file mode 100644 index 0398f92..0000000 --- a/codecov.yml +++ /dev/null @@ -1,3 +0,0 @@ -codecov: - notify: - wait_for_ci: false diff --git a/test/amdgpu.jl b/test/amdgpu_tests.jl similarity index 99% rename from test/amdgpu.jl rename to test/amdgpu_tests.jl index 159b241..f2e6ebe 100644 --- a/test/amdgpu.jl +++ b/test/amdgpu_tests.jl @@ -1,4 +1,4 @@ -using LuxDeviceUtils, Random +using LuxDeviceUtils, Random, Test using ArrayInterface: parameterless_type @testset "CPU Fallback" begin diff --git a/test/cuda.jl b/test/cuda_tests.jl similarity index 99% rename from test/cuda.jl rename to test/cuda_tests.jl index 8ae7e54..d8e9217 100644 --- a/test/cuda.jl +++ b/test/cuda_tests.jl @@ -1,4 +1,4 @@ -using LuxDeviceUtils, Random, Functors +using LuxDeviceUtils, Random, Functors, Test using ArrayInterface: parameterless_type @testset "CPU Fallback" begin diff --git a/test/explicit_imports.jl b/test/explicit_imports.jl deleted file mode 100644 index 6cf767e..0000000 --- a/test/explicit_imports.jl +++ /dev/null @@ -1,6 +0,0 @@ -# Load all trigger packages -import FillArrays, RecursiveArrayTools, SparseArrays, Zygote -using ExplicitImports, LuxDeviceUtils - -@test check_no_implicit_imports(LuxDeviceUtils) === nothing -@test check_no_stale_explicit_imports(LuxDeviceUtils) === nothing diff --git a/test/metal.jl b/test/metal_tests.jl similarity index 99% rename from test/metal.jl rename to test/metal_tests.jl index 5c500bf..1e7ce23 100644 --- a/test/metal.jl +++ b/test/metal_tests.jl @@ -1,4 +1,4 @@ -using LuxDeviceUtils, Random +using LuxDeviceUtils, Random, Test @testset "CPU Fallback" begin @test !LuxDeviceUtils.functional(LuxMetalDevice) diff --git a/test/misc.jl b/test/misc_tests.jl similarity index 100% rename from test/misc.jl rename to test/misc_tests.jl diff --git a/test/oneapi.jl b/test/oneapi_tests.jl similarity index 99% rename from test/oneapi.jl rename to test/oneapi_tests.jl index 619ef8d..9cdd9ef 100644 --- a/test/oneapi.jl +++ b/test/oneapi_tests.jl @@ -1,4 +1,4 @@ -using LuxDeviceUtils, Random +using LuxDeviceUtils, Random, Test @testset "CPU Fallback" begin @test !LuxDeviceUtils.functional(LuxoneAPIDevice) diff --git a/test/qa_tests.jl b/test/qa_tests.jl new file mode 100644 index 0000000..bc177fb --- /dev/null +++ b/test/qa_tests.jl @@ -0,0 +1,17 @@ +using Aqua, ExplicitImports, LuxDeviceUtils, Test + +@testset "Aqua Tests" begin + Aqua.test_all(LuxDeviceUtils) +end + +import FillArrays, RecursiveArrayTools, SparseArrays, Zygote + +@testset "Explicit Imports" begin + @test check_no_implicit_imports(LuxDeviceUtils) === nothing + @test check_no_stale_explicit_imports(LuxDeviceUtils) === nothing + @test check_no_self_qualified_accesses(LuxDeviceUtils) === nothing + @test check_all_explicit_imports_via_owners(LuxDeviceUtils) === nothing + @test check_all_qualified_accesses_via_owners(LuxDeviceUtils) === nothing + @test_broken check_all_explicit_imports_are_public(LuxDeviceUtils) === nothing # mostly upstream problems + @test_broken check_all_qualified_accesses_are_public(LuxDeviceUtils) === nothing # mostly upstream problem +end diff --git a/test/runtests.jl b/test/runtests.jl index d73d63a..8b170d3 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1,34 +1,34 @@ import Pkg -using Aqua, SafeTestsets, Test, LuxDeviceUtils, TestSetExtensions +using SafeTestsets, Test -const BACKEND_GROUP = get(ENV, "BACKEND_GROUP", "NONE") +const BACKEND_GROUP = lowercase(get(ENV, "BACKEND_GROUP", "NONE")) -@testset ExtendedTestSet "LuxDeviceUtils Tests" begin - if BACKEND_GROUP == "CUDA" || BACKEND_GROUP == "ALL" - Pkg.add("LuxCUDA") - @safetestset "CUDA" include("cuda.jl") - end +const EXTRA_PKGS = String[] - if BACKEND_GROUP == "AMDGPU" || BACKEND_GROUP == "ALL" - Pkg.add("AMDGPU") - @safetestset "AMDGPU" include("amdgpu.jl") - end +(BACKEND_GROUP == "all" || BACKEND_GROUP == "cuda") && push!(EXTRA_PKGS, "LuxCUDA") +(BACKEND_GROUP == "all" || BACKEND_GROUP == "amdgpu") && push!(EXTRA_PKGS, "AMDGPU") +(BACKEND_GROUP == "all" || BACKEND_GROUP == "oneapi") && push!(EXTRA_PKGS, "oneAPI") +(BACKEND_GROUP == "all" || BACKEND_GROUP == "metal") && push!(EXTRA_PKGS, "Metal") - if BACKEND_GROUP == "Metal" || BACKEND_GROUP == "ALL" - Pkg.add("Metal") - @safetestset "Metal" include("metal.jl") - end +if !isempty(EXTRA_PKGS) + @info "Installing Extra Packages for testing" EXTRA_PKGS=EXTRA_PKGS + Pkg.add(EXTRA_PKGS) + Pkg.update() + Base.retry_load_extensions() + Pkg.instantiate() +end - if BACKEND_GROUP == "oneAPI" || BACKEND_GROUP == "ALL" - Pkg.add("oneAPI") - @safetestset "oneAPI" include("oneapi.jl") +@testset "LuxDeviceUtils Tests" begin + file_names = BACKEND_GROUP == "all" ? + ["cuda_tests.jl", "amdgpu_tests.jl", "metal_tests.jl", "oneapi_tests.jl"] : + (BACKEND_GROUP == "cpu" ? [] : [BACKEND_GROUP * "_tests.jl"]) + @testset "$(file_name)" for file_name in file_names + run(`$(Base.julia_cmd()) --color=yes --project=$(dirname(Pkg.project().path)) + --startup-file=no --code-coverage=user $(@__DIR__)/$file_name`) + Test.@test true end - @testset "Others" begin - @testset "Aqua Tests" Aqua.test_all(LuxDeviceUtils) - - @safetestset "Misc Tests" include("misc.jl") + @safetestset "Misc Tests" include("misc_tests.jl") - @safetestset "Explicit Imports" include("explicit_imports.jl") - end + @safetestset "QA Tests" include("qa_tests.jl") end