Test cache action against Julia 1.0 and nightly (#101)

* CI test action on Julia 1.0

* Avoid quoting Julia shell string

* Test against Julia nightly
This commit is contained in:
Curtis Vogt
2024-01-15 15:20:46 -06:00
committed by GitHub
parent 0c5d92d73a
commit b3b34e3264

View File

@@ -35,20 +35,32 @@ jobs:
needs: generate-key needs: generate-key
strategy: strategy:
matrix: matrix:
dep: nested:
- name: pandoc_jll - name: matrix
version: "3"
invalid-chars: "," # Use invalid characters in job matrix to ensure we escape them invalid-chars: "," # Use invalid characters in job matrix to ensure we escape them
version:
- "1.0"
- "1"
- "nightly"
os: os:
- ubuntu-latest - ubuntu-latest
- windows-latest - windows-latest
- macOS-latest - macOS-latest
exclude:
# Test Julia "1.0" on Linux only
- version: "1.0"
os: windows-latest
- version: "1.0"
os: macOS-latest
fail-fast: false fail-fast: false
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
env: env:
JULIA_DEPOT_PATH: /tmp/julia-depot JULIA_DEPOT_PATH: /tmp/julia-depot
steps: steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- uses: julia-actions/setup-julia@v1
with:
version: ${{ matrix.version }}
- name: Save cache - name: Save cache
id: cache id: cache
uses: ./ uses: ./
@@ -56,13 +68,21 @@ jobs:
cache-name: ${{ needs.generate-key.outputs.cache-name }}-matrix cache-name: ${{ needs.generate-key.outputs.cache-name }}-matrix
delete-old-caches: required delete-old-caches: required
- name: Check no artifacts dir - name: Check no artifacts dir
shell: 'julia --color=yes {0}' shell: julia --color=yes {0}
run: | run: |
dir = joinpath(first(DEPOT_PATH), "artifacts") dir = joinpath(first(DEPOT_PATH), "artifacts")
@assert !isdir(dir) @assert !isdir(dir)
- name: Install a small binary - name: Install a small binary
shell: 'julia --color=yes {0}' shell: julia --color=yes {0}
run: 'using Pkg; Pkg.add(PackageSpec(name="${{ matrix.dep.name }}", version="${{ matrix.dep.version }}"))' run: |
using Pkg
if VERSION >= v"1.3"
Pkg.add(PackageSpec(name="pandoc_jll", version="3"))
else
Pkg.add(PackageSpec(name="Scratch", version="1"))
using Scratch
get_scratch!("test")
end
# Do tests with no matrix also given the matrix is auto-included in cache key # Do tests with no matrix also given the matrix is auto-included in cache key
test-save-nomatrix: test-save-nomatrix:
@@ -77,32 +97,52 @@ jobs:
cache-name: ${{ needs.generate-key.outputs.cache-name }}-nomatrix cache-name: ${{ needs.generate-key.outputs.cache-name }}-nomatrix
delete-old-caches: required delete-old-caches: required
- name: Check no artifacts dir - name: Check no artifacts dir
shell: 'julia --color=yes {0}' shell: julia --color=yes {0}
run: | run: |
dir = joinpath(first(DEPOT_PATH), "artifacts") dir = joinpath(first(DEPOT_PATH), "artifacts")
@assert !isdir(dir) @assert !isdir(dir)
- name: Install a small binary - name: Install a small binary
shell: 'julia --color=yes {0}' shell: julia --color=yes {0}
run: 'using Pkg; Pkg.add("pandoc_jll")' run: |
using Pkg
if VERSION >= v"1.3"
Pkg.add(PackageSpec(name="pandoc_jll", version="3"))
else
Pkg.add(PackageSpec(name="Scratch", version="1"))
using Scratch
get_scratch!("test")
end
test-restore: test-restore:
needs: [generate-key, test-save] needs: [generate-key, test-save]
strategy: strategy:
matrix: matrix:
dep: nested:
- name: pandoc_jll - name: matrix
version: "3"
invalid-chars: "," # Use invalid characters in job matrix to ensure we escape them invalid-chars: "," # Use invalid characters in job matrix to ensure we escape them
version:
- "1.0"
- "1"
- "nightly"
os: os:
- ubuntu-latest - ubuntu-latest
- windows-latest - windows-latest
- macOS-latest - macOS-latest
exclude:
# Test Julia "1.0" on Linux only
- version: "1.0"
os: windows-latest
- version: "1.0"
os: macOS-latest
fail-fast: false fail-fast: false
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
env: env:
JULIA_DEPOT_PATH: /tmp/julia-depot JULIA_DEPOT_PATH: /tmp/julia-depot
steps: steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- uses: julia-actions/setup-julia@v1
with:
version: ${{ matrix.version }}
- name: Restore cache - name: Restore cache
id: cache id: cache
uses: ./ uses: ./
@@ -111,18 +151,22 @@ jobs:
# Cannot require a successful cache delete on forked PRs as the permissions for actions is limited to read # Cannot require a successful cache delete on forked PRs as the permissions for actions is limited to read
delete-old-caches: ${{ github.event.pull_request.head.repo.fork && 'false' || 'required' }} delete-old-caches: ${{ github.event.pull_request.head.repo.fork && 'false' || 'required' }}
- name: Test cache-hit output - name: Test cache-hit output
shell: 'julia --color=yes {0}' shell: julia --color=yes {0}
run: | run: |
@show ENV["cache-hit"] @show ENV["cache-hit"]
@assert ENV["cache-hit"] == "true" @assert ENV["cache-hit"] == "true"
env: env:
cache-hit: ${{ steps.cache.outputs.cache-hit }} cache-hit: ${{ steps.cache.outputs.cache-hit }}
- name: Check existance or emptiness of affected dirs - name: Check existance or emptiness of affected dirs
shell: 'julia --color=yes {0}' shell: julia --color=yes {0}
run: | run: |
# These dirs should exist as they've been cached # These dirs should exist as they've been cached
artifacts_dir = joinpath(first(DEPOT_PATH), "artifacts") artifacts_dir = joinpath(first(DEPOT_PATH), "artifacts")
@assert !isempty(readdir(artifacts_dir)) if VERSION >= v"1.3"
@assert !isempty(readdir(artifacts_dir))
else
@assert !isdir(artifacts_dir)
end
packages_dir = joinpath(first(DEPOT_PATH), "packages") packages_dir = joinpath(first(DEPOT_PATH), "packages")
@assert !isempty(readdir(packages_dir)) @assert !isempty(readdir(packages_dir))
compiled_dir = joinpath(first(DEPOT_PATH), "compiled") compiled_dir = joinpath(first(DEPOT_PATH), "compiled")
@@ -145,18 +189,22 @@ jobs:
# Cannot require a successful cache delete on forked PRs as the permissions for actions is limited to read # Cannot require a successful cache delete on forked PRs as the permissions for actions is limited to read
delete-old-caches: ${{ github.event.pull_request.head.repo.fork && 'false' || 'required' }} delete-old-caches: ${{ github.event.pull_request.head.repo.fork && 'false' || 'required' }}
- name: Test cache-hit output - name: Test cache-hit output
shell: 'julia --color=yes {0}' shell: julia --color=yes {0}
run: | run: |
@show ENV["cache-hit"] @show ENV["cache-hit"]
@assert ENV["cache-hit"] == "true" @assert ENV["cache-hit"] == "true"
env: env:
cache-hit: ${{ steps.cache.outputs.cache-hit }} cache-hit: ${{ steps.cache.outputs.cache-hit }}
- name: Check existance or emptiness of affected dirs - name: Check existance or emptiness of affected dirs
shell: 'julia --color=yes {0}' shell: julia --color=yes {0}
run: | run: |
# These dirs should exist as they've been cached # These dirs should exist as they've been cached
artifacts_dir = joinpath(first(DEPOT_PATH), "artifacts") artifacts_dir = joinpath(first(DEPOT_PATH), "artifacts")
@assert !isempty(readdir(artifacts_dir)) if VERSION >= v"1.3"
@assert !isempty(readdir(artifacts_dir))
else
@assert !isdir(artifacts_dir)
end
packages_dir = joinpath(first(DEPOT_PATH), "packages") packages_dir = joinpath(first(DEPOT_PATH), "packages")
@assert !isempty(readdir(packages_dir)) @assert !isempty(readdir(packages_dir))
compiled_dir = joinpath(first(DEPOT_PATH), "compiled") compiled_dir = joinpath(first(DEPOT_PATH), "compiled")