aboutsummaryrefslogtreecommitdiff
path: root/.gitlab-ci.yml
diff options
context:
space:
mode:
authorA Farzat <a@farzat.xyz>2026-03-09 16:55:11 +0300
committerA Farzat <a@farzat.xyz>2026-03-09 16:55:11 +0300
commite2f051a2120176c1f53c18ab69ffd53bf90b1e0c (patch)
tree397b15713ce74fafdb525691ebcdbfad26fb19d0 /.gitlab-ci.yml
parent9a2f37d7562b1aecae9c38b4e77e5216ba33bcd4 (diff)
downloadoreilly-epub-e2f051a2120176c1f53c18ab69ffd53bf90b1e0c.tar.gz
oreilly-epub-e2f051a2120176c1f53c18ab69ffd53bf90b1e0c.zip
Add basic GitLab CI workflow
Diffstat (limited to '.gitlab-ci.yml')
-rw-r--r--.gitlab-ci.yml49
1 files changed, 49 insertions, 0 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
new file mode 100644
index 0000000..bbae1fc
--- /dev/null
+++ b/.gitlab-ci.yml
@@ -0,0 +1,49 @@
+stages:
+ - check
+ - test
+ - release
+
+default:
+ image: rust:1.93
+ cache:
+ key: "$CI_COMMIT_REF_SLUG"
+ paths:
+ - target
+ - .cargo/registry
+ - .cargo/git
+
+check:
+ stage: check
+ script:
+ - cargo fmt --all -- --check
+ - cargo clippy --all-targets --all-features -- -D warnings
+ only:
+ - branches
+ - tags
+
+test:
+ stage: test
+ script:
+ - cargo test --all
+ needs:
+ - check
+ only:
+ - branches
+ - tags
+
+release:
+ stage: release
+ needs:
+ - test
+ # Only run on tags starting with "v"
+ rules:
+ - if: '$CI_COMMIT_TAG =~ /^v\d+\.\d+\.\d+$/'
+ script:
+ - cargo build --release
+ - mkdir -p dist
+ - cp target/release/oreilly-epub dist/oreilly-epub-linux-x86_64
+ artifacts:
+ name: "oreilly-epub-$CI_COMMIT_TAG-linux-x86_64"
+ paths:
+ - dist/oreilly-epub-linux-x86_64
+ expire_in: 1 week