name: CI on: push: branches: - main paths: - 'action.yml' pull_request: paths: - 'action.yml' jobs: test-save: runs-on: ubuntu-latest outputs: cache-name: ${{ steps.name.outputs.cache-name }} steps: - uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 - name: Generate random file shell: 'julia --color=yes {0}' run: 'write("random.txt", string(rand(10)))' - name: Save cache id: cache uses: ./ with: cache-name: ${{ hashFiles('random.txt') }} - name: Set cache-name as output id: name run: | echo "Setting outputs.cache-name to \"$CACHE_NAME\"" echo "::set-output name=cache-name::$CACHE_NAME" env: CACHE_NAME: ${{ hashFiles('random.txt') }} - 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: test-save runs-on: ubuntu-latest steps: - uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 - name: Restore cache id: cache uses: ./ with: cache-name: ${{ needs.test-save.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 dir shell: 'julia --color=yes {0}' run: | dir = joinpath(first(DEPOT_PATH), "artifacts") @assert isdir(dir) @assert !isempty(readdir(dir))