name: E2E Test on: push: branches: - main pull_request: branches: - main 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: Restore Go modules cache uses: actions/cache@v3 with: path: ~/go/pkg/mod key: go-${{ runner.os }}-${{ hashFiles('go.mod') }} restore-keys: | go-${{ runner.os }}- - name: Build the project env: CGO_ENABLED: 0 run: go build - name: Install extension env: GITHUB_TOKEN: ${{ secrets.REPO_WRITE_TOKEN }} run: gh extensions install . - name: Print help shell: bash env: GITHUB_TOKEN: ${{ secrets.REPO_WRITE_TOKEN }} run: | gh actions-cache --help - name: List Command shell: bash env: GITHUB_TOKEN: ${{ secrets.REPO_WRITE_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.REPO_WRITE_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 E2E test failure # status: ${{ job.status }} # fields: repo,workflow,message,author,action,ref # env: # SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}