Skip to content

Commit 95435dd

Browse files
authored
Update configuration of badges (#32)
* Update configuration of badges * Set up eslint correctly with typescript * fix all eslint errors * Update action dependencies * Tweak elint setup * Just run eslint * eslint stuff again * more eslint stuff * update lint script * cleanup * Use npm * update dockerfile * Update tests * Use specific mailslurp inbox * Add missing env variables to example * Start test environment * use environmental variables * use correct env * tests envalid stuff * import dotenv * copy env file * 🍕 spicy jalapeones * env struggle * env file action again * cici * add own reporter * fix env var * await on close worker * jest force exit
1 parent 7f6d507 commit 95435dd

22 files changed

+6134
-4872
lines changed

.dockerignore

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,19 @@
22
*.log
33
.DS_Store
44
.env
5-
.env.example
5+
.env.*
66
/local-data
77
/dist
88
/payloads
99
docker-compose.yml
10-
*.conf
10+
*.conf
11+
jest.config.ts
12+
.eslintignore
13+
.eslintrc.json
14+
.babelrc
15+
.dockerignore
16+
.git
17+
.github
18+
.gitignore
19+
.prettierignore
20+
.prettierrc.json

.env.example

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,7 @@ BADGR_CLIENT_SECRET=
1313

1414
# The following values are just for testing
1515
MAILSLURP_API_KEY=
16+
MAILSLURP_INBOX_ID=
17+
MAILSLURP_INBOX_EMAIL_ADDRESS=
1618
BADGE_CLASS_ENTITY_ID=
1719
ISSUER_ENTITY_ID=

.eslintignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
dist
2+
node_modules
3+
.github
4+
**/*.test.ts
5+
jest.config.ts

.eslintrc.js

Lines changed: 0 additions & 4 deletions
This file was deleted.

.eslintrc.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"root": true,
3+
"extends": [
4+
"eslint:recommended",
5+
"plugin:@typescript-eslint/recommended",
6+
"prettier"
7+
],
8+
"parser": "@typescript-eslint/parser",
9+
"parserOptions": {
10+
"project": ["./tsconfig.json"]
11+
},
12+
"plugins": ["@typescript-eslint"]
13+
}

.github/workflows/lint.yml

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Lint
1+
name: 🔬 Lint
22

33
on:
44
push:
@@ -9,26 +9,22 @@ on:
99

1010
jobs:
1111
run-linters:
12-
name: Run linters
12+
name: ⬣ ESLint
1313
runs-on: ubuntu-latest
1414

1515
steps:
16-
- name: Check out Git repository
17-
uses: actions/checkout@v2
16+
- name: ⬇️ Check out Git repository
17+
uses: actions/checkout@v4
1818

19-
- name: Set up Node.js
20-
uses: actions/setup-node@v1
19+
- name: Set up Node.js
20+
uses: actions/setup-node@v3
2121
with:
2222
node-version: 20
23+
cache: npm
24+
cache-dependency-path: ./package.json
2325

24-
# ESLint and Prettier must be in `package.json`
25-
- name: Install Node.js dependencies
26+
- name: 💿 Install dependencies
2627
run: npm install
2728

28-
- name: Run linters
29-
uses: wearerequired/lint-action@v1
30-
with:
31-
github_token: ${{ secrets.github_token }}
32-
# Enable linters
33-
eslint: true
34-
prettier: true
29+
- name: 🔬 Run linters
30+
run: npm run lint

.github/workflows/registry-build-publish.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Build and publish to Github Container Registry
1+
name: 🏗️ Build and publish to Github Container Registry
22

33
on:
44
push:
@@ -20,27 +20,27 @@ jobs:
2020
packages: write
2121

2222
steps:
23-
- name: Checkout repository
24-
uses: actions/checkout@v3
23+
- name: ⬇️ Checkout repository
24+
uses: actions/checkout@v4
2525

26-
- name: Log in to the Container registry
27-
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
26+
- name: 🔓 Log in to the Container registry
27+
uses: docker/login-action@v3
2828
with:
2929
registry: ${{ env.REGISTRY }}
3030
username: ${{ github.actor }}
3131
password: ${{ secrets.GHCR_TOKEN }}
3232

33-
- name: Extract metadata (tags, labels) for Docker
33+
- name: ℹ️ Extract metadata (tags, labels) for Docker
3434
id: meta
35-
uses: docker/metadata-action@507c2f2dc502c992ad446e3d7a5dfbe311567a96
35+
uses: docker/metadata-action@v5
3636
with:
3737
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
3838
flavor: |
3939
latest=auto
4040
prefix=
4141
suffix=
42-
- name: Build and push Docker image
43-
uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671
42+
- name: 🐳 Build and push Docker image
43+
uses: docker/build-push-action@v5
4444
with:
4545
context: .
4646
push: true

.github/workflows/registry-pr-purge.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Purge Pull Request Image
1+
name: 🗑️ Purge Pull Request Image
22

33
# https://docs.github.com/en/actions/reference/events-that-trigger-workflows#registry_package
44
# Purge Pull Request Image

.github/workflows/registry-purge.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Purge untagged images
1+
name: 🗑️ Purge untagged images
22

33
# https://docs.github.com/en/actions/reference/events-that-trigger-workflows#registry_package
44
# Run cleanup job if a new package was published or updated

.github/workflows/test.yml

Lines changed: 43 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Jest Test
1+
name: 🃏 Jest Test
22

33
on:
44
push:
@@ -8,11 +8,47 @@ on:
88
- main
99

1010
jobs:
11-
build:
11+
test:
12+
name:
1213
runs-on: ubuntu-latest
1314
steps:
14-
- uses: actions/checkout@v2
15-
- name: Install modules
16-
run: yarn
17-
- name: Run tests
18-
run: yarn test
15+
- name: ⬇️ Checkout repo
16+
uses: actions/checkout@v4
17+
18+
- name: ⎔ Setup node
19+
uses: actions/setup-node@v3
20+
with:
21+
cache: npm
22+
cache-dependency-path: ./package.json
23+
node-version: 20
24+
25+
- name: 💿 Install dependencies
26+
run: npm install
27+
28+
- name: 🐳 Docker compose
29+
run: docker compose up -d && sleep 10
30+
31+
- name: 🏄 Copy test env vars
32+
uses: SpicyPizza/create-envfile@v2.0
33+
with:
34+
envkey_REDIS_HOST: ${{ vars.REDIS_HOST }}
35+
envkey_REDIS_PORT: ${{ vars.REDIS_PORT }}
36+
envkey_REDIS_USERNAME: ${{ secrets.REDIS_USERNAME }}
37+
envkey_REDIS_PASSWORD: ${{ secrets.REDIS_PASSWORD}}
38+
envkey_REDIS_DB: ${{ vars.REDIS_DB }}
39+
envkey_BULLMQ_QUEUE_NAME: ${{ vars.BULLMQ_QUEUE_NAME }}
40+
envkey_BADGR_URL: ${{ vars.BADGR_URL }}
41+
envkey_BADGR_ISSUER_ID: ${{ secrets.BADGR_ISSUER_ID }}
42+
envkey_BADGR_USERNAME: ${{ secrets.BADGR_USERNAME }}
43+
envkey_BADGR_PASSWORD: ${{ secrets.BADGR_PASSWORD}}
44+
envkey_BADGR_CLIENT_ID: ${{ secrets.BADGR_CLIENT_ID}}
45+
envkey_BADGR_CLIENT_SECRET: ${{secrets.BADGR_CLIENT_SECRET }}
46+
envkey_BADGE_MAPPINGS: ${{ secrets.BADGE_MAPPINGS }}
47+
envkey_MAILSLURP_API_KEY: ${{ secrets.MAILSLURP_API_KEY }}
48+
envkey_MAILSLURP_INBOX_ID: ${{ secrets.MAILSLURP_INBOX_ID }}
49+
envkey_MAILSLURP_INBOX_EMAIL_ADDRESS: ${{ secrets.MAILSLURP_INBOX_EMAIL_ADDRESS }}
50+
envkey_BADGE_CLASS_ENTITY_ID: ${{ secrets.BADGE_CLASS_ENTITY_ID }}
51+
envkey_ISSUER_ENTITY_ID: ${{ secrets.ISSUER_ENTITY_ID }}
52+
53+
- name: 🔬 Run tests
54+
run: npm run test:ci

0 commit comments

Comments
 (0)