tiempo-rs/.gitlab-ci.yml

175 lines
5.5 KiB
YAML
Raw Normal View History

2021-12-03 08:57:22 -06:00
stages:
- test
- 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 == "man-page"
when: never
2021-07-16 18:00:08 -05:00
2022-09-20 09:43:43 -05:00
build-doc:
stage: build
image: python:3.10
script:
- pip install sphinx
- cd docs/
- make html
- make man
- gzip build/man/tiempo.1
rules:
2022-09-24 22:29:03 -05:00
- if: $CI_COMMIT_BRANCH == "man-page"
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-09-24 22:29:03 -05:00
- if: $CI_COMMIT_BRANCH == "man-page"
2022-09-24 22:25:29 -05:00
2021-12-03 09:43:43 -06:00
build:
stage: build
image: categulario/rust-cli-image:latest
script:
# build the binary
- cargo build --locked --release
# create the tar package
2022-09-20 09:43:43 -05:00
- mkdir -p build/bin build/doc/man
2021-12-03 09:43:43 -06:00
# move things to the build directory
2022-09-20 09:43:43 -05:00
- cp target/release/t build/bin/
- cp CHANGELOG.md build/doc/
- cp README.md build/doc/
- cp LICENSE build/doc/
- cp -R docs/build/html build/doc/
- cp docs/build/man/tiempo.1.gz build/doc/man/
2021-12-03 09:43:43 -06:00
# compress the tar file
2021-12-03 09:59:49 -06:00
- tar -cvzf tiempo-${CI_COMMIT_TAG:1}-x86_64.tar.gz build/
2021-12-03 09:43:43 -06:00
# makes the debian archive
- ./debpackage.sh
# computes the sums
2021-12-03 09:59:49 -06:00
- sha256sum tiempo-${CI_COMMIT_TAG:1}-x86_64.tar.gz > tiempo-${CI_COMMIT_TAG:1}-x86_64.tar.gz.sum
- sha256sum debian-package/tiempo_${CI_COMMIT_TAG:1}_amd64.deb > tiempo_${CI_COMMIT_TAG:1}_amd64.deb.sum
2021-12-03 09:43:43 -06:00
artifacts:
paths:
2021-12-03 09:59:49 -06:00
- tiempo-${CI_COMMIT_TAG:1}-x86_64.tar.gz
- debian-package/tiempo_${CI_COMMIT_TAG:1}_amd64.deb
- tiempo-${CI_COMMIT_TAG:1}-x86_64.tar.gz.sum
- tiempo_${CI_COMMIT_TAG:1}_amd64.deb.sum
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:
2021-12-13 22:08:20 -06:00
- 'curl --header "JOB-TOKEN: ${CI_JOB_TOKEN}" --upload-file tiempo-${CI_COMMIT_TAG:1}-x86_64.tar.gz ${PACKAGE_REGISTRY_URL}/tiempo-${CI_COMMIT_TAG:1}-x86_64.tar.gz'
- 'curl --header "JOB-TOKEN: ${CI_JOB_TOKEN}" --upload-file tiempo-${CI_COMMIT_TAG:1}-x86_64.tar.gz.sum ${PACKAGE_REGISTRY_URL}/tiempo-${CI_COMMIT_TAG:1}-x86_64.tar.gz.sum'
- 'curl --header "JOB-TOKEN: ${CI_JOB_TOKEN}" --upload-file debian-package/tiempo_${CI_COMMIT_TAG:1}_amd64.deb ${PACKAGE_REGISTRY_URL}/tiempo_${CI_COMMIT_TAG:1}_amd64.deb'
2021-12-13 22:45:38 -06:00
- 'curl --header "JOB-TOKEN: ${CI_JOB_TOKEN}" --upload-file tiempo_${CI_COMMIT_TAG:1}_amd64.deb.sum ${PACKAGE_REGISTRY_URL}/tiempo_${CI_COMMIT_TAG:1}_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'
url: '${PACKAGE_REGISTRY_URL}/tiempo-${CI_COMMIT_TAG:1}-x86_64.tar.gz'
- name: 'Any linux binary sha256 sum'
url: '${PACKAGE_REGISTRY_URL}/tiempo-${CI_COMMIT_TAG:1}-x86_64.tar.gz.sum'
- name: 'Debian archive'
url: '${PACKAGE_REGISTRY_URL}/tiempo_${CI_COMMIT_TAG:1}_amd64.deb'
- name: 'Debian archive sha256 sum'
url: '${PACKAGE_REGISTRY_URL}/tiempo_${CI_COMMIT_TAG:1}_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"
# finally run the script
- scripts/release-aur-bin.sh
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"
# finally run the script
- scripts/release-aur-git.sh
rules:
- if: $CI_COMMIT_BRANCH
when: never
- if: $CI_COMMIT_TAG =~ /^v*/
# pages:
# image: python:3.8-alpine
# stage: deploy
# script:
# - pip install -U sphinx
# - mkdir -p public/{es,en}
# - sphinx-build -b html ./docs/es/source/ public/es
# - sphinx-build -b html ./docs/en/source/ public/en
# artifacts:
# paths:
# - public
# rules:
# - if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH