Skip to content

Commit 9473610

Browse files
authored
Merge pull request #9 from codertimo/codertimo-circlci
Circle-ci & Pypi auto building system
2 parents 5c7b845 + 8f724dc commit 9473610

File tree

6 files changed

+107
-4
lines changed

6 files changed

+107
-4
lines changed

.circleci/config.yml

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
version: 2
2+
jobs:
3+
build:
4+
docker:
5+
- image: circleci/python:3.6.1
6+
7+
working_directory: ~/repo
8+
9+
steps:
10+
- checkout
11+
12+
- restore_cache:
13+
keys:
14+
- v1-dependencies-{{ checksum "requirements.txt" }}
15+
- v1-dependencies-
16+
17+
- run:
18+
name: install dependencies
19+
command: |
20+
python3 -m venv venv
21+
. venv/bin/activate
22+
pip install -r requirements.txt
23+
- save_cache:
24+
paths:
25+
- ./venv
26+
key: v1-dependencies-{{ checksum "requirements.txt" }}
27+
28+
- run:
29+
name: run tests
30+
command: |
31+
. venv/bin/activate
32+
python -m unittest test.py
33+
- store_artifacts:
34+
path: test-reports
35+
destination: test-reports
36+
37+
deploy:
38+
docker:
39+
- image: circleci/python:3.6.1
40+
41+
working_directory: ~/repo
42+
43+
steps:
44+
- checkout
45+
46+
- restore_cache:
47+
key: v1-dependency-cache-{{ checksum "setup.py" }}-{{ checksum "Makefile" }}
48+
49+
- run:
50+
name: verify git tag vs. version
51+
command: |
52+
python3 -m venv venv
53+
. venv/bin/activate
54+
python setup.py verify
55+
pip install twine
56+
- save_cache:
57+
key: v1-dependency-cache-{{ checksum "setup.py" }}-{{ checksum "Makefile" }}
58+
paths:
59+
- "venv"
60+
61+
# Deploying to PyPI
62+
# for pip install kor2vec
63+
- run:
64+
name: init .pypirc
65+
command: |
66+
echo -e "[pypi]" >> ~/.pypirc
67+
echo -e "username = codertimo" >> ~/.pypirc
68+
echo -e "password = $PYPI_PASSWORD" >> ~/.pypirc
69+
- run:
70+
name: create packages
71+
command: |
72+
make package
73+
- run:
74+
name: upload to pypi
75+
command: |
76+
. venv/bin/activate
77+
twine upload dist/*
78+
workflows:
79+
version: 2
80+
build_and_deploy:
81+
jobs:
82+
- build:
83+
filters:
84+
tags:
85+
only: /.*/
86+
- deploy:
87+
requires:
88+
- build
89+
filters:
90+
tags:
91+
only: /.*/
92+
branches:
93+
ignore: /.*/

Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
package:
2+
python setup.py sdist
3+
python setup.py bdist_wheel

bert_pytorch/model/bert.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import torch.nn as nn
22

3-
from model.transformer import TransformerBlock
4-
from model.embedding import BERTEmbedding
3+
from .transformer import TransformerBlock
4+
from .embedding import BERTEmbedding
55

66

77
class BERT(nn.Module):

bert_pytorch/model/language_model.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
from .bert import BERT
21
import torch.nn as nn
32

3+
from .bert import BERT
4+
45

56
class BERTLM(nn.Module):
67
"""

bert_pytorch/trainer/pretrain.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from torch.optim import Adam
44
from torch.utils.data import DataLoader
55

6-
from model import BERTLM, BERT
6+
from ..model import BERTLM, BERT
77

88
import tqdm
99

test.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import unittest
2+
from bert_pytorch import BERT
3+
4+
5+
class BERTTestCase(unittest.TestCase):
6+
pass

0 commit comments

Comments
 (0)