Skip to content

Commit 75543d6

Browse files
committed
ci: deploy GitHub Actions workflows for Real-World CI and SecOps
1 parent b5990e0 commit 75543d6

2 files changed

Lines changed: 80 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Auth Mailer API CI
2+
3+
on:
4+
push:
5+
branches: [ main, master ]
6+
pull_request:
7+
branches: [ main, master ]
8+
9+
jobs:
10+
build-and-test:
11+
runs-on: ubuntu-latest
12+
13+
services:
14+
postgres:
15+
image: postgres:latest
16+
env:
17+
POSTGRES_USER: user_test
18+
POSTGRES_PASSWORD: password_test
19+
POSTGRES_DB: auth_mailer_test
20+
ports:
21+
- 5432:5432
22+
options: >-
23+
--health-cmd pg_isready
24+
--health-interval 10s
25+
--health-timeout 5s
26+
--health-retries 5
27+
28+
steps:
29+
- uses: actions/checkout@v4
30+
31+
- name: Setup Node.js
32+
uses: actions/setup-node@v4
33+
with:
34+
node-version: '20'
35+
cache: 'npm'
36+
37+
- name: Install dependencies
38+
run: npm install
39+
40+
- name: Run Tests
41+
env:
42+
DATABASE_URL: postgres://user_test:password_test@localhost:5432/auth_mailer_test
43+
SECRET_KEY: ${{ secrets.SECRET_KEY }}
44+
SENDGRID_API_KEY: ${{ secrets.SENDGRID_API_KEY }}
45+
EMAIL: ${{ secrets.EMAIL }}
46+
NODE_ENV: test
47+
run: npm test

.github/workflows/codeql.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: "SecOps: CodeQL Analysis"
2+
3+
on:
4+
push:
5+
branches: [ main, master ]
6+
pull_request:
7+
branches: [ main, master ]
8+
schedule:
9+
- cron: '30 1 * * 0' # Se corre cada domingo a la 1:30 AM automáticamente
10+
11+
jobs:
12+
analyze:
13+
name: Analyze Code Security
14+
runs-on: ubuntu-latest
15+
permissions:
16+
actions: read
17+
contents: read
18+
security-events: write
19+
20+
steps:
21+
- name: Checkout repository
22+
uses: actions/checkout@v4
23+
24+
- name: Initialize CodeQL
25+
uses: github/codeql-action/init@v3
26+
with:
27+
languages: 'javascript' # Enfocado en tu stack de Node.js
28+
29+
- name: Autobuild
30+
uses: github/codeql-action/autobuild@v3
31+
32+
- name: Perform CodeQL Analysis
33+
uses: github/codeql-action/analyze@v3

0 commit comments

Comments
 (0)