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 "::set-output name=cache-name::${{ hashFiles('random.txt') }}" 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@2541b1294d2704b0964813337f33b291d3f8596b - 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@2541b1294d2704b0964813337f33b291d3f8596b - 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 non-empty artifacts and packages dir shell: 'julia --color=yes {0}' run: | artifacts_dir = joinpath(first(DEPOT_PATH), "artifacts") @assert !isempty(readdir(artifacts_dir)) packages_dir = joinpath(first(DEPOT_PATH), "packages") @assert !isempty(readdir(packages_dir))