Skip to content

Commit c92f30f

Browse files
committed
ci: imporve circleci configs
1 parent c711fe3 commit c92f30f

File tree

4 files changed

+98
-121
lines changed

4 files changed

+98
-121
lines changed

.circleci/config.yml

Lines changed: 73 additions & 104 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,48 @@
1+
build: &build
2+
working_directory: /mnt/crate
3+
steps:
4+
- checkout
5+
- attach_workspace:
6+
at: "."
7+
- restore_cache:
8+
keys:
9+
- cargo-v1-{{ checksum "Cargo.toml" }}-{{ checksum "Cargo.lock" }}
10+
- run:
11+
name: Print version information
12+
command: rustc --version; cargo --version; python -V;
13+
- run:
14+
name: Build 35
15+
command: |
16+
pip install -r requirement-dev.txt && python compile.py build
17+
- run:
18+
name: Test 35
19+
command: |
20+
cp build/lib/py_sourcemap/*.so py_sourcemap/ && \
21+
nosetests
22+
- run:
23+
name: Prune the output files
24+
command: |
25+
for file in target/release/* target/release/.??*; do
26+
[ -d $file -o ! -x $file ] && rm -r $file
27+
done
28+
- persist_to_workspace:
29+
root: "."
30+
paths:
31+
- ./*
32+
33+
deploy: &deploy
34+
docker:
35+
- image: tsub/ghr:latest
36+
working_directory: /mnt/crate
37+
steps:
38+
- attach_workspace:
39+
at: "."
40+
- run:
41+
name: 'Deploy to Github Release'
42+
command: |
43+
export GIT_TAG="$(git describe --tags $(git rev-list --tags --max-count=1))"; \
44+
ghr -u "${CIRCLE_PROJECT_USERNAME}" -r "${CIRCLE_PROJECT_REPONAME}" "${GIT_TAG}" build/lib/py_sourcemap/*.so
45+
146
version: 2
247
jobs:
348
cargo_fetch:
@@ -25,128 +70,36 @@ jobs:
2570
- /usr/local/cargo/registry
2671
- /usr/local/cargo/git
2772
build35:
73+
<<: *build
2874
docker:
2975
- image: broooooklyn/rust-python:3.5
30-
working_directory: /mnt/crate
31-
steps:
32-
- checkout
33-
- attach_workspace:
34-
at: "."
35-
- restore_cache:
36-
keys:
37-
- cargo-v1-{{ checksum "Cargo.toml" }}-{{ checksum "Cargo.lock" }}
38-
- run:
39-
name: Print version information
40-
command: rustc --version; cargo --version
41-
- run:
42-
name: Build 35
43-
command: |
44-
python compile.py build
45-
- run:
46-
name: Prune the output files
47-
command: |
48-
for file in target/release/* target/release/.??*; do
49-
[ -d $file -o ! -x $file ] && rm -r $file
50-
done
51-
- persist_to_workspace:
52-
root: "."
53-
paths:
54-
- ./*
76+
5577
build36:
78+
<<: *build
5679
docker:
5780
- image: broooooklyn/rust-python:3.6
58-
working_directory: /mnt/crate
59-
steps:
60-
- checkout
61-
- attach_workspace:
62-
at: "."
63-
- restore_cache:
64-
keys:
65-
- cargo-v1-{{ checksum "Cargo.toml" }}-{{ checksum "Cargo.lock" }}
66-
- run:
67-
name: Print version information
68-
command: rustc --version; cargo --version
69-
- run:
70-
name: Build 36
71-
command: |
72-
python compile.py build
73-
- run:
74-
name: Prune the output files
75-
command: |
76-
for file in target/release/* target/release/.??*; do
77-
[ -d $file -o ! -x $file ] && rm -r $file
78-
done
79-
- persist_to_workspace:
80-
root: "."
81-
paths:
82-
- ./*
81+
8382
build37:
83+
<<: *build
8484
docker:
8585
- image: broooooklyn/rust-python:3.7
86-
working_directory: /mnt/crate
87-
steps:
88-
- checkout
89-
- attach_workspace:
90-
at: "."
91-
- restore_cache:
92-
keys:
93-
- cargo-v1-{{ checksum "Cargo.toml" }}-{{ checksum "Cargo.lock" }}
94-
- run:
95-
name: Print version information
96-
command: rustc --version; cargo --version
97-
- run:
98-
name: Build 37
99-
command: |
100-
python compile.py build
101-
- run:
102-
name: Prune the output files
103-
command: |
104-
for file in target/release/* target/release/.??*; do
105-
[ -d $file -o ! -x $file ] && rm -r $file
106-
done
107-
- persist_to_workspace:
108-
root: "."
109-
paths:
110-
- ./*
11186

112-
deploy35:
113-
docker:
114-
- image: tsub/ghr:latest
115-
working_directory: /mnt/crate
116-
steps:
117-
- attach_workspace:
118-
at: "."
119-
- run:
120-
name: 'Deploy to Github Release'
121-
command: |
122-
export GIT_TAG="$(git describe --tags $(git rev-list --tags --max-count=1))"; \
123-
ghr -u "${CIRCLE_PROJECT_USERNAME}" -r "${CIRCLE_PROJECT_REPONAME}" "${GIT_TAG}" build/lib/py_sourcemap/*.so
87+
deploy35: *deploy
12488

125-
deploy36:
126-
docker:
127-
- image: tsub/ghr:latest
128-
working_directory: /mnt/crate
129-
steps:
130-
- attach_workspace:
131-
at: "."
132-
- run:
133-
name: 'Deploy to Github Release'
134-
command: |
135-
export GIT_TAG="$(git describe --tags $(git rev-list --tags --max-count=1))"; \
136-
ghr -u "${CIRCLE_PROJECT_USERNAME}" -r "${CIRCLE_PROJECT_REPONAME}" "${GIT_TAG}" build/lib/py_sourcemap/*.so
89+
deploy36: *deploy
90+
91+
deploy37: *deploy
13792

138-
deploy37:
93+
pip_deploy:
13994
docker:
140-
- image: tsub/ghr:latest
95+
- image: broooooklyn/rust-python:latest
14196
working_directory: /mnt/crate
14297
steps:
14398
- attach_workspace:
14499
at: "."
145100
- run:
146101
name: 'Deploy to Github Release'
147-
command: |
148-
export GIT_TAG="$(git describe --tags $(git rev-list --tags --max-count=1))"; \
149-
ghr -u "${CIRCLE_PROJECT_USERNAME}" -r "${CIRCLE_PROJECT_REPONAME}" "${GIT_TAG}" build/lib/py_sourcemap/*.so
102+
command: pip install -r requirement-dev.txt && make release
150103

151104
nightly:
152105
machine: true
@@ -182,6 +135,8 @@ workflows:
182135
filters:
183136
tags:
184137
only: /.*/
138+
branches:
139+
only: master
185140
- build36:
186141
requires:
187142
- cargo_fetch
@@ -191,6 +146,8 @@ workflows:
191146
filters:
192147
tags:
193148
only: /.*/
149+
branches:
150+
only: master
194151
- build37:
195152
requires:
196153
- cargo_fetch
@@ -200,3 +157,15 @@ workflows:
200157
filters:
201158
tags:
202159
only: /.*/
160+
branches:
161+
only: master
162+
- pip_deploy:
163+
requires:
164+
- deploy35
165+
- deploy36
166+
- deploy37
167+
filters:
168+
tags:
169+
only: /.*/
170+
branches:
171+
only: master

