-
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
0a46af0
commit 709b6ae
Showing
5 changed files
with
108 additions
and
0 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,31 @@ | ||
#!/bin/bash | ||
|
||
declare -A arr | ||
|
||
while IFS= read -r line; do | ||
if [[ $line == apps/* ]] || [[ $line == packages/* ]]; then | ||
IFS='/' read -ra ADDR <<<"$line" | ||
path="${ADDR[0]}/${ADDR[1]}" | ||
arr[$path]=1 | ||
fi | ||
done < <(git diff --name-only --diff-filter=duxb "origin/$BASE" "origin/$HEAD" | grep -E '\.((j|t)sx?)$') | ||
|
||
for key in "${!arr[@]}"; do | ||
package_file="$key/package.json" | ||
|
||
if [[ ! -f "$package_file" ]]; then | ||
continue | ||
fi | ||
|
||
if grep -q '"build": ' "$package_file"; then | ||
package_name=$(grep -oP '"name"\s*:\s*"\K[^"]*' "$package_file") | ||
|
||
pnpm run build --filter="$package_name" || exit 1 | ||
fi | ||
|
||
if grep -q '"test": ' "$package_file"; then | ||
package_name=$(grep -oP '"name"\s*:\s*"\K[^"]*' "$package_file") | ||
|
||
pnpm run test --filter="$package_name" || exit 1 | ||
fi | ||
done |
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,4 @@ | ||
#!/bin/bash | ||
|
||
git_status=$([[ -n $(git status --porcelain) ]] && echo "true" || echo "false") | ||
echo "$git_status" |
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,13 @@ | ||
#!/bin/bash | ||
|
||
if [[ -z $(git status --porcelain) ]]; then | ||
exit 0 | ||
fi | ||
|
||
files_to_commit=${FILES:-"-A"} | ||
|
||
git config user.name github-actions[bot] | ||
git config user.email 41898282+github-actions[bot]@users.noreply.github.com | ||
git add "$files_to_commit" | ||
git commit -m "$MESSAGE" | ||
git push |
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,24 @@ | ||
name: CI / Push | ||
|
||
on: | ||
- push | ||
|
||
env: | ||
CI: true | ||
|
||
jobs: | ||
check-spelling: | ||
name: Check spelling | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: marshallku/actions/check-spelling@master | ||
send-notification: | ||
needs: [check-spelling] | ||
if: ${{ failure() }} | ||
uses: marshallku/actions/.github/workflows/send-notification.yml@master | ||
with: | ||
failed: ${{ contains(join(needs.*.result, ','), 'failure') }} | ||
message: "CI job failed - push" | ||
secrets: | ||
url: ${{ secrets.DISCORD_WEBHOOK_URI }} |
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,36 @@ | ||
name: CI / Push | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
|
||
env: | ||
CI: true | ||
|
||
jobs: | ||
lint-all: | ||
name: Check quality with ESLint | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: marshallku/actions/setup-pnpm@master | ||
- name: Check code quality | ||
run: pnpm lint | ||
build-all: | ||
name: Build all packages and apps | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: marshallku/actions/setup-pnpm@master | ||
- name: Build apps and packages | ||
run: pnpm build | ||
send-notification: | ||
needs: [lint-all, build-all] | ||
if: ${{ failure() }} | ||
uses: marshallku/actions/.github/workflows/send-notification.yml@master | ||
with: | ||
failed: ${{ contains(join(needs.*.result, ','), 'failure') }} | ||
message: "CI job failed - push on master" | ||
secrets: | ||
url: ${{ secrets.DISCORD_WEBHOOK_URI }} |