c4k-forgejo/.gitlab-ci.yml

124 lines
4.2 KiB
YAML
Raw Normal View History

2022-06-07 15:37:21 +00:00
stages:
- build_and_test
- package
- security
- upload
- image
services:
- docker:19.03.12-dind
.cljs-job: &cljs
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
- npm install
.clj-uploadjob: &clj
image: domaindrivenarchitecture/lein
cache:
key: ${CI_COMMIT_REF_SLUG}
paths:
- .m2
before_script:
- mkdir -p /root/.lein
- echo "{:auth {:repository-auth {#\"clojars\" {:username \"${CLOJARS_USER}\" :password \"${CLOJARS_TOKEN_DOMAINDRIVENARCHITECTURE}\" }}}}" > ~/.lein/profiles.clj
test-cljs:
<<: *cljs
stage: build_and_test
script:
- shadow-cljs compile test
2022-09-02 08:02:34 +00:00
- node target/node-tests.js
2022-06-07 15:37:21 +00:00
test-clj:
<<: *clj
stage: build_and_test
script:
- lein test
2022-07-29 14:36:26 +00:00
test-schema:
2022-06-07 15:37:21 +00:00
<<: *clj
stage: build_and_test
script:
- lein uberjar
2023-04-21 06:56:06 +00:00
- java -jar target/uberjar/c4k-forgejo-standalone.jar src/test/resources/forgejo-test/valid-config.yaml src/test/resources/forgejo-test/valid-auth.yaml | kubeconform --kubernetes-version 1.19.0 --strict --skip Certificate -
2022-06-07 15:37:21 +00:00
artifacts:
paths:
- target/uberjar
report-frontend:
<<: *cljs
stage: package
script:
- mkdir -p target/frontend-build
- shadow-cljs run shadow.cljs.build-report frontend target/frontend-build/build-report.html
artifacts:
paths:
- target/frontend-build/build-report.html
package-frontend:
<<: *cljs
stage: package
script:
- mkdir -p target/frontend-build
- shadow-cljs release frontend
2023-04-21 06:56:06 +00:00
- cp public/js/main.js target/frontend-build/c4k-forgejo.js
- sha256sum target/frontend-build/c4k-forgejo.js > target/frontend-build/c4k-forgejo.js.sha256
- sha512sum target/frontend-build/c4k-forgejo.js > target/frontend-build/c4k-forgejo.js.sha512
2022-06-07 15:37:21 +00:00
artifacts:
paths:
- target/frontend-build
package-uberjar:
<<: *clj
stage: package
script:
- lein uberjar
2023-04-21 06:56:06 +00:00
- sha256sum target/uberjar/c4k-forgejo-standalone.jar > target/uberjar/c4k-forgejo-standalone.jar.sha256
- sha512sum target/uberjar/c4k-forgejo-standalone.jar > target/uberjar/c4k-forgejo-standalone.jar.sha512
2022-06-07 15:37:21 +00:00
artifacts:
paths:
- target/uberjar
upload-clj-release:
<<: *clj
stage: upload
rules:
- if: '$CI_COMMIT_TAG != null'
script:
- lein deploy
release:
image: registry.gitlab.com/gitlab-org/release-cli:latest
stage: upload
rules:
- if: '$CI_COMMIT_TAG != null'
artifacts:
paths:
- target/uberjar
- target/frontend-build
script:
- apk --no-cache add curl
- |
release-cli create --name "Release $CI_COMMIT_TAG" --tag-name $CI_COMMIT_TAG \
2023-04-21 06:56:06 +00:00
--assets-link "{\"name\":\"c4k-forgejo-standalone.jar\",\"url\":\"https://gitlab.com/domaindrivenarchitecture/c4k-forgejo/-/jobs/${CI_JOB_ID}/artifacts/file/target/uberjar/c4k-forgejo-standalone.jar\"}" \
--assets-link "{\"name\":\"c4k-forgejo-standalone.jar.sha256\",\"url\":\"https://gitlab.com/domaindrivenarchitecture/c4k-forgejo/-/jobs/${CI_JOB_ID}/artifacts/file/target/uberjar/c4k-forgejo-standalone.jar.sha256\"}" \
--assets-link "{\"name\":\"c4k-forgejo-standalone.jar.sha512\",\"url\":\"https://gitlab.com/domaindrivenarchitecture/c4k-forgejo/-/jobs/${CI_JOB_ID}/artifacts/file/target/uberjar/c4k-forgejo-standalone.jar.sha512\"}" \
--assets-link "{\"name\":\"c4k-forgejo.js\",\"url\":\"https://gitlab.com/domaindrivenarchitecture/c4k-forgejo/-/jobs/${CI_JOB_ID}/artifacts/file/target/frontend-build/c4k-forgejo.js\"}" \
--assets-link "{\"name\":\"c4k-forgejo.js.sha256\",\"url\":\"https://gitlab.com/domaindrivenarchitecture/c4k-forgejo/-/jobs/${CI_JOB_ID}/artifacts/file/target/frontend-build/c4k-forgejo.js.sha256\"}" \
--assets-link "{\"name\":\"c4k-forgejo.js.sha512\",\"url\":\"https://gitlab.com/domaindrivenarchitecture/c4k-forgejo/-/jobs/${CI_JOB_ID}/artifacts/file/target/frontend-build/c4k-forgejo.js.sha512\"}" \
forgejo-image-test-publish:
image: domaindrivenarchitecture/devops-build:latest
stage: image
rules:
- if: '$CI_COMMIT_TAG != null'
script:
- cd infrastructure/docker-federated && pyb image test publish