.travis.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,26 @@ python:
44
- "3.6"
55
- "3.7"
66
os: osx
7+
osx_image: xcode9.3
78
cache: cargo
89
before_install:
910
- brew update
1011
- brew install rust
1112
- rustup default nightly
1213

14+
install:
15+
- pip install -r requirements-dev.txt
16+
1317
script: |
14-
python compile.py build
18+
python compile.py build && \
19+
cp build/lib/py_sourcemap/*.so py_sourcemap/ && \
20+
nosetests
1521
1622
deploy:
1723
provider: releases
1824
api_key:
1925
secure: $GITHUB_TOKEN
20-
file: build/lib/py_sourcemap/py_sourcemap.so
26+
file: build/lib/py_sourcemap/*.so
2127
skip_cleanup: true
2228
on:
2329
tags: true

Dockerfile

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,28 @@
1-
FROM ubuntu:16.04
2-
3-
ENV GHR_VERSION="0.9.0"
1+
FROM ubuntu:18.04
42

53
ARG PYTHON_VERSION=3.6
64

75
ENV RUSTUP_HOME=/usr/local/rustup \
86
CARGO_HOME=/usr/local/cargo \
97
PATH=/usr/local/cargo/bin:$PATH \
10-
RUST_VERSION=1.28.0
8+
RUST_VERSION=nightly
119

1210
RUN apt-get update && \
13-
apt-get install software-properties-common python-software-properties -y && \
11+
echo $PYTHON_VERSION && \
12+
apt-get install software-properties-common -y --no-install-recommends && \
1413
add-apt-repository ppa:deadsnakes/ppa -y && \
15-
apt-get update && \
16-
apt-get install python${PYTHON_VERSION} python3-pip wget git curl -y && \
14+
apt-get install python${PYTHON_VERSION} wget build-essential git curl -y --no-install-recommends && \
1715
apt-get upgrade -y && \
1816
apt-get autoremove -y && \
1917
ln -sf /usr/bin/python${PYTHON_VERSION} /usr/bin/python && \
20-
curl -fSL -o ghr.tar.gz "https://github.com/tcnksm/ghr/releases/download/v${GHR_VERSION}/ghr_v${GHR_VERSION}_linux_amd64.tar.gz" && \
21-
tar -xvzf ghr.tar.gz && \
22-
mv ghr_v0.9.0_linux_amd64/ghr /usr/local/bin && \
23-
chown root:root /usr/local/bin/ghr && \
24-
rm -r \
25-
ghr.tar.gz \
26-
ghr_v0.9.0_linux_amd64
18+
if [ $PYTHON_VERSION = '3.6' ]; \
19+
then \
20+
apt-get install python3-pip -y --no-install-recommends && \
21+
ln -sf /usr/bin/pip3 /usr/bin/pip; \
22+
else \
23+
curl https://bootstrap.pypa.io/get-pip.py | python${PYTHON_VERSION}; \
24+
fi && \
25+
pip install --upgrade pip
2726

2827
RUN set -eux; \
2928
dpkgArch="$(dpkg --print-architecture)"; \
@@ -44,4 +43,6 @@ RUN set -eux; \
4443
rustup default nightly && \
4544
rustup --version; \
4645
cargo --version; \
47-
rustc --version;
46+
rustc --version; \
47+
python -V; \
48+
pip -V;

requirement-dev.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
yapf==0.23.0
22
twine==1.11.0
33
bumpversion==0.5.3
4+
nose==1.3.7

0 commit comments

Comments
 (0)