Skip to content

Implement copy and copy-immutable strategies (#20) #15

Implement copy and copy-immutable strategies (#20)

Implement copy and copy-immutable strategies (#20) #15

Workflow file for this run

name: Push
on: push
jobs:
tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: npm install
- run: npm run all
test-move-strategy-run1:
runs-on:
group: local-action-cache
steps:
- uses: actions/checkout@v3
- name: 'Run first time without cache'
id: 'first-run'
uses: ./
with:
path: './demo-output.txt'
key: CACHE_V1-${{ github.run_id }}-${{ github.run_attempt }}-move
- name: Assert output
if: steps.first-run.outputs.cache-hit == 'true'
run: echo "Should not have done cache hit" && exit 1
- name: Write cache file
run: echo "demo-results" > ./demo-output.txt
test-move-strategy-run2:
runs-on:
group: local-action-cache
needs: [test-move-strategy-run1]
steps:
- uses: actions/checkout@v3
- uses: ./
id: 'second-run'
with:
path: './demo-output.txt'
key: CACHE_V1-${{ github.run_id }}-${{ github.run_attempt }}-move
- name: Assert output
if: steps.second-run.outputs.cache-hit != 'true'
run: echo "Should have hit cache" && exit 1
- name: Check contents
run: |
if [ $(cat ./demo-output.txt) != "demo-results" ]; then
echo "Wrong cached contents: $(cat ./demo-output.txt)"
exit 1
fi
test-copy-strategy-run1:
runs-on:
group: local-action-cache
steps:
- uses: actions/checkout@v3
- name: 'Run first time without cache'
id: 'first-run'
uses: ./
with:
path: './demo-output.txt'
key: CACHE_V1-${{ github.run_id }}-${{ github.run_attempt }}-copy
strategy: copy
- name: Assert output
if: steps.first-run.outputs.cache-hit == 'true'
run: echo "Should not have done cache hit" && exit 1
- name: Write cache file
run: echo "demo-results" > ./demo-output.txt
test-copy-strategy-run2:
runs-on:
group: local-action-cache
needs: [test-copy-strategy-run1]
steps:
- uses: actions/checkout@v3
- uses: ./
id: 'second-run'
with:
path: './demo-output.txt'
key: CACHE_V1-${{ github.run_id }}-${{ github.run_attempt }}-copy
strategy: copy
- name: Assert output
if: steps.second-run.outputs.cache-hit != 'true'
run: echo "Should have hit cache" && exit 1
- name: Check contents
run: |
if [ $(cat ./demo-output.txt) != "demo-results" ]; then
echo "Wrong cached contents: $(cat ./demo-output.txt)"
exit 1
fi
- name: Change contents
run: echo "changed-results" > ./demo-output.txt
test-copy-strategy-run3:
runs-on:
group: local-action-cache
needs: [test-copy-strategy-run2]
steps:
- uses: actions/checkout@v3
- uses: ./
id: 'third-run'
with:
path: './demo-output.txt'
key: CACHE_V1-${{ github.run_id }}-${{ github.run_attempt }}-copy
strategy: copy
- name: Assert output
if: steps.third-run.outputs.cache-hit != 'true'
run: echo "Should have hit cache" && exit 1
- name: Check contents
run: |
if [ $(cat ./demo-output.txt) != "changed-results" ]; then
echo "Wrong cached contents: $(cat ./demo-output.txt)"
exit 1
fi
test-copy-strategy-immutable-run1:
runs-on:
group: local-action-cache
steps:
- uses: actions/checkout@v3
- name: 'Run first time without cache'
id: 'first-run'
uses: ./
with:
path: './demo-output.txt'
key: CACHE_V1-${{ github.run_id }}-${{ github.run_attempt }}-copy-immutable
strategy: copy-immutable
- name: Assert output
if: steps.first-run.outputs.cache-hit == 'true'
run: echo "Should not have done cache hit" && exit 1
- name: Write cache file
run: echo "demo-results" > ./demo-output.txt
test-copy-strategy-immutable-run2:
runs-on:
group: local-action-cache
needs: [test-copy-strategy-immutable-run1]
steps:
- uses: actions/checkout@v3
- uses: ./
id: 'second-run'
with:
path: './demo-output.txt'
key: CACHE_V1-${{ github.run_id }}-${{ github.run_attempt }}-copy-immutable
strategy: copy-immutable
- name: Assert output
if: steps.second-run.outputs.cache-hit != 'true'
run: echo "Should have hit cache" && exit 1
- name: Check contents
run: |
if [ $(cat ./demo-output.txt) != "demo-results" ]; then
echo "Wrong cached contents: $(cat ./demo-output.txt)"
exit 1
fi
- name: Change contents
run: echo "changed-results" > ./demo-output.txt
test-copy-strategy-immutable-run3:
runs-on:
group: local-action-cache
needs: [test-copy-strategy-immutable-run2]
steps:
- uses: actions/checkout@v3
- uses: ./
id: 'third-run'
with:
path: './demo-output.txt'
key: CACHE_V1-${{ github.run_id }}-${{ github.run_attempt }}-copy-immutable
strategy: copy-immutable
- name: Assert output
if: steps.third-run.outputs.cache-hit != 'true'
run: echo "Should have hit cache" && exit 1
- name: Check contents
run: |
if [ $(cat ./demo-output.txt) != "demo-results" ]; then
echo "Wrong cached contents: $(cat ./demo-output.txt)"
exit 1
fi