From 4dfe91d3ae2ef53f2eb57f948e115a9431f77685 Mon Sep 17 00:00:00 2001 From: Avik Pal Date: Mon, 8 Jul 2024 18:34:37 -0700 Subject: [PATCH] ci(github-actions): redundant workflow + formatpr --- .github/workflows/Downstream.yml | 69 -------------------------------- .github/workflows/FormatPR.yml | 29 ++++++++++++++ test/qa_tests.jl | 2 +- test/runtests.jl | 2 +- 4 files changed, 31 insertions(+), 71 deletions(-) delete mode 100644 .github/workflows/Downstream.yml create mode 100644 .github/workflows/FormatPR.yml 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/FormatPR.yml b/.github/workflows/FormatPR.yml new file mode 100644 index 0000000..daf708c --- /dev/null +++ b/.github/workflows/FormatPR.yml @@ -0,0 +1,29 @@ +name: FormatPR +on: + schedule: + - cron: '0 0 * * *' +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Install JuliaFormatter and format + run: | + julia -e 'using Pkg; Pkg.add(PackageSpec(name="JuliaFormatter"))' + julia -e 'using JuliaFormatter; format(".")' + # https://github.com/marketplace/actions/create-pull-request + # https://github.com/peter-evans/create-pull-request#reference-example + - name: Create Pull Request + id: cpr + uses: peter-evans/create-pull-request@v6 + with: + token: ${{ secrets.GITHUB_TOKEN }} + commit-message: Format .jl files + title: 'Automatic JuliaFormatter.jl run' + branch: auto-juliaformatter-pr + delete-branch: true + labels: formatting, automated pr, no changelog + - name: Check outputs + run: | + echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}" + echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}" \ No newline at end of file diff --git a/test/qa_tests.jl b/test/qa_tests.jl index 8b42a76..bc177fb 100644 --- a/test/qa_tests.jl +++ b/test/qa_tests.jl @@ -1,4 +1,4 @@ -using Aqua, LuxDeviceUtils, Test +using Aqua, ExplicitImports, LuxDeviceUtils, Test @testset "Aqua Tests" begin Aqua.test_all(LuxDeviceUtils) diff --git a/test/runtests.jl b/test/runtests.jl index 9726863..8b170d3 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -21,7 +21,7 @@ end @testset "LuxDeviceUtils Tests" begin file_names = BACKEND_GROUP == "all" ? ["cuda_tests.jl", "amdgpu_tests.jl", "metal_tests.jl", "oneapi_tests.jl"] : - [BACKEND_GROUP * "_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`)