Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions .github/actions/cleanup/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: 'Clean up test action environment'
description: 'Deletes test branch and optionally test tag from remote'
inputs:
branch:
description: 'Branch name to delete'
required: true
tag:
description: 'Tag name to delete'
required: false
default: ''
runs:
using: composite
steps:
- name: Delete remote branch
shell: bash
run: |
test_branch=$(git ls-remote --heads origin refs/heads/${{ inputs.branch }})
if [[ -n $test_branch ]]; then
echo "test branch ${{ inputs.branch }} existed"
git push -d origin refs/heads/${{ inputs.branch }}
else
echo "test branch ${{ inputs.branch }} does not exist"
fi

- name: Delete remote tag
if: ${{ inputs.tag != '' }}
shell: bash
run: |
test_tag=$(git ls-remote --tags origin refs/tags/${{ inputs.tag }})
if [[ -n $test_tag ]]; then
echo "test tag ${{ inputs.tag }} existed"
git push -d origin refs/tags/${{ inputs.tag }}
else
echo "test tag ${{ inputs.tag }} does not exist"
fi
43 changes: 0 additions & 43 deletions .github/workflows/changelog.yml

This file was deleted.

15 changes: 5 additions & 10 deletions .github/workflows/check-dist.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,15 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v6
- uses: actions/checkout@v6

- name: Setup Node.js
uses: actions/setup-node@v6
- uses: actions/setup-node@v6
with:
node-version-file: .node-version
cache: npm

- name: Install Dependencies
run: npm ci

- name: Build dist/ Directory
run: npm run bundle
- run: npm ci
- run: npm run bundle

# This will fail the workflow if the `dist/` directory is different than
# expected.
Expand All @@ -58,7 +53,7 @@ jobs:
# workflow artifact.
- if: ${{ failure() && steps.diff.outcome == 'failure' }}
name: Upload Artifact
uses: actions/upload-artifact@v6
uses: actions/upload-artifact@v7
with:
name: dist
path: dist/
158 changes: 40 additions & 118 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,34 +13,24 @@ permissions:

concurrency:
group: test-action
cancel-in-progress: ${{ github.ref != 'main' }}
cancel-in-progress: ${{ github.ref == 'refs/heads/main' }}

jobs:
test-jest:
name: Jest Tests
test-vitest:
name: Vitest Tests
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v6

- name: Setup Node.js
uses: actions/setup-node@v6
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version-file: .node-version
cache: npm

- name: Install Dependencies
run: npm ci

- name: Check Format
run: npm run format:check

- name: Lint
run: npm run lint

- name: Test
run: npm run ci-test
- run: npm ci
- run: npm run format:check
- run: npm run lint
- run: npm test

test-action-basic:
name: GitHub Actions Test (Basic)
Expand All @@ -51,8 +41,7 @@ jobs:
BRANCH: test-action-basic

steps:
- name: Checkout
uses: actions/checkout@v6
- uses: actions/checkout@v6

- name: Test Action
id: test-action
Expand All @@ -68,16 +57,10 @@ jobs:
run: echo "${{ steps.test-action.outputs.commit-sha }}"

- name: Clean up test action environment
shell: bash
if: always()
run: |
test_branch=$(git ls-remote --heads origin refs/heads/$BRANCH)
if [[ -n $test_branch ]]; then
echo "test branch $BRANCH existed"
git push -d origin refs/heads/$BRANCH
else
echo "test branch $BRANCH does not exist"
fi
uses: ./.github/actions/cleanup
with:
branch: ${{ env.BRANCH }}

test-action-branch:
name: GitHub Actions Test (Custom Branch)
Expand All @@ -89,8 +72,7 @@ jobs:
BRANCH: test-action-branch

steps:
- name: Checkout
uses: actions/checkout@v6
- uses: actions/checkout@v6

- name: generate dummy content
shell: bash
Expand All @@ -113,16 +95,10 @@ jobs:
run: echo "${{ steps.test-action.outputs.commit-sha }}"

- name: Clean up test action environment
shell: bash
if: always()
run: |
test_branch=$(git ls-remote --heads origin refs/heads/$BRANCH)
if [[ -n $test_branch ]]; then
echo "test branch $BRANCH existed"
git push -d origin refs/heads/$BRANCH
else
echo "test branch $BRANCH does not exist"
fi
uses: ./.github/actions/cleanup
with:
branch: ${{ env.BRANCH }}

test-action-workspace:
name: GitHub Actions Test (Workspace)
Expand All @@ -134,8 +110,7 @@ jobs:
BRANCH: test-action-workspace

steps:
- name: Checkout
uses: actions/checkout@v6
- uses: actions/checkout@v6

- name: generate dummy content
shell: bash
Expand All @@ -159,16 +134,10 @@ jobs:
run: echo "${{ steps.test-action.outputs.commit-sha }}"

