-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy path.gitlab-ci.yml
More file actions
126 lines (111 loc) · 3.71 KB
/
.gitlab-ci.yml
File metadata and controls
126 lines (111 loc) · 3.71 KB
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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
image: debian:bullseye
stages:
- build
- test
- deploy
variables:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
FF_USE_FASTZIP: "true"
ARTIFACT_COMPRESSION_LEVEL: "fast"
GIT_DEPTH: 1
CARGO_HOME: ${CI_PROJECT_DIR}/.cargo
PATH: "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:${CI_PROJECT_DIR}/.cargo/bin"
cache:
key: ${CI_COMMIT_REF_SLUG}
paths:
- src/storage_canister/wasm/storage_canister_canister.wasm.gz
- src/core_nft/wasm/core_nft_canister.wasm.gz
- src/core_nft/wasm/can.did
- src/storage_canister/wasm/can.did
default:
interruptible: true
retry:
max: 2
when:
- runner_system_failure
before_script:
- apt-get update
- apt-get install -y curl build-essential ca-certificates git wget
- curl https://sh.rustup.rs -sSf | sh -s -- -y
- export PATH="$HOME/.cargo/bin:$PATH"
- rustup default stable
- rustup target add wasm32-unknown-unknown
- cargo install candid-extractor
build:
stage: build
script:
- cargo install ic-wasm
- export PATH="$PATH:$HOME/.cargo/bin"
- wget https://github.com/dfinity/pocketic/releases/download/8.0.0/pocket-ic-x86_64-linux.gz
- gunzip pocket-ic-x86_64-linux.gz
- chmod +x pocket-ic-x86_64-linux
- cp pocket-ic-x86_64-linux ./src/pocket-ic
- bash ./scripts/build.sh
artifacts:
paths:
- src/storage_canister/wasm/storage_canister_canister.wasm.gz
- src/core_nft/wasm/core_nft_canister.wasm.gz
- src/core_nft/wasm/can.did
- src/storage_canister/wasm/can.did
- src/pocket-ic
expire_in: 1 week
resource_group: build
test:
stage: test
variables:
POCKET_IC_BIN: ./src/pocket-ic
needs: ["build"]
resource_group: test
script:
- apt-get update
- apt-get install -y pkg-config libssl-dev libunwind8
- bash ./scripts/run_integrations_tests.sh
timeout: 30m
deploy:
stage: deploy
needs: ["build"]
image: debian:bullseye
script:
- apt-get update
- apt-get install -y curl jq
- |
RELEASE_TAG="v$(date +'%Y.%m.%d')-$(echo $CI_COMMIT_SHA | cut -c1-7)"
RELEASE_NAME="Release $RELEASE_TAG"
RELEASE_RESPONSE=$(curl -s -X POST \
-H "Authorization: token $GITHUB_TOKEN" \
-H "Accept: application/vnd.github.v3+json" \
"https://api.github.com/repos/$GITHUB_REPO/releases" \
-d "{
\"tag_name\": \"$RELEASE_TAG\",
\"name\": \"$RELEASE_NAME\",
\"body\": \"Release automatique depuis GitLab CI\",
\"draft\": false,
\"prerelease\": false
}")
UPLOAD_URL=$(echo $RELEASE_RESPONSE | jq -r '.upload_url' | sed 's/{?name,label}//')
curl -s -X POST \
-H "Authorization: token $GITHUB_TOKEN" \
-H "Content-Type: application/octet-stream" \
--data-binary @"src/storage_canister/wasm/storage_canister_canister.wasm.gz" \
"$UPLOAD_URL?name=storage_canister_canister.wasm.gz"
curl -s -X POST \
-H "Authorization: token $GITHUB_TOKEN" \
-H "Content-Type: application/octet-stream" \
--data-binary @"src/core_nft/wasm/core_nft_canister.wasm.gz" \
"$UPLOAD_URL?name=core_nft_canister.wasm.gz"
curl -s -X POST \
-H "Authorization: token $GITHUB_TOKEN" \
-H "Content-Type: application/octet-stream" \
--data-binary @"./src/core_nft/wasm/can.did" \
"$UPLOAD_URL?name=core_nft_canister.did"
curl -s -X POST \
-H "Authorization: token $GITHUB_TOKEN" \
-H "Content-Type: application/octet-stream" \
--data-binary @"./src/storage_canister/wasm/can.did" \
"$UPLOAD_URL?name=storage_canister.did"
only:
- master
variables:
GITHUB_TOKEN: ${GITHUB_TOKEN}
GITHUB_REPO: ${GITHUB_REPO}