forked from JonathanxD/openaws-vpn-client
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
112 lines (104 loc) · 3.24 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
# To contribute improvements to CI/CD templates, please follow the Development guide at:
# https://docs.gitlab.com/ee/development/cicd/templates.html
# This specific template is located at:
# https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/ci/templates/Gradle.gitlab-ci.yml
# This is the Gradle build system for JVM applications
# https://gradle.org/
# https://github.com/gradle/gradle
image: rust:1.57.0
stages:
- build
- deploy
- upload
# Disable the Gradle daemon for Continuous Integration servers as correctness
# is usually a priority over speed in CI environments. Using a fresh
# runtime for each build is more reliable since the runtime is completely
# isolated from any previous builds.
variables:
CACHE_FALLBACK_KEY: "master"
build:
stage: build
script:
- "apt update"
- "apt install -y libglib2.0-dev"
- "apt install -y libpango1.0-dev"
- "apt install -y libcairo2-dev"
- "apt install -y libatk1.0-dev"
- "apt install -y libgtk-3-dev"
- "curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain nightly"
- "cargo +nightly build --release"
cache:
key: "$CI_COMMIT_REF_NAME"
policy: pull-push
paths:
- target
artifacts:
paths:
- target/release/openaws-vpn-client
build-openvpn:
stage: build
script:
- "apt update"
- "apt install -y lz4"
- "apt install -y liblz4-dev"
- "apt install -y liblzo2-dev"
- "apt install -y libpam-dev"
- "cd scripts"
- "bash patch-openvpn.sh"
- "cd .."
- "tar -czvf share.tar.gz share"
cache:
key: "$CI_COMMIT_REF_NAME"
policy: pull-push
paths:
- share.tar.gz
artifacts:
paths:
- share.tar.gz
deploy:
stage: deploy
image: rust:1.57.0
before_script:
- "apt update"
- "apt install -y libglib2.0-dev"
- "apt install -y libpango1.0-dev"
- "apt install -y libcairo2-dev"
- "apt install -y libatk1.0-dev"
- "apt install -y libgtk-3-dev"
- 'rm -rf share.tar.gz'
- 'curl -fsSL https://github.com/stedolan/jq/releases/download/jq-1.6/jq-linux64 --output jq-linux64'
- 'chmod +x ./jq-linux64'
script:
- >
if [[ ! $(curl -s https://crates.io/api/v1/crates/openaws-vpn-client/versions | ./jq-linux64 -r ".versions[] | select(.num == \"${CI_COMMIT_TAG}\")") ]]; then
rm -rf ./jq-linux64
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain nightly
mkdir -p ~/.cargo
cargo +nightly publish --token $(echo $CRATES_TOKEN | base64 -d -w 0)
else
true
fi
cache:
key: "$CI_COMMIT_REF_NAME"
policy: pull
paths:
- target
only:
- tags
upload:
stage: upload
dependencies:
- build
- build-openvpn
script:
- "tar -xvf share.tar.gz"
- "cp target/release/openaws-vpn-client ."
- 'tar -czvf "openaws-vpn-client-${CI_COMMIT_TAG}.tar.gz" share openaws-vpn-client'
- 'curl --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file "openaws-vpn-client-${CI_COMMIT_TAG}.tar.gz" "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/openaws-vpn-client/${CI_COMMIT_TAG}/openaws-vpn-client-${CI_COMMIT_TAG}.tar.gz"'
cache:
key: "$CI_COMMIT_REF_NAME"
policy: pull
paths:
- target
only:
- tags