159 lines
4.7 KiB
YAML
159 lines
4.7 KiB
YAML
stages:
|
|
- test
|
|
- build-doc
|
|
- build
|
|
- upload
|
|
- release
|
|
- aur
|
|
|
|
test:cargo:
|
|
image: rust:latest
|
|
stage: test
|
|
script:
|
|
- rustc --version && cargo --version # Print version info for debugging
|
|
- rustup component add clippy
|
|
- cargo clippy --all-targets --all-features -- -D warnings
|
|
- cargo test
|
|
rules:
|
|
- if: $CI_COMMIT_BRANCH == "main"
|
|
|
|
build-doc:
|
|
stage: build-doc
|
|
image: python:3.10
|
|
script:
|
|
- cd docs/
|
|
- pip install -r requirements.txt
|
|
- make html
|
|
- make man
|
|
- gzip build/man/tiempo.1
|
|
rules:
|
|
- if: $CI_COMMIT_BRANCH == "main"
|
|
artifacts:
|
|
paths:
|
|
- docs/build/html
|
|
- docs/build/man/tiempo.1.gz
|
|
|
|
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:
|
|
- if: $CI_COMMIT_BRANCH == "main"
|
|
|
|
build:
|
|
stage: build
|
|
image: categulario/tiempo-build-env:1.65
|
|
script:
|
|
- ./scripts/build.sh
|
|
artifacts:
|
|
paths:
|
|
- artifacts/
|
|
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}"
|
|
COMMITER_NAME: Abraham Toriz
|
|
COMMITER_EMAIL: categulario+gitlabci@gmail.com
|
|
|
|
upload:
|
|
stage: upload
|
|
image: curlimages/curl:latest
|
|
rules:
|
|
- if: $CI_COMMIT_BRANCH
|
|
when: never
|
|
- if: $CI_COMMIT_TAG =~ /^v*/
|
|
script:
|
|
- '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'
|
|
|
|
release:
|
|
stage: release
|
|
image: registry.gitlab.com/gitlab-org/release-cli:latest
|
|
rules:
|
|
- if: $CI_COMMIT_BRANCH
|
|
when: never
|
|
- if: $CI_COMMIT_TAG =~ /^v*/
|
|
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}-x86_64.tar.gz'
|
|
- name: 'Any linux binary sha256 sum'
|
|
url: '${PACKAGE_REGISTRY_URL}/tiempo-${CI_COMMIT_TAG}-x86_64.tar.gz.sum'
|
|
- name: 'Debian archive'
|
|
url: '${PACKAGE_REGISTRY_URL}/tiempo_${CI_COMMIT_TAG}_amd64.deb'
|
|
- name: 'Debian archive sha256 sum'
|
|
url: '${PACKAGE_REGISTRY_URL}/tiempo_${CI_COMMIT_TAG}_amd64.deb.sum'
|
|
|
|
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"
|
|
# Clone the repo
|
|
- git clone $BIN_REPO_URL $PROJECT_NAME-bin
|
|
# generate the PKGBUILD in the current directory
|
|
- scripts/release-aur-bin.sh
|
|
- mv PKGBUILD $PROJECT_NAME-bin/
|
|
- mv .SRCINFO $PROJECT_NAME-bin/
|
|
# commit
|
|
- cd $PROJECT_NAME-bin
|
|
- git add .
|
|
- git commit -m "Release version $CI_COMMIT_TAG"
|
|
- git push
|
|
rules:
|
|
- if: $CI_COMMIT_BRANCH
|
|
when: never
|
|
- if: $CI_COMMIT_TAG =~ /^v*/
|
|
|
|
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"
|
|
# clone the repo
|
|
- git clone $GIT_REPO_URL $PROJECT_NAME-git
|
|
# finally run the script
|
|
- scripts/release-aur-git.sh
|
|
- mv PKGBUILD $PROJECT_NAME-bin/
|
|
- mv .SRCINFO $PROJECT_NAME-bin/
|
|
# and commit
|
|
- cd $PROJECT_NAME-bin
|
|
- git add .
|
|
- git commit -m "Release version $VERSION"
|
|
- git push
|
|
rules:
|
|
- if: $CI_COMMIT_BRANCH
|
|
when: never
|
|
- if: $CI_COMMIT_TAG =~ /^v*/
|