-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9e5a9f1
commit cc2fdba
Showing
4 changed files
with
130 additions
and
33 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
name: CI Workflow | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.head_ref }} | ||
cancel-in-progress: true | ||
|
||
on: | ||
pull_request: | ||
branches-ignore: | ||
- 'main' | ||
paths: | ||
- 'src/**' | ||
workflow_dispatch: | ||
|
||
jobs: | ||
init: | ||
name: Initial common steps | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: 🛎️ Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: ⚙️ Setup PNPM | ||
uses: pnpm/action-setup@v2.2.1 | ||
with: | ||
version: 8 | ||
|
||
- name: 📝 Cache dependencies | ||
id: cache-deps | ||
uses: actions/cache@v3 | ||
with: | ||
path: node_modules | ||
key: deps-node-modules-${{ hashFiles('**/pnpm-lock.yaml') }} | ||
|
||
- name: 🔧 Install dependencies | ||
if: steps.cache-deps.outputs.cache-hit != 'true' | ||
run: pnpm install --frozen-lockfile | ||
|
||
test: | ||
name: Test Coverage | ||
runs-on: ubuntu-latest | ||
environment: Test | ||
timeout-minutes: 10 | ||
needs: init | ||
|
||
steps: | ||
- name: 🛎️ Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: ⚙️ Setup PNPM | ||
uses: pnpm/action-setup@v2.2.1 | ||
with: | ||
version: 8 | ||
|
||
- name: 📝 Cache dependencies | ||
id: cache-deps | ||
uses: actions/cache@v3 | ||
with: | ||
path: node_modules | ||
key: deps-node-modules-${{ hashFiles('**/pnpm-lock.yaml') }} | ||
|
||
- name: 🔧 Install dependencies | ||
if: steps.cache-deps.outputs.cache-hit != 'true' | ||
run: pnpm install --frozen-lockfile | ||
|
||
- name: 🧪 Test Coverage | ||
run: pnpm test:coverage | ||
|
||
- name: 📈 Upload coverage reports to Codecov | ||
uses: codecov/codecov-action@v3 | ||
with: | ||
token: ${{ secrets.CODECOV_TOKEN }} | ||
fail_ci_if_error: true |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
name: Cleanup Branch Resource | ||
|
||
permissions: | ||
actions: write | ||
contents: read | ||
|
||
on: | ||
pull_request: | ||
types: | ||
- closed | ||
workflow_dispatch: | ||
|
||
jobs: | ||
cleanup: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: 🛎️ Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: 🗑️ Cleanup cache | ||
run: | | ||
gh extension install actions/gh-actions-cache | ||
REPO=${{ github.repository }} | ||
BRANCH=refs/pull/${{ github.event.pull_request.number }}/merge | ||
echo "Fetching list of cache key" | ||
cacheKeysForPR=$(gh actions-cache list -R $REPO -B $BRANCH | cut -f 1 ) | ||
echo "Cache keys for PR: $cacheKeysForPR" | ||
## Setting this to not fail the workflow while deleting cache keys. | ||
set +e | ||
echo "Deleting caches..." | ||
for cacheKey in $cacheKeysForPR | ||
do | ||
echo "- ${cacheKey}" | ||
gh actions-cache delete $cacheKey -R $REPO -B $BRANCH --confirm | ||
done | ||
echo "Done" | ||
env: | ||
GH_TOKEN: ${{ github.token }} | ||
|
||
- name: ⚰️ Delete artifacts | ||
run: | | ||
PR_NUMBER=${{ github.event.pull_request.number }} | ||
artifacts=$(gh api /repos/${{ github.repository }}/actions/artifacts --paginate) | ||
for artifact in $(echo "$artifacts" | jq -r ".artifacts[] | select(.name | startswith(\"PR-$PR_NUMBER-\")) | .id"); do | ||
echo "filtered artifact: $artifact" | ||
gh api -X DELETE /repos/${{ github.repository }}/actions/artifacts/$artifact | ||
done | ||
env: | ||
GH_TOKEN: ${{ github.token }} |
This file was deleted.
Oops, something went wrong.
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