Initial commit with Gitea Actions setup
Some checks failed
CI Pipeline / build (push) Has been cancelled

This commit is contained in:
everydayseries 2025-02-07 18:13:16 +05:30
commit 23e33ff9c4
6 changed files with 61 additions and 0 deletions

16
.gitea/workflows/ci.yml Normal file
View 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
View 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
View 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
View 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
View 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
View 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!");
});