Populate Grid cache #58
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: Populate Grid cache | |
on: | |
schedule: | |
- cron: "0 10 * * *" | |
workflow_dispatch: | |
env: | |
CARGO_TERM_COLOR: always | |
slack-channel: 'alerts' | |
concurrency: | |
group: "${{ github.ref }}-${{ github.workflow }}" | |
cancel-in-progress: true | |
jobs: | |
populate_grid_cache: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Display envvars | |
run: env | |
- name: Download XSD | |
run: | | |
docker run \ | |
--rm \ | |
-v $(pwd)/cache:/var/cache/grid \ | |
hyperledger/gridd:nightly \ | |
grid download-xsd | |
- name: Create checksum file | |
run: find cache -type f | xargs shasum -a 256 > checksums.sha | |
- name: Display checksums | |
run: cat checksums.sha && echo "XML_CACHE_HASH - ${{ hashFiles('checksums.sha') }}" | |
- name: Add files to the cache | |
uses: actions/cache@v2 | |
with: | |
path: cache/ | |
key: xml-${{ hashFiles('checksums.sha') }} | |
restore-keys: | |
xml- | |
- name: Notify Slack of Failure | |
if: failure() | |
uses: 8398a7/action-slack@v3 | |
with: | |
status: ${{ job.status }} | |
fields: repo,message,author,job | |
env: | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | |
test_cache_restore: | |
runs-on: ubuntu-latest | |
needs: populate_grid_cache | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Display envvars | |
run: env | |
- name: Retrieve from cache | |
uses: actions/cache@v2 | |
with: | |
path: cache/ | |
key: xml-${{ secrets.XML_CACHE_HASH }} | |
- name: Show cache | |
run: ls -al -R cache/ | |
- name: Verify unpack | |
run: | | |
docker run \ | |
--rm \ | |
-v $(pwd)/cache:/var/cache/grid/ \ | |
hyperledger/gridd:nightly \ | |
grid download-xsd --no-download | |
- name: Notify Slack of Failure | |
if: failure() | |
uses: 8398a7/action-slack@v3 | |
with: | |
status: ${{ job.status }} | |
fields: repo,message,author,job | |
env: | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} |