From 78abfa16e6e26bafc69c681a2b657567659390d6 Mon Sep 17 00:00:00 2001 From: Abraham Toriz Date: Tue, 20 Sep 2022 10:43:43 -0400 Subject: [PATCH] adapt CI to include man file --- .gitlab-ci.yml | 30 +++++++++++++++++++++++++----- docs/requirements.txt | 1 + docs/source/conf.py | 3 ++- scripts/release-aur-bin.sh | 9 +++++---- scripts/release-aur-git.sh | 7 ++++++- 5 files changed, 39 insertions(+), 11 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index a8219ac..63a72be 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -14,6 +14,24 @@ test:cargo: - cargo clippy --all-targets --all-features -- -D warnings - cargo test +build-doc: + stage: build + image: python:3.10 + script: + - pip install sphinx + - cd docs/ + - make html + - make man + - gzip build/man/tiempo.1 + rules: + - if: $CI_COMMIT_BRANCH + when: never + - if: $CI_COMMIT_TAG =~ /^v*/ + artifacts: + paths: + - docs/build/html + - docs/build/man/tiempo.1.gz + build: stage: build image: categulario/rust-cli-image:latest @@ -21,12 +39,14 @@ build: # build the binary - cargo build --locked --release # create the tar package - - mkdir -p build + - mkdir -p build/bin build/doc/man # move things to the build directory - - cp target/release/t build/t - - cp CHANGELOG.md build/CHANGELOG.md - - cp README.md build/README.md - - cp LICENSE build/LICENSE + - 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/ # compress the tar file - tar -cvzf tiempo-${CI_COMMIT_TAG:1}-x86_64.tar.gz build/ # makes the debian archive diff --git a/docs/requirements.txt b/docs/requirements.txt index 3291c9b..64b9866 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -1,2 +1,3 @@ sphinx tomlkit +furo diff --git a/docs/source/conf.py b/docs/source/conf.py index 887e0bf..cbbd013 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -8,6 +8,7 @@ from pathlib import Path from tomlkit import parse +# Make the Cargo.toml file the only source for 'version' _cargo_toml = Path(__file__).resolve().parent.parent.parent / 'Cargo.toml' project = 'Tiempo' @@ -28,5 +29,5 @@ exclude_patterns = [] # -- Options for HTML output ------------------------------------------------- # https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output -html_theme = 'alabaster' +html_theme = 'furo' html_static_path = ['_static'] diff --git a/scripts/release-aur-bin.sh b/scripts/release-aur-bin.sh index 10c47fe..1c3866c 100755 --- a/scripts/release-aur-bin.sh +++ b/scripts/release-aur-bin.sh @@ -33,11 +33,12 @@ sha256sums=('$SUM') package() { cd \"\$srcdir/build\" - install -Dm755 $PROJECT_BINARY \"\$pkgdir\"/usr/bin/$PROJECT_BINARY + install -Dm755 bin/$PROJECT_BINARY \"\$pkgdir\"/usr/bin/$PROJECT_BINARY - install -Dm644 README.md \"\$pkgdir\"/usr/share/doc/$PROJECT_NAME/README.md - install -Dm644 LICENSE \"\$pkgdir\"/usr/share/doc/$PROJECT_NAME/LICENSE - install -Dm644 CHANGELOG.md \"\$pkgdir\"/usr/share/doc/$PROJECT_NAME/CHANGELOG.md + install -Dm644 doc/README.md \"\$pkgdir\"/usr/share/doc/$PROJECT_NAME/README.md + install -Dm644 doc/LICENSE \"\$pkgdir\"/usr/share/doc/$PROJECT_NAME/LICENSE + install -Dm644 doc/CHANGELOG.md \"\$pkgdir\"/usr/share/doc/$PROJECT_NAME/CHANGELOG.md + install -Dm644 doc/man/$PROJECT_NAME.1.gz \"\$pkgdir\"/usr/share/man/man1/$PROJECT_NAME.1.gz } " | tee PKGBUILD > /dev/null diff --git a/scripts/release-aur-git.sh b/scripts/release-aur-git.sh index a5c4306..dbfb973 100755 --- a/scripts/release-aur-git.sh +++ b/scripts/release-aur-git.sh @@ -21,7 +21,7 @@ url='https://gitlab.com/categulario/tiempo-rs' license=('GPL3') depends=() optdepends=('sqlite: for manually editing the database') -makedepends=('cargo' 'git') +makedepends=('cargo' 'git' 'python-sphinx' 'gzip' 'make') provides=('$PROJECT_NAME') conflicts=('$PROJECT_NAME') source=('$PROJECT_NAME-git::git+https://gitlab.com/categulario/tiempo-rs') @@ -35,6 +35,9 @@ pkgver() { build() { cd \"\$pkgname\" cargo build --release --locked + cd docs + make man + gzip build/man/$PROJECT_NAME.1 } package() { @@ -44,6 +47,8 @@ package() { install -Dm644 README.md \"\$pkgdir\"/usr/share/doc/$PROJECT_NAME/README.md install -Dm644 LICENSE \"\$pkgdir\"/usr/share/doc/$PROJECT_NAME/LICENSE install -Dm644 CHANGELOG.md \"\$pkgdir\"/usr/share/doc/$PROJECT_NAME/CHANGELOG.md + + install -Dm644 docs/build/man/$PROJECT_NAME.1.gz \"\$pkgdir\"/usr/share/man/man1/$PROJECT_NAME.1.gz }" | tee PKGBUILD > /dev/null makepkg --printsrcinfo > .SRCINFO