diff --git a/.github/workflows/CI.yaml b/.github/workflows/CI.yaml index b393b43..56a1e22 100644 --- a/.github/workflows/CI.yaml +++ b/.github/workflows/CI.yaml @@ -23,7 +23,7 @@ concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }} jobs: - test: + unit-test: name: Julia ${{ matrix.version }} - ${{ matrix.runs-on }} - ${{ matrix.arch }} - ${{ matrix.threads}} threads # These permissions are needed to: # - Delete old caches: https://github.com/julia-actions/cache#cache-retention @@ -44,6 +44,7 @@ jobs: threads: - 1 env: + RUN_TESTS: unit,quality-assurance JULIA_NUM_THREADS: ${{ matrix.threads }} steps: - uses: actions/checkout@v4 @@ -60,6 +61,11 @@ jobs: integration-test: name: Integration Test - Julia ${{ matrix.julia-version }} - K8s ${{ matrix.k8s-version }} - minikube ${{ matrix.minikube-version }} + # These permissions are needed to: + # - Delete old caches: https://github.com/julia-actions/cache#cache-retention + permissions: + actions: write + contents: read runs-on: ubuntu-latest strategy: fail-fast: false @@ -76,9 +82,14 @@ jobs: minikube-version: - "1.32.0" env: + RUN_TESTS: integration SKAFFOLD_INTERACTIVE: "false" # Disable survey prompts steps: - uses: actions/checkout@v4 + - uses: julia-actions/setup-julia@v1 + with: + version: ${{ matrix.julia-version }} + - uses: julia-actions/cache@v1 - uses: yokawasa/action-setup-kube-tools@v0.11.0 with: setup-tools: |- @@ -106,3 +117,8 @@ jobs: JULIA_VERSION: ${{ matrix.julia-version }} run: skaffold build working-directory: test/integration + - uses: julia-actions/julia-runtest@v1 + - uses: julia-actions/julia-processcoverage@v1 + - uses: codecov/codecov-action@v3 + with: + file: lcov.info diff --git a/test/integration.jl b/test/integration.jl new file mode 100644 index 0000000..945e72c --- /dev/null +++ b/test/integration.jl @@ -0,0 +1 @@ +@test false diff --git a/test/runtests.jl b/test/runtests.jl index af18fe9..72c73fe 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -7,16 +7,41 @@ using Mocking: Mocking, @mock, @patch, apply using Sockets: localhost using Test +const RUN_TESTS = let + valid_types = ("unit", "integration", "quality_assurance") + run_tests = get(ENV, "RUN_TESTS", "unit,quality-assurance") + types = map(t -> replace(t, '-' => '_'), split(run_tests, ',')) + NamedTuple([Symbol(t) => t in types for t in valid_types]) +end + # https://en.wikipedia.org/wiki/Ephemeral_port const EPHEMERAL_PORT_RANGE = 49152:65535 Mocking.activate() @testset "K8sDeputy.jl" begin - @testset "Aqua" begin - Aqua.test_all(K8sDeputy; ambiguities=false) + if RUN_TESTS.quality_assurance + @testset "Quality Assurance" begin + Aqua.test_all(K8sDeputy; ambiguities=false) + end + else + @warn "Skipping quality assurance tests" end - include("graceful_termination.jl") - include("health.jl") + if RUN_TESTS.unit + @testset "Unit" begin + include("graceful_termination.jl") + include("health.jl") + end + else + @warn "Skipping unit tests" + end + + if RUN_TESTS.integration + @testset "Integration" begin + include("integration.jl") + end + else + @warn "Skipping integration tests" + end end