tiempo-rs/.gitlab-ci.yml

159 lines
4.7 KiB
YAML
Raw Normal View History

2021-12-03 08:57:22 -06:00
stages:
- test
- build-doc
2021-12-03 08:57:22 -06:00
- build
- upload
- release
2022-07-22 05:21:31 -05:00
- aur
2021-12-03 08:57:22 -06:00
2021-12-03 08:43:04 -06:00
test:cargo:
image: rust:latest
2021-12-03 08:57:22 -06:00
stage: test
2021-12-03 08:43:04 -06:00
script:
- rustc --version && cargo --version # Print version info for debugging
- rustup component add clippy
2021-12-13 14:23:51 -06:00
- cargo clippy --all-targets --all-features -- -D warnings
2021-12-03 08:43:04 -06:00
- cargo test
rules:
- if: $CI_COMMIT_BRANCH == "main"
2021-07-16 18:00:08 -05:00
2022-09-20 09:43:43 -05:00
build-doc:
stage: build-doc
2022-09-20 09:43:43 -05:00
image: python:3.10
script:
- cd docs/
- pip install -r requirements.txt
2022-09-20 09:43:43 -05:00
- make html
- make man
- gzip build/man/tiempo.1
rules:
2022-10-30 23:40:41 -06:00
- if: $CI_COMMIT_BRANCH == "main"
2022-09-20 09:43:43 -05:00
artifacts:
paths:
- docs/build/html
- docs/build/man/tiempo.1.gz
2022-09-24 22:25:29 -05:00
publish-doc:
stage: release
image: kroniak/ssh-client
script:
- mkdir -p ~/.ssh
- echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config
- eval $(ssh-agent -s)
- ssh-add <(echo "$PRIVATE_KEY")
- scp -r docs/build/html/* $SERVER_USER@$SERVER_HOST:$APP_PATH
rules:
2022-10-30 23:40:41 -06:00
- if: $CI_COMMIT_BRANCH == "main"
2022-09-24 22:25:29 -05:00
2021-12-03 09:43:43 -06:00
build:
stage: build
image: categulario/tiempo-build-env:1.65
2021-12-03 09:43:43 -06:00
script:
- ./scripts/build.sh
2021-12-03 09:43:43 -06:00
artifacts:
paths:
- artifacts/
2021-12-03 09:43:43 -06:00
rules:
- if: $CI_COMMIT_BRANCH
when: never
- if: $CI_COMMIT_TAG =~ /^v*/
variables:
PACKAGE_REGISTRY_URL: "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/${CI_COMMIT_TAG}/${CI_COMMIT_TAG}"
2022-07-22 05:21:31 -05:00
COMMITER_NAME: Abraham Toriz
COMMITER_EMAIL: categulario+gitlabci@gmail.com
2021-12-03 09:43:43 -06:00
upload:
stage: upload
image: curlimages/curl:latest
2021-12-03 09:43:43 -06:00
rules:
- if: $CI_COMMIT_BRANCH
when: never
- if: $CI_COMMIT_TAG =~ /^v*/
script:
2022-11-26 18:23:55 -06:00
- 'curl --header "JOB-TOKEN: ${CI_JOB_TOKEN}" --upload-file artifacts/tiempo-${CI_COMMIT_TAG}-x86_64.tar.gz ${PACKAGE_REGISTRY_URL}/tiempo-${CI_COMMIT_TAG}-x86_64.tar.gz'
- 'curl --header "JOB-TOKEN: ${CI_JOB_TOKEN}" --upload-file artifacts/tiempo-${CI_COMMIT_TAG}-x86_64.tar.gz.sum ${PACKAGE_REGISTRY_URL}/tiempo-${CI_COMMIT_TAG}-x86_64.tar.gz.sum'
- 'curl --header "JOB-TOKEN: ${CI_JOB_TOKEN}" --upload-file artifacts/tiempo_${CI_COMMIT_TAG}_amd64.deb ${PACKAGE_REGISTRY_URL}/tiempo_${CI_COMMIT_TAG}_amd64.deb'
- 'curl --header "JOB-TOKEN: ${CI_JOB_TOKEN}" --upload-file artifacts/tiempo_${CI_COMMIT_TAG}_amd64.deb.sum ${PACKAGE_REGISTRY_URL}/tiempo_${CI_COMMIT_TAG}_amd64.deb.sum'
2021-12-03 09:43:43 -06:00
2021-12-13 22:08:20 -06:00
release:
stage: release
image: registry.gitlab.com/gitlab-org/release-cli:latest
2021-12-03 09:43:43 -06:00
rules:
- if: $CI_COMMIT_BRANCH
when: never
- if: $CI_COMMIT_TAG =~ /^v*/
2021-12-02 20:47:10 -06:00
script:
- echo "running release_job"
release:
name: 'Release $CI_COMMIT_TAG'
description: 'Created using the release-cli'
tag_name: '$CI_COMMIT_TAG'
ref: '$CI_COMMIT_TAG'
assets:
links:
- name: 'Any linux binary'
2022-11-26 18:00:47 -06:00
url: '${PACKAGE_REGISTRY_URL}/tiempo-${CI_COMMIT_TAG}-x86_64.tar.gz'
- name: 'Any linux binary sha256 sum'
2022-11-26 18:00:47 -06:00
url: '${PACKAGE_REGISTRY_URL}/tiempo-${CI_COMMIT_TAG}-x86_64.tar.gz.sum'
- name: 'Debian archive'
2022-11-26 18:00:47 -06:00
url: '${PACKAGE_REGISTRY_URL}/tiempo_${CI_COMMIT_TAG}_amd64.deb'
- name: 'Debian archive sha256 sum'
2022-11-26 18:00:47 -06:00
url: '${PACKAGE_REGISTRY_URL}/tiempo_${CI_COMMIT_TAG}_amd64.deb.sum'
2022-07-22 05:21:31 -05:00
deploy:arch-bin:
stage: aur
image: categulario/makepkg
script:
# setup ssh
- mkdir -p ~/.ssh
- echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config
- eval $(ssh-agent -s)
- ssh-add <(echo "$ARCH_PRIVATE_KEY")
# setup git, because we'll commit
- git config --global user.name "$COMMITER_NAME"
- git config --global user.email "$COMMITER_EMAIL"
2022-11-26 18:00:47 -06:00
# Clone the repo
2022-11-26 18:54:17 -06:00
- git clone $BIN_REPO_URL tiempo-bin
2022-11-26 18:00:47 -06:00
# generate the PKGBUILD in the current directory
2022-07-22 05:21:31 -05:00
- scripts/release-aur-bin.sh
2022-11-26 18:54:17 -06:00
- mv PKGBUILD tiempo-bin/
- mv .SRCINFO tiempo-bin/
2022-11-26 18:00:47 -06:00
# commit
2022-11-26 18:54:17 -06:00
- cd tiempo-bin
2022-11-26 18:00:47 -06:00
- git add .
- git commit -m "Release version $CI_COMMIT_TAG"
- git push
2022-07-22 05:21:31 -05:00
rules:
- if: $CI_COMMIT_BRANCH
2022-07-22 05:23:48 -05:00
when: never
2022-07-22 05:21:31 -05:00
- if: $CI_COMMIT_TAG =~ /^v*/
2022-07-22 05:49:32 -05:00
deploy:arch-git:
stage: aur
image: categulario/makepkg
script:
# setup ssh
- mkdir -p ~/.ssh
- echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config
- eval $(ssh-agent -s)
- ssh-add <(echo "$ARCH_PRIVATE_KEY")
# setup git, because we'll commit
- git config --global user.name "$COMMITER_NAME"
- git config --global user.email "$COMMITER_EMAIL"
2022-11-26 18:00:47 -06:00
# clone the repo
2022-11-26 18:54:17 -06:00
- git clone $GIT_REPO_URL tiempo-git
2022-07-22 05:49:32 -05:00
# finally run the script
- scripts/release-aur-git.sh
2022-11-26 19:56:51 -06:00
- mv PKGBUILD tiempo-git/
- mv .SRCINFO tiempo-git/
2022-11-26 18:00:47 -06:00
# and commit
- cd tiempo-git
2022-11-26 18:00:47 -06:00
- git add .
- git commit -m "Release version $VERSION"
- git push
2022-07-22 05:49:32 -05:00
rules:
- if: $CI_COMMIT_BRANCH
when: never
- if: $CI_COMMIT_TAG =~ /^v*/