Debian Codegraph @

.gitlab-ci.yml

raw symbols SCIP
1 stages:
2 - test
3 - publish
4 variables:
5 DEBIAN_FRONTEND: noninteractive
6 CARGO_HOME: $CI_PROJECT_DIR/.cargo
7 PATH: "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/${CARGO_HOME}/bin"
8 USER: "root"
9
10 test:
11 stage: test
12 image: debian:sid
13 environment:
14 cache:
15 key: build-cache
16 paths:
17 - ".cargo/"
18 - target/
19
20 script:
21 # Debian/Ubuntu docker images contain some docker-specific configs that mess with rust-apt tests, so remove them here first.
22 # https://github.com/GoogleContainerTools/base-images-docker/blob/master/debian/reproducible/overlay/etc/apt/apt.conf.d/docker-gzip-indexes
23 - rm -f /etc/apt/apt.conf.d/docker*
24
25 # Install needed packages
26 - apt-get update
27 - apt-get install eatmydata -y
28 - eatmydata apt-get install -y
29 build-essential
30 curl
31 sudo
32 apt-utils
33 libapt-pkg-dev
34 clang-format
35 codespell
36
37 - curl https://sh.rustup.rs -sSf | sh -- /dev/stdin -y
38
39 - rustup toolchain install nightly
40 - rustup toolchain install stable
41
42 # Run tests
43 - cargo install just
44 - eatmydata just check
45 # Docker has 0777 for everything. Deb packages need to be 0755
46 - chmod 0755 -R tests/files/cache
47 # Create the test .debs then run the tests
48 - eatmydata just create-test-debs
49 - eatmydata cargo test --no-fail-fast -- --test-threads 1
50 publish:
51 stage: publish
52 only:
53 - main
54 except:
55 - tags
56 image: debian:sid
57 environment:
58 cache:
59 key: build-cache
60 paths:
61 - ".cargo/"
62 - target/
63 script:
64 # Install rustup and other needed dependencies
65 - apt-get update
66 - apt-get install -y
67 build-essential
68 curl
69 git
70 jq
71 libapt-pkg-dev
72 - curl https://sh.rustup.rs -sSf | sh -- /dev/stdin -y
73 - rustup default stable
74
75 # Create the Git tag and publish.
76 - |
77 git fetch --tags
78 current_version="$(cargo metadata --no-deps --format-version=1 | jq -r '.packages[0].version')"
79
80 if ! git tag | grep "^v${current_version}$"; then
81 project_url="$(echo "${CI_PROJECT_URL}" | sed "s|https://|https://oauth2:${WRITE_REPOSITORY}@|")"
82 git tag "v${current_version}"
83 git push -o ci.skip "${project_url}" "v${current_version}"
84
85 # And now publish to crates.io
86 CARGO_REGISTRY_TOKEN="${CARGO_KEY}" cargo publish
87 else
88 echo "DEBUG: Git tag 'v${current_version}' already exists."
89 fi