This repository has been archived by the owner on Oct 21, 2024. It is now read-only.
Canary Test #805
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: Canary Test | |
on: | |
release: | |
types: [released] | |
schedule: | |
- cron: "30 18 * * *" | |
workflow_dispatch: | |
jobs: | |
upload: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
name: cache upload (${{ matrix.os }}) | |
steps: | |
- name: Create file to cache | |
run: | | |
mkdir test-cache | |
echo "foo" > test-cache/test.txt | |
- uses: actions/cache@v3 | |
with: | |
path: test-cache | |
key: ${{ matrix.os }}-runner-${{ github.run_number }}-${{ github.run_attempt }} | |
canary: | |
needs: upload | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
runs-on: ${{ matrix.os }} | |
env: | |
CacheKey: ${{ matrix.os }}-runner-${{ github.run_number }}-${{ github.run_attempt }} | |
steps: | |
- name: checkout repo | |
uses: actions/checkout@v3 | |
- name: Install extension | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: gh extensions install actions/gh-actions-cache | |
- name: List Command | |
shell: bash | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
cache_found=$(gh actions-cache list --key $CacheKey --limit 100 --branch $GITHUB_REF --order desc --sort created-at | grep $CacheKey) | |
echo $cache_found | |
[[ -z "$cache_found" ]] && exit 1 || echo "Cache List Successful" | |
- name: Delete Command | |
shell: bash | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
cache_delete=$(gh actions-cache delete $CacheKey --branch $GITHUB_REF --confirm | grep "Deleted 1 cache entry with key") | |
echo $cache_delete | |
[[ -z "$cache_delete" ]] && exit 1 || echo "Cache Delete Successful" | |
# - name: Slack Notification on failure | |
# if: failure() | |
# uses: 8398a7/action-slack@a74b761b4089b5d730d813fbedcd2ec5d394f3af | |
# with: | |
# text: actions/gh-actions-cache canary failure | |
# status: ${{ job.status }} | |
# fields: repo,workflow,message,author,action,ref | |
# env: | |
# SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} |