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 3.5.2 to 4.0.0.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](8e5e7e5ab8...3df4ab11eb)
---
updated-dependencies:
- dependency-name: actions/checkout
dependency-type: direct:production
update-type: version-update:semver-major
...
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
85 lines
2.4 KiB
YAML
85 lines
2.4 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
paths:
|
|
- 'action.yml'
|
|
- '.github/**'
|
|
pull_request:
|
|
paths:
|
|
- 'action.yml'
|
|
- '.github/**'
|
|
|
|
jobs:
|
|
generate-key:
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
cache-name: ${{ steps.name.outputs.cache-name }}
|
|
steps:
|
|
- name: Generate random file
|
|
shell: 'julia --color=yes {0}'
|
|
run: 'write("random.txt", string(rand(10)))'
|
|
- name: Set cache-name as output
|
|
id: name
|
|
run: echo "cache-name=${{ hashFiles('random.txt') }}" >> $GITHUB_OUTPUT
|
|
|
|
test-save:
|
|
needs: generate-key
|
|
strategy:
|
|
matrix:
|
|
os: [ubuntu-latest, windows-latest, macOS-latest]
|
|
fail-fast: false
|
|
runs-on: ${{ matrix.os }}
|
|
steps:
|
|
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac
|
|
- name: Save cache
|
|
id: cache
|
|
uses: ./
|
|
with:
|
|
cache-name: ${{ needs.generate-key.outputs.cache-name }}
|
|
- 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; Pkg.add("pandoc_jll")'
|
|
|
|
test-restore:
|
|
needs: [generate-key, test-save]
|
|
strategy:
|
|
matrix:
|
|
os: [ubuntu-latest, windows-latest, macOS-latest]
|
|
fail-fast: false
|
|
runs-on: ${{ matrix.os }}
|
|
steps:
|
|
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac
|
|
- name: Restore cache
|
|
id: cache
|
|
uses: ./
|
|
with:
|
|
cache-name: ${{ needs.generate-key.outputs.cache-name }}
|
|
- 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: |
|
|
# Artifacts and Packages should exist as they've been cached
|
|
artifacts_dir = joinpath(first(DEPOT_PATH), "artifacts")
|
|
@assert !isempty(readdir(artifacts_dir))
|
|
packages_dir = joinpath(first(DEPOT_PATH), "packages")
|
|
@assert !isempty(readdir(packages_dir))
|
|
|
|
# Caching the compiled dir is disabled by default and should not exist after restoring a cache
|
|
compiled_dir = joinpath(first(DEPOT_PATH), "compiled")
|
|
@assert !isdir(compiled_dir) || isempty(readdir(compiled_dir))
|
|
|