Skip to content
This repository has been archived by the owner on Oct 21, 2024. It is now read-only.

Commit

Permalink
Create E2E test on main branch (#24)
Browse files Browse the repository at this point in the history
* Create e2e_test.yml
  • Loading branch information
aparna-ravindra authored Aug 4, 2022
1 parent 1aec73a commit c196049
Showing 1 changed file with 81 additions and 0 deletions.
81 changes: 81 additions & 0 deletions .github/workflows/e2e_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name: E2E Test

on:
push:
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@v2
- 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
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 }}

0 comments on commit c196049

Please sign in to comment.