Skip to content

Commit

Permalink
Isolated bundle tests
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelHatherly committed Jun 20, 2024
1 parent bbad8b7 commit fe8a6ee
Show file tree
Hide file tree
Showing 5 changed files with 102 additions and 2 deletions.
63 changes: 61 additions & 2 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,17 @@ permissions:
jobs:
finalize:
timeout-minutes: 10
needs: [test]
needs: [test, isolated-tests]
if: always()
runs-on: ubuntu-latest
steps:
- run: |
echo test-bundle: ${{ needs.test.result }}
echo isolated-tests: ${{ needs.isolated-tests.result }}
- run: exit 1
if: |
(needs.test.result != 'success')
(needs.test.result != 'success') ||
(needs.isolated-tests.result != 'success')
test:
runs-on: ${{ matrix.os }}
Expand All @@ -54,3 +56,60 @@ jobs:
- uses: julia-actions/cache@d48542bb7b6239a9391789f01d21a6bdde9ad5df
- uses: julia-actions/julia-buildpkg@90dd6f23eb49626e4e6612cb9d64d456f86e6a1c
- uses: julia-actions/julia-runtest@79a7e100883947123f8263c5f06e6c0ea3eb972f
- uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808
with:
name: bundle-${{ matrix.os }}
path: test/build/LocalCustomRegistry

isolated-tests:
needs: [test]
runs-on: ${{ matrix.os }}
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
version:
- "1.10"
os:
- macos-latest
- ubuntu-latest
- windows-latest
bundle:
- bundle-macos-latest
- bundle-ubuntu-latest
- bundle-windows-latest

steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
with:
persist-credentials: false

- uses: julia-actions/install-juliaup@2ad49a51b33d519705c111f7b6fe9d069f356da5
with:
channel: "${{ matrix.version }}"

- uses: julia-actions/cache@d48542bb7b6239a9391789f01d21a6bdde9ad5df

- uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e
with:
name: ${{ matrix.bundle }}
path: ${{ matrix.bundle }}

- name: Initialize Julia Depot
run: julia -e 'import Pkg; Pkg.status()'

- name: Install bundle
run: julia ${{ matrix.bundle }}/registry/install.jl

- name: Installing the same bundle again should uninstall and reinstall
run: julia ${{ matrix.bundle }}/registry/install.jl

- name: Instantiate scripts project
run: julia --startup-file=no --project=test/scripts -e 'import Pkg; Pkg.instantiate()'

- name: Verify bundle
run: julia --startup-file=no --project=test/scripts test/scripts/verify.jl

- name: Remove bundle
run: julia --startup-file=no --project=test/scripts test/scripts/remove.jl
if: always()
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/Manifest.toml
/test/Manifest.toml
/test/scripts/Manifest.toml
/test/packages/**/Manifest.toml
/test/environments/**/Manifest.toml
*.pem
Expand Down
4 changes: 4 additions & 0 deletions test/scripts/Project.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[deps]
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
TOML = "fa267f1f-6049-4f14-aa54-33bafae1ed76"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
13 changes: 13 additions & 0 deletions test/scripts/remove.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using Test

@testset "Remove Bundles" begin
count = 0
for depot in DEPOT_PATH
path = joinpath(depot, "registries", "LocalCustomRegistry", "remove.jl")
if isfile(path)
run(`julia --startup-file=no $path`)
count += 1
end
end
@test count == 1
end
23 changes: 23 additions & 0 deletions test/scripts/verify.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using Test
import Pkg
import TOML

@testset "Verify Bundles" begin
count = 0
env_dir = joinpath(DEPOT_PATH[1], "environments")
for named_env in readdir(env_dir)
if contains(named_env, "Bundle")
manifest_toml_file = joinpath(env_dir, named_env, "Manifest.toml")
@assert isfile(manifest_toml_file)
manifest_toml = TOML.parsefile(manifest_toml_file)
resolved_version = manifest_toml["julia_version"]
output = readchomp(
`julia +$resolved_version --startup-file=no --project=@$named_env -e "import TestPackage; TestPackage.greet()"`,
)
package_version = manifest_toml["deps"]["TestPackage"][1]["version"]
@test contains(output, "Hello, $(package_version)!")
count += 1
end
end
@test count == 4
end

0 comments on commit fe8a6ee

Please sign in to comment.