This repository has been archived on 2023-07-28. You can view files and clone it, but cannot push or open issues or pull requests.
mastodon-bot/.gitlab-ci.yml

125 lines
3.1 KiB
YAML
Raw Normal View History

2021-02-09 19:14:09 +00:00
stages:
2021-02-12 12:26:24 +00:00
- build_and_test
2021-02-10 12:03:38 +00:00
- package
2021-02-10 15:04:56 +00:00
- security
2021-02-10 12:03:38 +00:00
- upload
2021-03-12 12:43:51 +00:00
- image
services:
- docker:19.03.12-dind
2021-02-09 19:14:09 +00:00
2021-02-10 15:04:56 +00:00
.cljs-job: &cljs
image: domaindrivenarchitecture/shadow-cljs
2021-02-10 15:04:56 +00:00
cache:
key: ${CI_COMMIT_REF_SLUG}
paths:
- node_modules/
2021-02-10 12:03:38 +00:00
before_script:
2021-03-12 08:27:33 +00:00
- npm install
2021-02-10 12:03:38 +00:00
.cljs-upload-job: &cljs-upload
image: domaindrivenarchitecture/shadow-cljs
2021-02-10 15:04:56 +00:00
cache:
key: ${CI_COMMIT_REF_SLUG}
paths:
- node_modules/
before_script:
2021-02-12 11:28:21 +00:00
- echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > ~/.npmrc
- mkdir -p target/npm-build
- cp target/mastodon-bot.js target/npm-build/
- cp target/mastodon-bot.js.sha256 target/npm-build/
- cp target/mastodon-bot.js.sha512 target/npm-build/
- cp README.md target/npm-build/
2021-02-10 15:04:56 +00:00
.clj-uploadjob: &clj-upload
2021-03-11 16:56:47 +00:00
image: clojure:lein-2.7.1-alpine
2021-03-12 09:42:17 +00:00
before_script:
- echo "{:auth {:repository-auth {#\"clojars\" {:username \"${CLOJARS_USER}\" :password \"${CLOJARS_PASSWORD}\" }}}}" > ~/.lein/profiles.clj
2021-03-11 16:56:47 +00:00
2021-02-12 12:26:24 +00:00
build_and_test:
2021-02-10 15:04:56 +00:00
<<: *cljs
2021-02-12 12:26:24 +00:00
stage: build_and_test
2021-02-10 14:23:06 +00:00
script:
2021-02-09 19:14:09 +00:00
- shadow-cljs compile test
2021-03-11 16:56:47 +00:00
cache:
key: ${CI_COMMIT_REF_SLUG}
paths:
- .m2
2021-02-10 12:03:38 +00:00
2021-03-12 09:42:17 +00:00
#activate as soon as https://github.com/thheller/shadow-cljs/issues/843 is implemented
2021-02-12 12:26:24 +00:00
.report:
2021-02-10 15:04:56 +00:00
<<: *cljs
2021-02-12 12:26:24 +00:00
stage: build_and_test
script:
- shadow-cljs run shadow.cljs.build-report app target/build-report.html
2021-02-10 12:03:38 +00:00
artifacts:
paths:
2021-02-12 12:26:24 +00:00
- target/build-report.html
package:
<<: *cljs
stage: package
2021-02-10 14:23:06 +00:00
script:
2021-03-12 12:43:51 +00:00
- shadow-cljs release app
2021-02-10 12:52:50 +00:00
- chmod a+x target/mastodon-bot.js
- sha256sum target/mastodon-bot.js > target/mastodon-bot.js.sha256
- sha512sum target/mastodon-bot.js > target/mastodon-bot.js.sha512
2021-02-12 12:26:24 +00:00
artifacts:
paths:
- target/mastodon-bot.js
- target/mastodon-bot.js.sha256
- target/mastodon-bot.js.sha512
2021-02-10 12:03:38 +00:00
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
2021-02-10 15:04:56 +00:00
2021-03-11 16:56:47 +00:00
upload-cljs-prerelease:
<<: *cljs-upload
2021-02-10 12:52:50 +00:00
stage: upload
rules:
- if: '$CI_COMMIT_BRANCH == "master" && $CI_COMMIT_TAG == null'
2021-02-10 14:23:06 +00:00
script:
2021-02-12 11:28:21 +00:00
- cp package.json target/npm-build/
2021-03-12 09:42:17 +00:00
- sed -i 's|SNAPSHOT|'$(date +"%Y%m%d%H%M%S")'|' ./target/npm-build/package.json
2021-02-12 11:28:21 +00:00
- npm publish ./target/npm-build --access public
2021-02-10 12:52:50 +00:00
2021-03-11 16:56:47 +00:00
upload-clj-prerelease:
<<: *clj-upload
2021-03-11 16:56:47 +00:00
stage: upload
rules:
- if: '$CI_COMMIT_BRANCH == "master" && $CI_COMMIT_TAG == null'
2021-03-11 16:56:47 +00:00
script:
2021-03-12 09:42:17 +00:00
- lein deploy clojars
2021-03-11 16:56:47 +00:00
upload-cljs-release:
<<: *cljs-upload
2021-02-10 12:52:50 +00:00
stage: upload
rules:
- if: '$CI_COMMIT_TAG != null'
2021-02-10 14:23:06 +00:00
script:
2021-02-12 11:28:21 +00:00
- cp package.json target/npm-build/
- npm publish ./target/npm-build --access public
2021-03-12 12:43:51 +00:00
upload-clj-release:
<<: *clj-upload
stage: upload
rules:
- if: '$CI_COMMIT_TAG != null'
script:
- lein deploy clojars
2021-03-12 12:43:51 +00:00
build:
image: domaindrivenarchitecture/devops-build:latest
2021-03-12 12:43:51 +00:00
stage: image
rules:
- if: '$CI_COMMIT_TAG != null'
2021-03-12 12:43:51 +00:00
script:
- cd infrastructure/docker && pyb image test publish