Skip to content

Commit 2a1df75

Browse files
committed
Add tests.
1 parent 499595a commit 2a1df75

File tree

2 files changed

+25
-15
lines changed

2 files changed

+25
-15
lines changed

.github/workflows/ci.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ on:
66
pull_request:
77
jobs:
88
test:
9-
name: Julia ${{ matrix.version }} - ${{ matrix.build_version }}
9+
name: Julia ${{ matrix.version }} - ${{ matrix.build_spec }}
1010
runs-on: ${{ matrix.os }}
1111
strategy:
1212
fail-fast: false
@@ -19,14 +19,14 @@ jobs:
1919
- ubuntu-latest
2020
arch:
2121
- x64
22-
build_version:
22+
build_spec:
2323
- v1.5.0 # entry straight in Versions.toml
2424
- nightly # entry from Builds.toml
2525
- 8cb458c6dcd8e067a3bd430b006efb0dfde56cf9 # directly from Git, never built
2626
- master # directly from Git, likely built
2727
env:
2828
JULIA_DEBUG: NewPkgEval
29-
JULIA_VERSION: ${{ matrix.build_version }}
29+
JULIA_SPEC: ${{ matrix.build_spec }}
3030
steps:
3131
- uses: actions/checkout@v2
3232
- uses: julia-actions/setup-julia@v1

test/runtests.jl

+22-12
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
11
using PkgEval
22
using Test
33

4-
# determine the version to use
5-
const version = get(ENV, "JULIA_VERSION", string(VERSION))
6-
@info "Testing with Julia $version"
7-
const julia = PkgEval.obtain_julia(version)::VersionNumber
8-
@info "Resolved to Julia v$julia"
9-
const install = PkgEval.prepare_julia(julia)
4+
# determine which Julia to use
5+
const julia_spec = get(ENV, "JULIA_SPEC", string(VERSION))
6+
@info "Testing with Julia $julia_spec"
7+
const julia_version = PkgEval.obtain_julia(julia_spec)::VersionNumber
8+
@info "Resolved to Julia v$julia_version"
9+
const julia_install = PkgEval.prepare_julia(julia_version)
1010

1111
@testset "sandbox" begin
1212
PkgEval.prepare_runner()
1313
mktemp() do path, io
14-
PkgEval.run_sandboxed_julia(install, `-e 'print(1337)'`; stdout=io,
14+
PkgEval.run_sandboxed_julia(julia_install, `-e 'print(1337)'`; stdout=io,
1515
tty=false, interactive=false)
1616
close(io)
1717
@test read(path, String) == "1337"
1818
end
1919

2020
# print versioninfo so we can verify in CI logs that the correct version is used
21-
PkgEval.run_sandboxed_julia(install, `-e 'using InteractiveUtils; versioninfo()'`;
21+
PkgEval.run_sandboxed_julia(julia_install, `-e 'using InteractiveUtils; versioninfo()'`;
2222
tty=false, interactive=false)
2323
end
2424

@@ -30,13 +30,23 @@ const pkgnames = ["TimerOutputs", "Crayons", "Example", "Gtk"]
3030
pkgs = PkgEval.read_pkgs(pkgnames)
3131

3232
# timeouts
33-
results = PkgEval.run([julia], pkgs; time_limit = 0.1)
33+
results = PkgEval.run([Configuration(julia=julia_version)], pkgs; time_limit = 0.1)
3434
@test all(results.status .== :kill)
3535
end
3636

3737
@testset "main entrypoint" begin
38-
results = PkgEval.run([julia], pkgnames)
39-
if !(version == "master" || version == "nightly")
38+
results = PkgEval.run([Configuration(julia=julia_version)], pkgnames)
39+
if !(julia_version == "master" || julia_version == "nightly")
40+
@test all(results.status .== :ok)
41+
for result in eachrow(results)
42+
@test occursin("Testing $(result.name) tests passed", result.log)
43+
end
44+
end
45+
end
46+
47+
@testset "PackageCompiler" begin
48+
results = PkgEval.run([Configuration(julia=julia_version, compiled=true)], ["Example"])
49+
if !(julia_version == "master" || julia_version == "nightly")
4050
@test all(results.status .== :ok)
4151
for result in eachrow(results)
4252
@test occursin("Testing $(result.name) tests passed", result.log)
@@ -52,4 +62,4 @@ end
5262
end
5363

5464
PkgEval.purge()
55-
rm(install; recursive=true)
65+
rm(julia_install; recursive=true)

0 commit comments

Comments
 (0)