-
-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix/actions is not functioning correctly (#86)
* Fix/pull_request is not working correctly * Fix/publish.yml is not working correctly * Chore/update jest config * pnpm version 8.6.12 -> 8.7.1 * remove echo repo * add Codecov badge * 3.5.6
- Loading branch information
Showing
9 changed files
with
139 additions
and
85 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,85 @@ | ||
name: ci | ||
|
||
concurrency: | ||
group: ci-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
on: | ||
workflow_dispatch: | ||
pull_request: | ||
branches: | ||
- main | ||
- master | ||
- dev | ||
paths-ignore: | ||
- ".devcontainer/**" | ||
# - '.github/**' | ||
- ".vscode/**" | ||
- ".gitignore" | ||
- ".npmignore" | ||
- "LICENSE" | ||
- "README.md" | ||
push: | ||
paths-ignore: | ||
- ".devcontainer/**" | ||
# - '.github/**' | ||
- ".vscode/**" | ||
- ".gitignore" | ||
- ".npmignore" | ||
- "LICENSE" | ||
- "README.md" | ||
branches: | ||
- main | ||
- master | ||
- dev | ||
|
||
permissions: | ||
contents: read # to fetch code (actions/checkout) | ||
|
||
jobs: | ||
build: | ||
strategy: | ||
matrix: | ||
node: [16] | ||
platform: [ubuntu-latest, macos-latest, windows-latest] | ||
name: "${{matrix.platform}} / Node.js ${{ matrix.node }}" | ||
runs-on: ${{matrix.platform}} | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up Node.js | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: 16 | ||
- uses: pnpm/[email protected] | ||
with: | ||
version: 8.7.1 | ||
|
||
- name: Get pnpm store directory | ||
shell: bash | ||
run: | | ||
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV | ||
- uses: actions/cache@v4 | ||
name: Setup pnpm cache | ||
with: | ||
path: ${{ env.STORE_PATH }} | ||
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | ||
restore-keys: | | ||
${{ runner.os }}-pnpm-store- | ||
- name: Install dependencies | ||
run: pnpm install --frozen-lockfile | ||
|
||
- name: Lint | ||
run: pnpm run lint | ||
|
||
- name: Run tests and collect coverage | ||
run: pnpm run test::coverage | ||
|
||
- name: Upload coverage reports to Codecov | ||
uses: codecov/[email protected] | ||
with: | ||
token: ${{ secrets.CODECOV_TOKEN }} | ||
slug: ${{ env.GITHUB_REPOSITORY }} | ||
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 |
---|---|---|
|
@@ -4,48 +4,65 @@ | |
name: Publish Package | ||
|
||
on: | ||
release: | ||
types: [ published ] | ||
pull_request: | ||
workflow_run: | ||
workflows: [ci] | ||
types: | ||
- closed | ||
- completed | ||
branches: [main, master] | ||
release: | ||
types: [published] | ||
|
||
jobs: | ||
|
||
publish-npm: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
packages: write # allow GITHUB_TOKEN to publish packages | ||
id-token: write | ||
steps: | ||
- name: Check Pull Request Status | ||
run: | | ||
if [ "${{ github.event.pull_request.merged }}" = "true" ]; then | ||
echo "Pull request merged successfully." | ||
else | ||
echo "Pull request not merged. Skipping further steps." | ||
exit 0 | ||
fi | ||
- uses: actions/checkout@v2 | ||
- uses: actions/checkout@v3 | ||
- name: Set up Node.js | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: 16 | ||
- uses: pnpm/[email protected] | ||
with: | ||
version: 8.7.1 | ||
- run: pnpm install | ||
- run: pnpm lint | ||
- run: pnpm test | ||
|
||
- name: Get pnpm store directory | ||
shell: bash | ||
run: | | ||
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV | ||
- uses: actions/cache@v4 | ||
name: Setup pnpm cache | ||
with: | ||
path: ${{ env.STORE_PATH }} | ||
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | ||
restore-keys: | | ||
${{ runner.os }}-pnpm-store- | ||
- name: Install dependencies | ||
run: pnpm install --frozen-lockfile | ||
|
||
- name: Lint | ||
run: pnpm run lint | ||
|
||
- name: Run tests and collect coverage | ||
run: pnpm run test::coverage | ||
|
||
- run: pnpm build | ||
- name: Determine Target Branch | ||
id: determine-branch | ||
run: echo "::set-output name=branch::${{ github.event.pull_request.base.ref }}" | ||
|
||
- name: Determine Tag | ||
id: determine-tag | ||
run: echo "::set-output name=tag::${{ steps.determine-branch.outputs.branch == 'master' && 'latest' || 'beta' }}" | ||
- name: Upload coverage reports to Codecov | ||
uses: codecov/[email protected] | ||
with: | ||
token: ${{ secrets.CODECOV_TOKEN }} | ||
slug: ${{ env.GITHUB_REPOSITORY }} | ||
fail_ci_if_error: true | ||
|
||
- name: Publish Package to NPM | ||
uses: JS-DevTools/npm-publish@v2 | ||
with: | ||
token: ${{secrets.npm_token}} | ||
provenance: true | ||
tag: ${{ steps.determine-tag.outputs.tag }} | ||
tag: latest |
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
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
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
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
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
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