Initial commit with Gitea Actions setup
Some checks failed
CI Pipeline / build (push) Has been cancelled
Some checks failed
CI Pipeline / build (push) Has been cancelled
This commit is contained in:
commit
dd14c89725
16
.gitea/workflows/ci.yml
Normal file
16
.gitea/workflows/ci.yml
Normal file
@ -0,0 +1,16 @@
|
||||
name: CI Pipeline
|
||||
|
||||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: self-hosted
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm install
|
||||
|
||||
- name: Run tests
|
||||
run: npm test
|
6
Dockerfile
Normal file
6
Dockerfile
Normal file
@ -0,0 +1,6 @@
|
||||
FROM node:16
|
||||
WORKDIR /app
|
||||
COPY package.json .
|
||||
RUN npm install
|
||||
COPY . .
|
||||
CMD ["npm", "start"]
|
17
package.json
Normal file
17
package.json
Normal file
@ -0,0 +1,17 @@
|
||||
{
|
||||
"name": "gitea-actions-demo",
|
||||
"version": "1.0.0",
|
||||
"description": "Demo for Gitea Actions",
|
||||
"main": "src/index.js",
|
||||
"scripts": {
|
||||
"start": "node src/index.js",
|
||||
"test": "jest"
|
||||
},
|
||||
"dependencies": {
|
||||
"express": "^4.18.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"jest": "^29.0.0",
|
||||
"supertest": "^6.3.0"
|
||||
}
|
||||
}
|
8
src/app.js
Normal file
8
src/app.js
Normal file
@ -0,0 +1,8 @@
|
||||
const express = require("express");
|
||||
const app = express();
|
||||
|
||||
app.get("/", (req, res) => {
|
||||
res.json({ message: "Hello from Gitea Actions!" });
|
||||
});
|
||||
|
||||
module.exports = app;
|
6
src/index.js
Normal file
6
src/index.js
Normal file
@ -0,0 +1,6 @@
|
||||
const app = require("./app");
|
||||
|
||||
const PORT = process.env.PORT || 3000;
|
||||
app.listen(PORT, () => {
|
||||
console.log(`Server running on port ${PORT}`);
|
||||
});
|
8
tests/app.test.js
Normal file
8
tests/app.test.js
Normal file
@ -0,0 +1,8 @@
|
||||
const request = require("supertest");
|
||||
const app = require("../src/app");
|
||||
|
||||
test("GET / should return a welcome message", async () => {
|
||||
const res = await request(app).get("/");
|
||||
expect(res.statusCode).toBe(200);
|
||||
expect(res.body.message).toBe("Hello from Gitea Actions!");
|
||||
});
|
Loading…
x
Reference in New Issue
Block a user