-
Notifications
You must be signed in to change notification settings - Fork 1
/
.gitlab-ci.yml
150 lines (139 loc) · 5.89 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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
variables:
COVERAGE_FAIL_BELOW: 75
# TODO Bring up to 80%
stages:
- check-format
- test
- export
default:
image: python:3.8-slim
tags: ["shared"]
check-format:
stage: check-format
script:
- apt update -y && apt install -y git
- pip install pre-commit
- pre-commit install
- pre-commit run --all-files --show-diff-on-failure
#
# Test that not enabling rewriting works OK:
# stable-18 and unstable-20: enable rewriting
# unstable-18 and stable-20: do not enable rewriting
test-stable-18:
stage: test
image: ubuntu:18.04
script:
- apt-get update -y
- apt-get install -y wget gnupg2
- wget -O - https://download.grammatech.com/gtirb/files/apt-repo/conf/apt.gpg.key | apt-key add -
- echo "deb https://download.grammatech.com/gtirb/files/apt-repo bionic stable" >> /etc/apt/sources.list
- apt-get update -y
- apt-get install -y software-properties-common
- add-apt-repository -y ppa:mhier/libboost-latest
- echo 'tzdata tzdata/Areas select Europe' | debconf-set-selections
- echo 'tzdata tzdata/Zones/Europe select Paris' | debconf-set-selections
- DEBIAN_FRONTEND="noninteractive" apt-get install -y libboost1.67
- apt-get install -y python3.6 python3-pip
- apt-get install -y libgtirb-1.10.6
- apt-get install -y libgtirb-pprinter-1.8.2
- apt-get install -y gtirb-pprinter-1.8.2
- cd gtirb_lsp_server
- pip3 install pygls==0.11.3
- pip3 install -r requirements-dev.txt
- pip3 install gtirb==1.10.7
- pip3 install -e .
- pytest --cov=gtirb_lsp_server --cov-fail-under=$COVERAGE_FAIL_BELOW
# Does not test rewriting packages due to inability to install mcasm.
# TODO Get updated install info for this package
#test-unstable-18:
# stage: test
# image: $CI_REGISTRY/rewriting/ddisasm/ubuntu18
# script:
# - wget -O - https://download.grammatech.com/gtirb/files/apt-repo/conf/apt.gpg.key | apt-key add -
# - echo "deb $INTERNAL_APT_REPO bionic unstable" >> /etc/apt/sources.list
# - apt-get update -y
# - apt-get install -y gtirb-pprinter ddisasm
# - pip3 install --upgrade pip
# - cd gtirb_lsp_server
# - pip3 install -r requirements-dev.txt
# - pip3 install -e . --pre --extra-index-url "$EXTRA_INDEX_URL"
# - pytest --cov=gtirb_lsp_server --cov-fail-under=$COVERAGE_FAIL_BELOW
test-stable-20:
stage: test
image: ubuntu:20.04
script:
- apt-get update -y
- apt-get install -y wget gnupg2
- wget -O - https://download.grammatech.com/gtirb/files/apt-repo/conf/apt.gpg.key | apt-key add -
- echo "deb https://download.grammatech.com/gtirb/files/apt-repo focal stable" >> /etc/apt/sources.list
- apt-get update -y
- echo 'tzdata tzdata/Areas select Europe' | debconf-set-selections
- echo 'tzdata tzdata/Zones/Europe select Paris' | debconf-set-selections
- DEBIAN_FRONTEND="noninteractive" apt-get install -y libboost1.67
- apt-get install -y python3.8 pip
- apt-get install -y libgtirb-1.10.8
- apt-get install -y libgtirb-pprinter-1.8.4
- apt-get install -y gtirb-pprinter-1.8.4
- cd gtirb_lsp_server
- python3.8 -m pip install pygls==0.12.2
- python3.8 -m pip install -r requirements-dev.txt
- python3.8 -m pip install gtirb==1.10.8
- python3.8 -m pip install -e .
- pytest --cov=gtirb_lsp_server --cov-fail-under=$COVERAGE_FAIL_BELOW
#test-unstable-20:
# stage: test
# image: $CI_REGISTRY/rewriting/ddisasm/ubuntu20
# script:
# - wget -O - https://download.grammatech.com/gtirb/files/apt-repo/conf/apt.gpg.key | apt-key add -
# - echo "deb $INTERNAL_APT_REPO focal unstable" >> /etc/apt/sources.list
# - apt-get update -y
# - apt-get install -y gtirb-pprinter ddisasm
# - cd gtirb_lsp_server
# - pip3 install -r requirements-dev.txt
# - pip3 install -e .[rewriting] --pre --extra-index-url "$EXTRA_INDEX_URL"
# - pytest --cov=gtirb_lsp_server --cov-fail-under=$COVERAGE_FAIL_BELOW
export_lsp:
stage: export
script:
- pushd gtirb_lsp_server
- pip install -r requirements-dev.txt
- python3 setup.py bdist_wheel --dist-dir=$CI_PROJECT_DIR/dist
- VERSION=$(python3 -c "from imp import load_source; pkginfo = load_source('pkginfo.version', 'gtirb_lsp_server/version.py'); print(pkginfo.__version__)")
- PKGNAME=$(python3 -c "from imp import load_source; pkginfo = load_source('pkginfo.version', 'gtirb_lsp_server/version.py'); print(pkginfo.__packagename__)")
- popd
- if [[ "$VERSION" =~ \.dev[[:digit:]]*.*$ && "$CI_COMMIT_REF_NAME" =~ ^release-.* ]]; then exit 1; fi
# this job is not using $CI_JOB_TOKEN because it only has read access
# https://gitlab.com/gitlab-org/gitlab/-/issues/35067
# this job is also not using $CI_DEPLOY_USER and $CI_DEPLOY_PASSWORD because it only has write access
- if [[ "$CI_COMMIT_BRANCH" == "main" ]]; then
ls $CI_PROJECT_DIR/dist/*.whl | xargs $CI_PROJECT_DIR/delete_remote_packages.py $GL_PKG_API_TOKEN;
fi
- sed "s/password = <access token>/password = $GL_PKG_API_TOKEN/" $CI_PROJECT_DIR/.pypirc > ~/.pypirc
- python3 -m twine upload --verbose --repository repypi $CI_PROJECT_DIR/dist/*.whl
rules:
- if: '$CI_COMMIT_BRANCH == "main"'
- if: '$CI_COMMIT_REF_NAME =~ /^release-.*/'
build_vsix:
stage: test
image: node:latest
script:
- npm install
- npm install -g vsce
- vsce package
artifacts:
expire_in: 2 hrs
paths:
- gtirb-vscode-*.*.*.vsix
export_vsix:
stage: export
image: python:3.7-slim
script:
- apt-get update -y
- apt-get install -y curl
- PACKAGENAME='gtirb-vscode'
- VERSION=$(python3 -c "import json; f = open('package.json', 'r'); extinfo = json.load(f); f.close(); print(extinfo['version'])")
- curl --header "JOB-TOKEN:$CI_JOB_TOKEN" --upload-file ${PACKAGENAME}-${VERSION}.vsix ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/${PACKAGENAME}/${VERSION}/${PACKAGENAME}-${VERSION}.vsix
dependencies:
- build_vsix
rules:
- if: '$CI_COMMIT_BRANCH == "main"'