feat: Hello World CI/CD — vitest + webhook to Hermes
Some checks failed
CI / Test → Hello World (push) Failing after 26s
Some checks failed
CI / Test → Hello World (push) Failing after 26s
This commit is contained in:
23
.gitea/workflows/ci.yaml
Normal file
23
.gitea/workflows/ci.yaml
Normal file
@@ -0,0 +1,23 @@
|
||||
name: CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
|
||||
jobs:
|
||||
test:
|
||||
name: Test → Hello World
|
||||
runs-on: ubuntu-latest
|
||||
container: node:22-alpine
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- run: npm ci
|
||||
- run: npx vitest run
|
||||
- name: Phone home to Hermes
|
||||
run: |
|
||||
PAYLOAD='{"repository":{"name":"${{ github.repository }}"},"status":"success","message":"Hello World"}'
|
||||
SIGNATURE=$(echo -n "$PAYLOAD" | openssl dgst -sha256 -hmac "${{ secrets.WEBHOOK_SECRET }}" | cut -d' ' -f2)
|
||||
curl -sf -X POST http://100.93.173.42:8644/webhooks/ci-demo \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "X-Hub-Signature-256: sha256=$SIGNATURE" \
|
||||
-d "$PAYLOAD" && echo "Webhook delivered" || echo "Webhook failed (non-fatal)"
|
||||
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
node_modules
|
||||
dist
|
||||
1592
package-lock.json
generated
Normal file
1592
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
12
package.json
Normal file
12
package.json
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"name": "ci-hello-world",
|
||||
"private": true,
|
||||
"version": "1.0.0",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"test": "vitest run"
|
||||
},
|
||||
"devDependencies": {
|
||||
"vitest": "^3.0.0"
|
||||
}
|
||||
}
|
||||
3
src/greet.ts
Normal file
3
src/greet.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
export function greet(name: string): string {
|
||||
return `Hello, ${name}!`;
|
||||
}
|
||||
8
tests/greet.test.ts
Normal file
8
tests/greet.test.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
import { describe, it, expect } from "vitest";
|
||||
import { greet } from "../src/greet";
|
||||
|
||||
describe("greet", () => {
|
||||
it('returns "Hello, World!"', () => {
|
||||
expect(greet("World")).toBe("Hello, World!");
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user