Skip to content

Commit

Permalink
Add separate environment for code quality test
Browse files Browse the repository at this point in the history
  • Loading branch information
albertomercurio committed Apr 8, 2024
1 parent bedaf06 commit 7e0dfb7
Show file tree
Hide file tree
Showing 8 changed files with 73 additions and 19 deletions.
54 changes: 54 additions & 0 deletions .github/workflows/CI-Code-Quality.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Code Quality Tests

on:
push:
branches:
- 'main'
paths-ignore:
- 'docs/**'
pull_request:
branches:
- 'main'
paths-ignore:
- 'docs/**'
types:
- opened
- reopened
- synchronize
- ready_for_review

jobs:
test:
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} ( ${{ matrix.group }} )
runs-on: ${{ matrix.os }}
permissions: # needed to allow julia-actions/cache to delete old caches that it has created
actions: write
contents: read
if: ${{ !github.event.pull_request.draft }}
strategy:
fail-fast: false
matrix:
version: [1]
os: [ubuntu-latest]
arch: [x64]
group: ['Code Quality']

steps:
- uses: actions/checkout@v4
- uses: julia-actions/setup-julia@v2
with:
version: ${{ matrix.version }}
arch: ${{ matrix.arch }}
- uses: julia-actions/cache@v1
# - uses: julia-actions/julia-buildpkg@v1
- name: Create and set up the code-quality environment
run: |
julia --project=test/code-quality -e '
import Pkg
Pkg.develop(path=".") # Develop the QuantumToolbox package
Pkg.instantiate()
Pkg.precompile()
'
- name: Run the code-quality tests
run: julia --project=test/code-quality test/code-quality/runtests.jl

7 changes: 0 additions & 7 deletions .github/workflows/CI.yml → .github/workflows/CI-Core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,6 @@ jobs:
group:
- Core

# for code quality
include:
- version: '1'
os: 'ubuntu-latest'
arch: 'x64'
group: 'Code Quality'

steps:
- uses: actions/checkout@v4
- uses: julia-actions/setup-julia@v2
Expand Down
6 changes: 1 addition & 5 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,11 @@ SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
SpecialFunctions = "276daf66-3868-5448-9aa4-cd146d93841b"

[compat]
Aqua = "0.8"
DiffEqCallbacks = "2, 3"
Distributed = "<0.0.1, 1"
FFTW = "1.5"
Graphs = "1.7"
IncompleteLU = "0.2"
JET = "0.8"
LinearAlgebra = "<0.0.1, 1"
LinearMaps = "3"
LinearSolve = "2"
Expand All @@ -38,9 +36,7 @@ Test = "<0.0.1, 1"
julia = "1.7"

[extras]
Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595"
JET = "c3a54625-cd67-489e-a8e7-0a5a0ff4e31b"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[targets]
test = ["Aqua", "JET", "Test"]
test = ["Test"]
3 changes: 3 additions & 0 deletions test/code-quality/Project.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[deps]
Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595"
JET = "c3a54625-cd67-489e-a8e7-0a5a0ff4e31b"
File renamed without changes.
File renamed without changes.
15 changes: 15 additions & 0 deletions test/code-quality/runtests.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using Test
using QuantumToolbox
using Aqua
using JET

const GROUP = get(ENV, "GROUP", "All")

const testdir = dirname(@__FILE__)

if (GROUP == "All") || (GROUP == "Code Quality")
using Aqua
using JET
include(joinpath(testdir, "aqua.jl"))
include(joinpath(testdir, "jet.jl"))
end
7 changes: 0 additions & 7 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,6 @@ core_tests = [
"wigner.jl",
]

if (GROUP == "All") || (GROUP == "Code Quality")
using Aqua
using JET
include(joinpath(testdir, "aqua.jl"))
include(joinpath(testdir, "jet.jl"))
end

if (GROUP == "All") || (GROUP == "Core")
for test in core_tests
include(joinpath(testdir, test))
Expand Down

0 comments on commit 7e0dfb7

Please sign in to comment.