mirror of
https://github.com/julia-actions/cache.git
synced 2026-02-12 09:26:53 +08:00
Bumps [actions/checkout](https://github.com/actions/checkout) from 4.1.4 to 4.1.6.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](0ad4b8fada...a5ac7e51b4)
---
updated-dependencies:
- dependency-name: actions/checkout
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
281 lines
9.2 KiB
YAML
281 lines
9.2 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
paths:
|
|
- 'action.yml'
|
|
- 'handle_caches.jl'
|
|
- '.github/**'
|
|
pull_request:
|
|
paths:
|
|
- 'action.yml'
|
|
- 'handle_caches.jl'
|
|
- '.github/**'
|
|
|
|
# needed to allow julia-actions/cache to delete old caches that it has created
|
|
permissions:
|
|
actions: write
|
|
contents: read
|
|
|
|
jobs:
|
|
generate-prefix:
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
cache-prefix: ${{ steps.name.outputs.cache-prefix }}
|
|
steps:
|
|
- name: Generate random cache-prefix
|
|
id: name
|
|
run: |
|
|
cache_prefix=$(head -n 100 </dev/urandom | shasum -a 256 | cut -d ' ' -f 1)
|
|
echo "cache-prefix=$cache_prefix" >>"$GITHUB_OUTPUT"
|
|
|
|
test-save:
|
|
needs: generate-prefix
|
|
runs-on: ${{ matrix.os }}
|
|
outputs:
|
|
cache-name: ${{ steps.cache-name.outputs.cache-name }}
|
|
strategy:
|
|
matrix:
|
|
nested:
|
|
- name: matrix
|
|
invalid-chars: "," # Use invalid characters in job matrix to ensure we escape them
|
|
version:
|
|
- "1.0"
|
|
- "1"
|
|
- "nightly"
|
|
os:
|
|
- ubuntu-latest
|
|
- windows-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
|
|
env:
|
|
JULIA_DEPOT_PATH: /tmp/julia-depot
|
|
steps:
|
|
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29
|
|
- name: Set cache-name
|
|
id: cache-name
|
|
shell: bash
|
|
run: |
|
|
echo "cache-name=${{ needs.generate-prefix.outputs.cache-prefix }}-${{ github.job }}" >>"$GITHUB_OUTPUT"
|
|
- uses: julia-actions/setup-julia@v2
|
|
with:
|
|
version: ${{ matrix.version }}
|
|
- name: Save cache
|
|
id: cache
|
|
uses: ./
|
|
with:
|
|
cache-name: ${{ steps.cache-name.outputs.cache-name }}
|
|
delete-old-caches: required
|
|
- name: Check no artifacts dir
|
|
shell: julia --color=yes {0}
|
|
run: |
|
|
dir = joinpath(first(DEPOT_PATH), "artifacts")
|
|
@assert !isdir(dir)
|
|
- name: Install a small binary
|
|
shell: julia --color=yes {0}
|
|
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:
|
|
needs: test-save
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
matrix:
|
|
nested:
|
|
- name: matrix
|
|
invalid-chars: "," # Use invalid characters in job matrix to ensure we escape them
|
|
version:
|
|
- "1.0"
|
|
- "1"
|
|
- "nightly"
|
|
os:
|
|
- ubuntu-latest
|
|
- windows-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
|
|
env:
|
|
JULIA_DEPOT_PATH: /tmp/julia-depot
|
|
steps:
|
|
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29
|
|
- uses: julia-actions/setup-julia@v2
|
|
with:
|
|
version: ${{ matrix.version }}
|
|
- name: Restore cache
|
|
id: cache
|
|
uses: ./
|
|
with:
|
|
cache-name: ${{ needs.test-save.outputs.cache-name }}
|
|
# 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' }}
|
|
- name: Test cache-hit output
|
|
shell: julia --color=yes {0}
|
|
run: |
|
|
@show ENV["cache-hit"]
|
|
@assert ENV["cache-hit"] == "true"
|
|
env:
|
|
cache-hit: ${{ steps.cache.outputs.cache-hit }}
|
|
- name: Check existance or emptiness of affected dirs
|
|
shell: julia --color=yes {0}
|
|
run: |
|
|
# These dirs should exist as they've been cached
|
|
artifacts_dir = joinpath(first(DEPOT_PATH), "artifacts")
|
|
if VERSION >= v"1.3"
|
|
@assert !isempty(readdir(artifacts_dir))
|
|
else
|
|
@assert !isdir(artifacts_dir)
|
|
end
|
|
packages_dir = joinpath(first(DEPOT_PATH), "packages")
|
|
@assert !isempty(readdir(packages_dir))
|
|
compiled_dir = joinpath(first(DEPOT_PATH), "compiled")
|
|
@assert !isempty(readdir(compiled_dir))
|
|
scratchspaces_dir = joinpath(first(DEPOT_PATH), "scratchspaces")
|
|
@assert !isempty(readdir(scratchspaces_dir))
|
|
logs_dir = joinpath(first(DEPOT_PATH), "logs")
|
|
@assert !isempty(readdir(logs_dir))
|
|
|
|
# Do tests with no matrix also given the matrix is auto-included in cache key
|
|
test-save-nomatrix:
|
|
needs: generate-prefix
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
cache-name: ${{ steps.cache-name.outputs.cache-name }}
|
|
steps:
|
|
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29
|
|
- name: Set cache-name
|
|
id: cache-name
|
|
run: |
|
|
echo "cache-name=${{ needs.generate-prefix.outputs.cache-prefix }}-${{ github.job }}" >>"$GITHUB_OUTPUT"
|
|
- name: Save cache
|
|
id: cache
|
|
uses: ./
|
|
with:
|
|
cache-name: ${{ steps.cache-name.outputs.cache-name }}
|
|
delete-old-caches: required
|
|
- name: Check no artifacts dir
|
|
shell: julia --color=yes {0}
|
|
run: |
|
|
dir = joinpath(first(DEPOT_PATH), "artifacts")
|
|
@assert !isdir(dir)
|
|
- name: Install a small binary
|
|
shell: julia --color=yes {0}
|
|
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-nomatrix:
|
|
needs: test-save-nomatrix
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29
|
|
- name: Restore cache
|
|
id: cache
|
|
uses: ./
|
|
with:
|
|
cache-name: ${{ needs.test-save-nomatrix.outputs.cache-name }}
|
|
# 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' }}
|
|
- name: Test cache-hit output
|
|
shell: julia --color=yes {0}
|
|
run: |
|
|
@show ENV["cache-hit"]
|
|
@assert ENV["cache-hit"] == "true"
|
|
env:
|
|
cache-hit: ${{ steps.cache.outputs.cache-hit }}
|
|
- name: Check existance or emptiness of affected dirs
|
|
shell: julia --color=yes {0}
|
|
run: |
|
|
# These dirs should exist as they've been cached
|
|
artifacts_dir = joinpath(first(DEPOT_PATH), "artifacts")
|
|
if VERSION >= v"1.3"
|
|
@assert !isempty(readdir(artifacts_dir))
|
|
else
|
|
@assert !isdir(artifacts_dir)
|
|
end
|
|
packages_dir = joinpath(first(DEPOT_PATH), "packages")
|
|
@assert !isempty(readdir(packages_dir))
|
|
compiled_dir = joinpath(first(DEPOT_PATH), "compiled")
|
|
@assert !isempty(readdir(compiled_dir))
|
|
scratchspaces_dir = joinpath(first(DEPOT_PATH), "scratchspaces")
|
|
@assert !isempty(readdir(scratchspaces_dir))
|
|
logs_dir = joinpath(first(DEPOT_PATH), "logs")
|
|
@assert !isempty(readdir(logs_dir))
|
|
|
|
test-save-cloned-registry:
|
|
needs: generate-prefix
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
cache-name: ${{ steps.cache-name.outputs.cache-name }}
|
|
steps:
|
|
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29
|
|
- name: Set cache-name
|
|
id: cache-name
|
|
run: |
|
|
echo "cache-name=${{ needs.generate-prefix.outputs.cache-prefix }}-${{ github.job }}" >>"$GITHUB_OUTPUT"
|
|
- name: Save cache
|
|
uses: ./
|
|
with:
|
|
cache-name: ${{ steps.cache-name.outputs.cache-name }}
|
|
# 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' }}
|
|
- name: Add General registry clone
|
|
shell: julia --color=yes {0}
|
|
run: |
|
|
using Pkg
|
|
Pkg.Registry.add("General")
|
|
env:
|
|
JULIA_PKG_SERVER: ""
|
|
# Set the registry worktree to an older state to simulate the cache storing an old version of the registry.
|
|
- name: Use outdated General worktree
|
|
run: git -C ~/.julia/registries/General reset --hard HEAD~20
|
|
|
|
test-restore-cloned-registry:
|
|
needs: test-save-cloned-registry
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29
|
|
- name: Add General registry clone
|
|
shell: julia --color=yes {0}
|
|
run: |
|
|
using Pkg
|
|
Pkg.Registry.add("General")
|
|
env:
|
|
JULIA_PKG_SERVER: ""
|
|
- name: Restore cache
|
|
uses: ./
|
|
with:
|
|
cache-name: ${{ needs.test-save-cloned-registry.outputs.cache-name }}
|
|
# 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' }}
|
|
- name: Test registry is not corrupt
|
|
shell: julia --color=yes {0}
|
|
run: |
|
|
using Pkg
|
|
Pkg.Registry.update()
|