mirror of
https://git.fightbot.fun/hxuanyu/BingPaper.git
synced 2026-02-15 07:19:33 +08:00
62 lines
1.5 KiB
YAML
62 lines
1.5 KiB
YAML
name: Verify
|
|
|
|
on:
|
|
push:
|
|
branches: [ master ]
|
|
pull_request:
|
|
branches: [ master ]
|
|
|
|
jobs:
|
|
verify:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Set up Go
|
|
uses: actions/setup-go@v5
|
|
with:
|
|
go-version: '1.25.5'
|
|
|
|
- name: Set up Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: '20'
|
|
cache: 'npm'
|
|
cache-dependency-path: webapp/package-lock.json
|
|
|
|
- name: Build Frontend
|
|
run: |
|
|
cd webapp
|
|
npm install
|
|
npm run build
|
|
|
|
- name: Install dependencies
|
|
run: go mod download
|
|
|
|
- name: Build
|
|
run: CGO_ENABLED=0 go build -v ./...
|
|
|
|
- name: Test
|
|
run: CGO_ENABLED=0 go test -v ./...
|
|
|
|
- name: Notification
|
|
if: success()
|
|
env:
|
|
NOTIFY_CURLS: ${{ secrets.NOTIFY_CURLS }}
|
|
run: |
|
|
if [ -n "$NOTIFY_CURLS" ]; then
|
|
printf "%s\n" "$NOTIFY_CURLS" | while read -r line; do
|
|
if [ -n "$line" ]; then
|
|
if [[ "$line" =~ ^[0-9] ]]; then
|
|
echo "Pausing for $line ms..."
|
|
sleep "$(awk "BEGIN {print $line/1000}")" || true
|
|
elif [[ "$line" == curl* ]]; then
|
|
eval "$line -w \"\\nHTTP Status: %{http_code}\\n\"" || true
|
|
else
|
|
eval "$line" || true
|
|
fi
|
|
echo ""
|
|
fi
|
|
done
|
|
fi
|