Add extra steps for storing dist packages #49
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Test workflows | |
on: [push, pull_request] | |
# Avoid multiple caching tests stomping over each other | |
concurrency: mainline-cache-${{ github.sha }} | |
jobs: | |
# We need to start with a clean slate for this SHA, so we can distinguish | |
# between caches created in different ref contexts. | |
clear-caches: | |
name: Clear any existing caches | |
permissions: | |
actions: write | |
runs-on: ubuntu-latest | |
steps: | |
- name: Clear existing caches for this commit | |
uses: actions/github-script@v6 | |
with: | |
script: | | |
try { | |
const response = await github.rest.actions.deleteActionsCacheByKey({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
key: `mainline-build-${context.sha}` | |
}); | |
core.info(`Deleted ${response.data.total_count} caches`); | |
if (core.isDebug()) { | |
for (const cache of response.data.actions_caches) { | |
core.debug(`Deleted cache ID ${cache.id}, ref ${cache.ref}, key ${cache.key}, version ${cache.version}`); | |
} | |
} | |
} catch(e) { | |
if (e.response.status == 404) { | |
core.info('No caches to delete'); | |
return; | |
} | |
throw(e); // Not the error we were looking for | |
} | |
mainline: | |
name: Basic mainline test | |
needs: clear-caches | |
uses: ./.github/workflows/build-test.yml | |
with: | |
cygport_file: t/mainline.cygport | |
ensure-build-cache: | |
name: Check there's a current build cache | |
needs: mainline | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check number of caches for the mainline build | |
id: check | |
uses: actions/github-script@v6 | |
with: | |
script: | | |
const response = await github.rest.actions.getActionsCacheList({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
key: 'mainline-build-' + context.sha | |
}); | |
core.info(`Found ${response.data.total_count} caches`); | |
if (response.data.total_count != 1) { | |
core.setFailed(`Expected one cache entry, found ${response.data.total_count}.`); | |
if (response.data.total_count > 0) { | |
core.startGroup('Cache list'); | |
response.data.actions_caches.forEach(cache => | |
core.info(`cache id: ${cache.id}, ref: ${cache.ref}, key: ${cache.key}, version: ${cache.version}`)); | |
core.endGroup(); | |
} | |
} | |
mainline-use-cache: | |
name: Check a build won't create a new cache unnecessarily | |
needs: mainline | |
uses: ./.github/workflows/build-test.yml | |
with: | |
cygport_file: t/mainline.cygport | |
ensure-cache-used: | |
name: Check the build did use the extant cache | |
needs: mainline-use-cache | |
runs-on: ubuntu-latest | |
steps: | |
- name: Error if cache unused | |
if: needs.mainline-use-cache.outputs.cache-found != 'true' | |
run: | | |
echo '::error title=Cache not used::Cache reportedly not used for rebuild' | |
exit 1 |