Skip to content

Commit af4b543

Browse files
committed
Added GitHub action for MongoDB event store Web Api sample
1 parent be8bae0 commit af4b543

File tree

1 file changed

+69
-0
lines changed

1 file changed

+69
-0
lines changed
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: Build and test Sample - WebApi with Express.js and MongoDB
2+
3+
on:
4+
# run it on push to the default repository branch
5+
push:
6+
branches: [main]
7+
paths:
8+
- "samples/webApi/expressjs-with-mongodb/**"
9+
- "./.github/workflows/build_and_test_sample_webapi-expressjs-with-mongodb.yml"
10+
11+
# run it during pull request
12+
pull_request:
13+
paths:
14+
- "samples/webApi/expressjs-with-mongodb/**"
15+
- "./.github/workflows/build_and_test_sample_webapi-expressjs-with-mongodb.yml"
16+
17+
# Allows you to run this workflow manually from the Actions tab
18+
workflow_dispatch:
19+
20+
defaults:
21+
run:
22+
working-directory: samples/webApi/expressjs-with-mongodb
23+
24+
jobs:
25+
build-and-test-code:
26+
name: Build application code
27+
# use system defined below in the tests matrix
28+
runs-on: ubuntu-latest
29+
30+
steps:
31+
- name: Check Out Repo
32+
uses: actions/checkout@v4
33+
34+
- name: Use Node.js
35+
uses: actions/setup-node@v4
36+
with:
37+
node-version-file: ./samples/webApi/expressjs-with-mongodb/.nvmrc
38+
cache: "npm"
39+
cache-dependency-path: "./samples/webApi/expressjs-with-mongodb/package-lock.json"
40+
41+
- name: Install dependencies
42+
run: npm ci
43+
44+
- name: Build TS
45+
run: npm run build:ts
46+
47+
- name: Run linting (ESlint and Prettier)
48+
run: npm run lint
49+
50+
- name: Build
51+
run: npm run build
52+
53+
- name: Test
54+
run: npm run test
55+
56+
- name: Set up Docker Buildx
57+
id: buildx
58+
uses: docker/setup-buildx-action@v2
59+
60+
- name: Build Docker
61+
id: docker_build
62+
uses: docker/build-push-action@v4
63+
with:
64+
context: "./samples/webApi/expressjs-with-mongodb"
65+
push: false
66+
tags: oskardudycz/emmett.mongodb.sample:latest
67+
68+
- name: Image digest
69+
run: echo ${{ steps.docker_build.outputs.digest }}

0 commit comments

Comments
 (0)