tiempo-rs/.gitlab-ci.yml

114 lines
3.4 KiB
YAML
Raw Normal View History

2021-12-03 08:57:22 -06:00
stages:
- test
- build
- deploy
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
- cargo clippy -- -D warnings
- cargo test
2021-07-16 18:00:08 -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
- mkdir -p build
# move things to the build directory
2021-12-03 09:59:49 -06:00
- cp target/release/t build/t
2021-12-03 09:43:43 -06:00
- cp CHANGELOG.md build/CHANGELOG.md
- cp README.md build/README.md
- cp LICENSE build/LICENSE
# 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*/
upload:
stage: deploy
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")
2021-12-03 09:59:49 -06:00
- scp tiempo-${CI_COMMIT_TAG:1}-x86_64.tar.gz $SERVER_USER@$SERVER_HOST:$LINUX_RELEASE_PATH
- scp tiempo-${CI_COMMIT_TAG:1}-x86_64.tar.gz.sum $SERVER_USER@$SERVER_HOST:$LINUX_RELEASE_PATH
- scp debian-package/tiempo_${CI_COMMIT_TAG:1}_amd64.deb $SERVER_USER@$SERVER_HOST:$DEBIAN_RELEASE_PATH
- scp tiempo_${CI_COMMIT_TAG:1}_amd64.deb.sum $SERVER_USER@$SERVER_HOST:$DEBIAN_RELEASE_PATH
2021-12-03 09:43:43 -06:00
rules:
- if: $CI_COMMIT_BRANCH
when: never
- if: $CI_COMMIT_TAG =~ /^v*/
deploy:arch-bin:
stage: deploy
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
when: never
- if: $CI_COMMIT_TAG =~ /^v*/
deploy:arch-git:
stage: deploy
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*/
2021-12-02 20:47:10 -06:00
pages:
2021-12-03 08:57:22 -06:00
image: python:3.8-alpine
2021-12-02 20:47:10 -06:00
stage: deploy
script:
2021-12-03 08:57:22 -06:00
- 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
2021-12-02 20:47:10 -06:00
artifacts:
paths:
- public
rules:
- if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH