-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
72 lines (66 loc) · 1.88 KB
/
.gitlab-ci.yml
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
image: bradqwood/rust-build-docker:1.4.1
stages:
- lint
- test
- publish
- build
variables:
CARGO_HOME: "${CI_PROJECT_DIR}/.cargo"
lint:
stage: lint
cache:
paths:
- target/
- .cargo/
script:
- rustup --version
- rustc --version
- just lint
rules:
- if: '$CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH'
test:
stage: test
cache:
paths:
- target/
- .cargo/
script:
- just tarp
artifacts:
expose_as: coverage report
expire_in: 1 week
paths:
- tarp/tarpaulin-report.html
rules:
- if: '$CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH'
publish to crates.io:
stage: publish
script:
# check that the git tag semver string is the same as the string in Cargo.toml
- test $(grep version Cargo.toml| head -1 | cut -f3 -d\ ) = \"$CI_COMMIT_TAG\"
- cargo publish --token $CRATES_DOT_IO_KEY --allow-dirty
rules:
- if: '$CI_COMMIT_TAG =~ /^(\d+\.)?(\d+\.)?(\*|\d+)$/'
build musl package:
stage: build
image: registry.gitlab.com/rust_musl_docker/image:stable-latest
script:
- apt-get update -qq && apt-get -y -qq install jq
- export BUILD_DIR=git_lab_cli-${CI_COMMIT_TAG}-x86_64-unknown-linux-musl
- export TARBALL=${BUILD_DIR}.tar.gz
- cargo build --release --target=x86_64-unknown-linux-musl
- mkdir -p ${BUILD_DIR}/man
- find target/x86_64-unknown-linux-musl -type f -name 'git-lab' | xargs strip
- find target/x86_64-unknown-linux-musl -type f -name 'git-lab' | xargs -i cp -p {} ${BUILD_DIR}
- find target/x86_64-unknown-linux-musl -type f -name 'git-lab.1' | xargs -i cp -p {} ${BUILD_DIR}/man
- cp LICENSE ${BUILD_DIR}
- cp INSTALL ${BUILD_DIR}
- cp README.md ${BUILD_DIR}
- tar zcvf ${TARBALL} ${BUILD_DIR}
- ./ci/release.sh
artifacts:
paths:
- git_lab_cli*.tar.gz
expire_in: 12 mos
rules:
- if: '$CI_COMMIT_TAG =~ /^(\d+\.)?(\d+\.)?(\*|\d+)$/'