From a46a85f79715925abf8cc1b298d244e108033326 Mon Sep 17 00:00:00 2001 From: Ian Butterworth Date: Fri, 5 Jan 2024 12:36:56 -0500 Subject: [PATCH] add test for julia install and mtime maintenance (#200) --- .github/scripts/common-tests.jl | 11 +++++++++++ .github/workflows/example-builds-defaultarch.yml | 2 ++ .../workflows/example-builds-nightly-defaultarch.yml | 2 ++ .github/workflows/example-builds-nightly.yml | 2 ++ .github/workflows/example-builds.yml | 2 ++ 5 files changed, 19 insertions(+) create mode 100644 .github/scripts/common-tests.jl diff --git a/.github/scripts/common-tests.jl b/.github/scripts/common-tests.jl new file mode 100644 index 0000000..45e2b82 --- /dev/null +++ b/.github/scripts/common-tests.jl @@ -0,0 +1,11 @@ +if !occursin("hostedtoolcache", Sys.BINDIR) + error("the wrong julia is being used: $(Sys.BINDIR)") +end +if VERSION >= v"1.7.0" # pkgdir was introduced here, and before then mtime wasn't a problem so just skip + using Pkg + src = pkgdir(Pkg, "src", "Pkg.jl") + # mtime is when it's compressed, ctime is when the file is extracted + if mtime(src) >= ctime(src) + error("source mtime ($(mtime(src))) is not earlier than ctime ($(ctime(src)))") + end +end diff --git a/.github/workflows/example-builds-defaultarch.yml b/.github/workflows/example-builds-defaultarch.yml index a469aff..23740c8 100644 --- a/.github/workflows/example-builds-defaultarch.yml +++ b/.github/workflows/example-builds-defaultarch.yml @@ -44,3 +44,5 @@ jobs: version: ${{ matrix.julia-version }} - run: julia --version - run: julia --compile=min -O0 -e 'import InteractiveUtils; InteractiveUtils.versioninfo()' + - name: "Check that the correct julia is used and that archive mtimes are maintained" + run: julia --startup-file=no --color=yes ./.github/scripts/common-tests.jl diff --git a/.github/workflows/example-builds-nightly-defaultarch.yml b/.github/workflows/example-builds-nightly-defaultarch.yml index 1099f79..2fb1393 100644 --- a/.github/workflows/example-builds-nightly-defaultarch.yml +++ b/.github/workflows/example-builds-nightly-defaultarch.yml @@ -42,3 +42,5 @@ jobs: version: ${{ matrix.julia-version }} - run: julia --version - run: julia --compile=min -O0 -e 'import InteractiveUtils; InteractiveUtils.versioninfo()' + - name: "Check that the correct julia is used and that archive mtimes are maintained" + run: julia --startup-file=no --color=yes ./.github/scripts/common-tests.jl diff --git a/.github/workflows/example-builds-nightly.yml b/.github/workflows/example-builds-nightly.yml index 2ebee2f..21190a6 100644 --- a/.github/workflows/example-builds-nightly.yml +++ b/.github/workflows/example-builds-nightly.yml @@ -50,3 +50,5 @@ jobs: arch: ${{ matrix.julia-arch }} - run: julia --version - run: julia --compile=min -O0 -e 'import InteractiveUtils; InteractiveUtils.versioninfo()' + - name: "Check that the correct julia is used and that archive mtimes are maintained" + run: julia --startup-file=no --color=yes ./.github/scripts/common-tests.jl diff --git a/.github/workflows/example-builds.yml b/.github/workflows/example-builds.yml index c940202..0515b12 100644 --- a/.github/workflows/example-builds.yml +++ b/.github/workflows/example-builds.yml @@ -50,3 +50,5 @@ jobs: arch: ${{ matrix.julia-arch }} - run: julia --version - run: julia --compile=min -O0 -e 'import InteractiveUtils; InteractiveUtils.versioninfo()' + - name: "Check that the correct julia is used and that archive mtimes are maintained" + run: julia --startup-file=no --color=yes ./.github/scripts/common-tests.jl