aboutsummaryrefslogtreecommitdiff
path: root/.gitlab-ci.yml
blob: ac9c06086c945679fea3136ce3624b0c773dd5ab (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
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:
    - rustup component add rustfmt
    - 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