simplify build

This commit is contained in:
jem 2021-03-17 08:24:18 +01:00
parent a437a8bc5f
commit 09a52077c3
2 changed files with 13 additions and 29 deletions

View file

@ -13,25 +13,10 @@ stages:
- .shadow-cljs/ - .shadow-cljs/
- .m2 - .m2
before_script: before_script:
- echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > ~/.npmrc
- npm install - npm install
.cljs-upload-job: &cljs-upload .clj-uploadjob: &clj
image: domaindrivenarchitecture/shadow-cljs
cache:
key: ${CI_COMMIT_REF_SLUG}
paths:
- node_modules/
- .shadow-cljs/
- .m2
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/
.clj-uploadjob: &clj-upload
image: clojure:lein-2.7.1-alpine image: clojure:lein-2.7.1-alpine
cache: cache:
key: ${CI_COMMIT_REF_SLUG} key: ${CI_COMMIT_REF_SLUG}
@ -50,6 +35,7 @@ report:
<<: *cljs <<: *cljs
stage: build_and_test stage: build_and_test
script: script:
- mkdir -p target
- shadow-cljs run shadow.cljs.build-report frontend target/build-report.html - shadow-cljs run shadow.cljs.build-report frontend target/build-report.html
artifacts: artifacts:
paths: paths:
@ -60,14 +46,14 @@ package:
stage: package stage: package
script: script:
- shadow-cljs release app - shadow-cljs release app
- chmod a+x target/k8s-mastodon-bot.js - cp README.md target/npm-build/
- sha256sum target/k8s-mastodon-bot.js > target/k8s-mastodon-bot.js.sha256 - cp package.json target/npm-build/
- sha512sum target/k8s-mastodon-bot.js > target/k8s-mastodon-bot.js.sha512 - chmod a+x target/npm-build/k8s-mastodon-bot.js
- sha256sum target/npm-build/k8s-mastodon-bot.js > target/npm-build/k8s-mastodon-bot.js.sha256
- sha512sum target/npm-build/k8s-mastodon-bot.js > target/npm-build/k8s-mastodon-bot.js.sha512
artifacts: artifacts:
paths: paths:
- target/k8s-mastodon-bot.js - target/npm-build
- target/k8s-mastodon-bot.js.sha256
- target/k8s-mastodon-bot.js.sha512
sast: sast:
variables: variables:
@ -81,17 +67,16 @@ include:
- template: Security/SAST.gitlab-ci.yml - template: Security/SAST.gitlab-ci.yml
upload-cljs-prerelease: upload-cljs-prerelease:
<<: *cljs-upload <<: *cljs
stage: upload stage: upload
rules: rules:
- if: '$CI_COMMIT_BRANCH == "master" && $CI_COMMIT_TAG == null' - if: '$CI_COMMIT_BRANCH == "master" && $CI_COMMIT_TAG == null'
script: script:
- cp package.json target/npm-build/
- sed -i 's|SNAPSHOT|'$(date +"%Y%m%d%H%M%S")'|' ./target/npm-build/package.json - sed -i 's|SNAPSHOT|'$(date +"%Y%m%d%H%M%S")'|' ./target/npm-build/package.json
- npm publish ./target/npm-build --access public - npm publish ./target/npm-build --access public
upload-clj-prerelease: upload-clj-prerelease:
<<: *clj-upload <<: *clj
stage: upload stage: upload
rules: rules:
- if: '$CI_COMMIT_BRANCH == "master" && $CI_COMMIT_TAG == null' - if: '$CI_COMMIT_BRANCH == "master" && $CI_COMMIT_TAG == null'
@ -99,10 +84,9 @@ upload-clj-prerelease:
- lein deploy clojars - lein deploy clojars
upload-cljs-release: upload-cljs-release:
<<: *cljs-upload <<: *cljs
stage: upload stage: upload
rules: rules:
- if: '$CI_COMMIT_TAG != null' - if: '$CI_COMMIT_TAG != null'
script: script:
- cp package.json target/npm-build/
- npm publish ./target/npm-build --access public - npm publish ./target/npm-build --access public

View file

@ -12,7 +12,7 @@
:release {} :release {}
:compiler-options {:optimizations :advanced}} :compiler-options {:optimizations :advanced}}
:app {:target :node-script :app {:target :node-script
:output-to "target/k8s-mastodon-bot.js" :output-to "target/npm-build/k8s-mastodon-bot.js"
:main dda.k8s-mastodon-bot.core/main :main dda.k8s-mastodon-bot.core/main
:compiler-options {:optimizations :simple}} :compiler-options {:optimizations :simple}}
:test {:target :node-test :test {:target :node-test