add ci
This commit is contained in:
parent
f67df7200d
commit
44a78447db
2 changed files with 109 additions and 12 deletions
94
.gitlab-ci.yml
Normal file
94
.gitlab-ci.yml
Normal file
|
@ -0,0 +1,94 @@
|
||||||
|
stages:
|
||||||
|
- build_and_test
|
||||||
|
- package
|
||||||
|
- security
|
||||||
|
- upload
|
||||||
|
|
||||||
|
.cljs-job: &cljs
|
||||||
|
image: node:lts-buster
|
||||||
|
cache:
|
||||||
|
key: ${CI_COMMIT_REF_SLUG}
|
||||||
|
paths:
|
||||||
|
- node_modules/
|
||||||
|
- .shadow-cljs/
|
||||||
|
before_script:
|
||||||
|
- apt update && apt -qqy install openjdk-11-jre-headless
|
||||||
|
- npm install
|
||||||
|
- npm install -g shadow-cljs
|
||||||
|
|
||||||
|
.js-job: &js-upload
|
||||||
|
image: node:lts-buster
|
||||||
|
cache:
|
||||||
|
key: ${CI_COMMIT_REF_SLUG}
|
||||||
|
paths:
|
||||||
|
- node_modules/
|
||||||
|
- .shadow-cljs/
|
||||||
|
before_script:
|
||||||
|
- echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > ~/.npmrc
|
||||||
|
- mkdir -p target/npm-build
|
||||||
|
- cp target/k8s-mastodon-bot.js target/npm-build/
|
||||||
|
- cp target/k8s-mastodon-bot.js.sha256 target/npm-build/
|
||||||
|
- cp target/k8s-mastodon-bot.js.sha512 target/npm-build/
|
||||||
|
- cp README.md target/npm-build/
|
||||||
|
|
||||||
|
build_and_test:
|
||||||
|
<<: *cljs
|
||||||
|
stage: build_and_test
|
||||||
|
script:
|
||||||
|
- shadow-cljs compile test
|
||||||
|
|
||||||
|
#activate as soon as https://github.com/thheller/shadow-cljs/issues/843 is implemented
|
||||||
|
.report:
|
||||||
|
<<: *cljs
|
||||||
|
stage: build_and_test
|
||||||
|
script:
|
||||||
|
- shadow-cljs run shadow.cljs.build-report app target/build-report.html
|
||||||
|
artifacts:
|
||||||
|
paths:
|
||||||
|
- target/build-report.html
|
||||||
|
|
||||||
|
package:
|
||||||
|
<<: *cljs
|
||||||
|
stage: package
|
||||||
|
script:
|
||||||
|
- shadow-cljs compile app
|
||||||
|
- chmod a+x target/k8s-mastodon-bot.js
|
||||||
|
- sha256sum target/k8s-mastodon-bot.js > target/k8s-mastodon-bot.js.sha256
|
||||||
|
- sha512sum target/k8s-mastodon-bot.js > target/k8s-mastodon-bot.js.sha512
|
||||||
|
artifacts:
|
||||||
|
paths:
|
||||||
|
- target/k8s-mastodon-bot.js
|
||||||
|
- target/k8s-mastodon-bot.js.sha256
|
||||||
|
- target/k8s-mastodon-bot.js.sha512
|
||||||
|
|
||||||
|
sast:
|
||||||
|
variables:
|
||||||
|
SAST_EXCLUDED_ANALYZERS:
|
||||||
|
bandit, brakeman, flawfinder, gosec, kubesec, phpcs-security-audit,
|
||||||
|
pmd-apex, security-code-scan, sobelow, spotbugs
|
||||||
|
stage: security
|
||||||
|
before_script:
|
||||||
|
- mkdir -p builds && cp -r target/ builds/
|
||||||
|
include:
|
||||||
|
- template: Security/SAST.gitlab-ci.yml
|
||||||
|
|
||||||
|
upload-prerelease:
|
||||||
|
<<: *js-upload
|
||||||
|
stage: upload
|
||||||
|
rules:
|
||||||
|
- if: '$CI_COMMIT_BRANCH == "master" && $CI_COMMIT_TAG == null'
|
||||||
|
script:
|
||||||
|
- cp package.json target/npm-build/
|
||||||
|
- npm publish ./target/npm-build --access public
|
||||||
|
# unsure wether that's a good idea to bump versions from ci.
|
||||||
|
#- npm version prerelease -m "[skip-ci] version bump prerelease version"
|
||||||
|
#- git push
|
||||||
|
|
||||||
|
upload-release:
|
||||||
|
<<: *js-upload
|
||||||
|
stage: upload
|
||||||
|
rules:
|
||||||
|
- if: '$CI_COMMIT_BRANCH == "master" && $CI_COMMIT_TAG != null'
|
||||||
|
script:
|
||||||
|
- cp package.json target/npm-build/
|
||||||
|
- npm publish ./target/npm-build --access public
|
27
package.json
27
package.json
|
@ -1,21 +1,24 @@
|
||||||
{
|
{
|
||||||
"name": "k8s-mastodon-bot",
|
"name": "k8s-mastodon-bot",
|
||||||
"version": "1.0.0",
|
"description": "Generate k8s yaml for a mastodon-bot deployment.",
|
||||||
"description": "",
|
|
||||||
"main": "index.js",
|
|
||||||
"scripts": {
|
|
||||||
"test": "echo \"Error: no test specified\" && exit 1"
|
|
||||||
},
|
|
||||||
"repository": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "git+ssh://git@gitlab.com/domaindrivenarchitecture/k8s-mastodon-bot.git"
|
|
||||||
},
|
|
||||||
"author": "meissa GmbH",
|
"author": "meissa GmbH",
|
||||||
|
"version": "0.1.0",
|
||||||
|
"homepage": "https://gitlab.com/domaindrivenarchitecture/k8s-mastodon-bot#readme",
|
||||||
|
"repository": "https://www.npmjs.com/package/k8s-mastodon-bot",
|
||||||
"license": "APACHE2",
|
"license": "APACHE2",
|
||||||
|
"main": "k8s-mastodon-bot.js",
|
||||||
|
"bin": {
|
||||||
|
"mastodon-bot": "./k8s-mastodon-bot.js"
|
||||||
|
},
|
||||||
|
"keywords": [
|
||||||
|
"cljs",
|
||||||
|
"mastodon-bot",
|
||||||
|
"k8s",
|
||||||
|
"deplyoment"
|
||||||
|
],
|
||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://gitlab.com/domaindrivenarchitecture/k8s-mastodon-bot/issues"
|
"url": "https://gitlab.com/domaindrivenarchitecture/k8s-mastodon-bot/issues"
|
||||||
},
|
},
|
||||||
"homepage": "https://gitlab.com/domaindrivenarchitecture/k8s-mastodon-bot#readme",
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"js-yaml": "^4.0.0"
|
"js-yaml": "^4.0.0"
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue