Skip to content

Commit

Permalink
ci: Adding simple tests including workflow
Browse files Browse the repository at this point in the history
References: FLAGBIT-2
  • Loading branch information
mralexandernickel committed Feb 27, 2024
1 parent 8b3bf56 commit 93de2c9
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
name: test
on:
push:
jobs:
test:
runs-on: self-hosted
steps:
- run: make test
3 changes: 3 additions & 0 deletions COMMITMSG
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
ci: This is a commitmessage to create a positive test

References: TICKET-123
18 changes: 18 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,21 @@ GITHUB_BASE_REF ?= master
.PHONY: lint
lint:
node_modules/.bin/commitlint -g commitlint.config.js --from=$$(git rev-parse remotes/origin/$(GITHUB_BASE_REF))

.PHONY: test
test: test/positive test/negative

.PHONY: test/negative
test/negative:
podman run --rm \
-v $$(pwd)/commitlint.test.config.js:/commitlint.config.js \
docker.io/library/node:alpine \
npm install --no-audit --no-fund -g @commitlint/cli @flagbit/config-commitlint; echo foo | commitlint || echo success

.PHONY: test/positive
test/positive:
podman run --rm \
-v $$(pwd)/commitlint.test.config.js:/commitlint.config.js \
-v $$(pwd)/COMMITMSG:/COMMITMSG \
docker.io/library/node:alpine \
npm install --no-audit --no-fund -g @commitlint/cli @flagbit/config-commitlint; cat COMMITMSG | commitlint && echo success
11 changes: 11 additions & 0 deletions commitlint.test.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module.exports = {
extends: ["@flagbit/config-commitlint"],
parserPreset: {
parserOpts: {
issuePrefixes: ["\\s[\\w\\d]{1,10}-"],
},
},
rules: {
'subject-case': [2, 'always', ['sentence-case']]
}
};

0 comments on commit 93de2c9

Please sign in to comment.