This repository has been archived by the owner on May 20, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
.gitlab-ci.yml
87 lines (78 loc) · 2.48 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
stages:
- lint
- test
- publish
apache_licenses_check:
stage: lint
image: registry.gitlab.com/ai-r/apache-license-checker:latest
script:
- apache-license-checker
shellcheck:
image: koalaman/shellcheck-alpine:stable
stage: lint
before_script:
- shellcheck --version
script:
- shellcheck ./scripts/*.sh
shfmt:
image: mvdan/shfmt:v3.1.0-alpine
stage: lint
before_script:
- shfmt -version
script:
- shfmt -i 2 -ci -d ./scripts
test_protoc_compilation:
image: ubuntu:bionic
stage: test
parallel:
matrix:
- PROTOC_VERSION: [3.15.8, 3.16.0, 3.17.3, 3.18.1, 3.19.0]
before_script:
- apt-get update -y && apt-get install -y unzip curl
- curl -LO --silent https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOC_VERSION}/protoc-${PROTOC_VERSION}-linux-x86_64.zip
- unzip protoc-${PROTOC_VERSION}-linux-x86_64.zip -d /usr/local
- chmod +x /usr/local/bin/protoc
script:
- ./scripts/test.sh
.base_gh_ssh_agent:
before_script:
## _Inspired by https://docs.gitlab.com/ee/ci/ssh_keys/_
##
## Install ssh-agent if not already installed.
- "command -v ssh-agent >/dev/null || ( apt-get update -y && apt-get install openssh-client -y )"
## Run ssh-agent
- eval $(ssh-agent -s)
## Add the private key file to ssh-agent
- echo "$GH_REPO_SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add -
## Create the SSH directory and give it the right permissions
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
## Using the set $SSH_KNOWN_HOSTS to be able to verify remote servers public keys
- echo "$SSH_KNOWN_HOSTS" >> ~/.ssh/known_hosts
- chmod 644 ~/.ssh/known_hosts
publish_package_dry_run:
extends: .base_gh_ssh_agent
stage: publish
script: ./scripts/publish_to_gh_pages.sh -v --dry-run
publish_package_latest:
extends: .base_gh_ssh_agent
stage: publish
script: ./scripts/publish_to_gh_pages.sh -v
only:
- develop
publish_package_tags:
extends: .base_gh_ssh_agent
stage: publish
script: ./scripts/publish_to_gh_pages.sh -v --version $CI_COMMIT_TAG
only:
- /^v[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+(?:-[[:alnum:]]+)?$/
publish_branch_to_github:
extends: .base_gh_ssh_agent
stage: publish
script:
- git checkout ${CI_COMMIT_BRANCH} # Checkout the branch not the sha1
- git remote add downstream [email protected]:cogment/cogment-api.git
- git fetch downstream ${CI_COMMIT_BRANCH}
- git push --tags downstream ${CI_COMMIT_BRANCH}:${CI_COMMIT_BRANCH}
only:
- main