Skip to content

Commit 762a5dc

Browse files
committed
feat: use github actions
1 parent 0bd0eaa commit 762a5dc

File tree

2 files changed

+85
-0
lines changed

2 files changed

+85
-0
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: "Install node and dependencies"
2+
description: "Installs node and dependencies with npm ci"
3+
inputs:
4+
NODE_VERSION_FILE:
5+
description: "Location of the .nvmrc file"
6+
required: true
7+
runs:
8+
using: composite
9+
steps:
10+
- name: Checkout code
11+
uses: actions/checkout@v4
12+
- name: Install Node
13+
uses: actions/setup-node@v4
14+
with:
15+
node-version-file: ${{ inputs.NODE_VERSION_FILE }}
16+
- name: Install
17+
shell: bash
18+
run: npm ci

.github/workflows/cicd.yaml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
---
2+
name: CICD
3+
on:
4+
pull_request:
5+
branches: [main]
6+
push:
7+
branches: [main]
8+
env:
9+
NODE_VERSION_FILE: ".nvmrc"
10+
jobs:
11+
build-lint-format:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@v4
16+
- name: Install Node and dependencies
17+
uses: ./.github/actions/npminstall
18+
with:
19+
node-version-file: ${{ env.NODE_VERSION_FILE }}
20+
- name: Build with ts
21+
run: npm run build
22+
- name: Lint
23+
run: npm run lint
24+
- name: Format
25+
run: npm run format
26+
docker:
27+
runs-on: ubuntu-latest
28+
steps:
29+
- name: Checkout code
30+
uses: actions/checkout@v4
31+
- name: Set up Docker Buildx
32+
uses: docker/setup-buildx-action@v3
33+
- name: Build image
34+
run: docker build -t code-review-exercise-node:${{ github.sha }} .
35+
gitleaks:
36+
runs-on: ubuntu-latest
37+
steps:
38+
- name: Checkout code
39+
uses: actions/checkout@v4
40+
with:
41+
fetch-depth: 0
42+
- name: Run Gitleaks
43+
uses: gitleaks/gitleaks-action@v2
44+
env:
45+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
46+
GITLEAKS_LICENSE: ${{ secrets.GITLEAKS_LICENSE }}
47+
snyk:
48+
runs-on: ubuntu-latest
49+
steps:
50+
- uses: actions/checkout@v4
51+
- name: Run Snyk to check for vulnerabilities
52+
uses: snyk/actions/[email protected]
53+
env:
54+
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
55+
with:
56+
command: monitor
57+
test:
58+
runs-on: ubuntu-latest
59+
steps:
60+
- name: Checkout code
61+
uses: actions/checkout@v4
62+
- name: Install Node and dependencies
63+
uses: ./.github/actions/npminstall
64+
with:
65+
node-version-file: ${{ env.NODE_VERSION_FILE }}
66+
- name: Test
67+
run: npm run test

0 commit comments

Comments
 (0)