- name: Clean up test action environment
shell: bash
if: always()
run: |
test_branch=$(git ls-remote --heads origin refs/heads/$BRANCH)
if [[ -n $test_branch ]]; then
echo "test branch $BRANCH existed"
git push -d origin refs/heads/$BRANCH
else
echo "test branch $BRANCH does not exist"
fi
uses: ./.github/actions/cleanup
with:
branch: ${{ env.BRANCH }}

test-action-glob:
name: GitHub Actions Test (Glob)
Expand All @@ -180,8 +149,7 @@ jobs:
BRANCH: test-action-glob

steps:
- name: Checkout
uses: actions/checkout@v6
- uses: actions/checkout@v6

- name: generate dummy content
shell: bash
Expand All @@ -204,16 +172,10 @@ jobs:
run: echo "${{ steps.test-action.outputs.commit-sha }}"

- name: Clean up test action environment
shell: bash
if: always()
run: |
test_branch=$(git ls-remote --heads origin refs/heads/$BRANCH)
if [[ -n $test_branch ]]; then
echo "test branch $BRANCH existed"
git push -d origin refs/heads/$BRANCH
else
echo "test branch $BRANCH does not exist"
fi
uses: ./.github/actions/cleanup
with:
branch: ${{ env.BRANCH }}

test-action-tag:
name: GitHub Actions Test (Tag)
Expand All @@ -226,8 +188,7 @@ jobs:
BRANCH: test-action-tag

steps:
- name: Checkout
uses: actions/checkout@v6
- uses: actions/checkout@v6

- name: Test Action
id: test-action
Expand All @@ -244,23 +205,11 @@ jobs:
echo "[tag] ${{ steps.test-action.outputs.tag }}"

- name: Clean up test action environment
shell: bash
if: always()
run: |
test_branch=$(git ls-remote --heads origin refs/heads/$BRANCH)
if [[ -n $test_branch ]]; then
echo "test branch $BRANCH existed"
git push -d origin refs/heads/$BRANCH
else
echo "test branch $BRANCH does not exist"
fi
test_tag=$(git ls-remote --tags origin refs/tags/$TAG)
if [[ -n $test_tag ]]; then
echo "test tag $TAG existed"
git push -d origin refs/tags/$TAG
else
echo "test tag $TAG does not exist"
fi
uses: ./.github/actions/cleanup
with:
branch: ${{ env.BRANCH }}
tag: ${{ env.TAG }}

test-action-file-tag:
name: GitHub Actions Test (File & Tag)
Expand All @@ -273,9 +222,7 @@ jobs:
TAG: 4.5.6

steps:
- name: Checkout
id: checkout
uses: actions/checkout@v6
- uses: actions/checkout@v6

- name: generate dummy content
shell: bash
Expand All @@ -301,23 +248,11 @@ jobs:
echo "[tag] ${{ steps.test-action.outputs.tag }}"

- name: Clean up test action environment
shell: bash
if: always()
run: |
test_branch=$(git ls-remote --heads origin refs/heads/$BRANCH)
if [[ -n $test_branch ]]; then
echo "test branch $BRANCH existed"
git push -d origin refs/heads/$BRANCH
else
echo "test branch $BRANCH does not exist"
fi
test_tag=$(git ls-remote --tags origin refs/tags/$TAG)
if [[ -n $test_tag ]]; then
echo "test tag $TAG existed"
git push -d origin refs/tags/$TAG
else
echo "test tag $TAG does not exist"
fi
uses: ./.github/actions/cleanup
with:
branch: ${{ env.BRANCH }}
tag: ${{ env.TAG }}

test-action-no-file-changes-tag:
name: GitHub Actions Test (No File Changes & Tag)
Expand All @@ -330,8 +265,7 @@ jobs:
TAG: 7.8.9

steps:
- name: Checkout
uses: actions/checkout@v6
- uses: actions/checkout@v6

- name: Test Action
id: test-action
Expand All @@ -350,20 +284,8 @@ jobs:
echo "[tag] ${{ steps.test-action.outputs.tag }}"

- name: Clean up test action environment
shell: bash
if: always()
run: |
test_branch=$(git ls-remote --heads origin refs/heads/$BRANCH)
if [[ -n $test_branch ]]; then
echo "test branch $BRANCH existed"
git push -d origin refs/heads/$BRANCH
else
echo "test branch $BRANCH does not exist"
fi
test_tag=$(git ls-remote --tags origin refs/tags/$TAG)
if [[ -n $test_tag ]]; then
echo "test tag $TAG existed"
git push -d origin refs/tags/$TAG
else
echo "test tag $TAG does not exist"
fi
uses: ./.github/actions/cleanup
with:
branch: ${{ env.BRANCH }}
tag: ${{ env.TAG }}
Loading