-
Notifications
You must be signed in to change notification settings - Fork 0
61 lines (58 loc) · 1.73 KB
/
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
name: t2r-bot
on:
push:
branches:
- main
pull_request:
branches:
- main
env:
IMAGE_NAME: robotomize/t2r-bot
DOCKER_USER: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
jobs:
lint:
name: Lint code (Python ${{ matrix.python-version }})
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ 3.9 ]
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/[email protected]
with:
python-version: ${{ matrix.python-version }}
- name: Install poetry
run: pip install poetry
- uses: actions/[email protected]
id: cache-dev-deps
with:
path: .venv
key: venv-dev-${{ runner.os }}-py-${{ matrix.python-version }}-poetry-${{ hashFiles('poetry.lock') }}
restore-keys: |
venv-dev-${{ runner.os }}-py-${{ matrix.python-version }}-poetry-
venv-dev-${{ runner.os }}-py-${{ matrix.python-version }}-
venv-dev-${{ runner.os }}-py-
venv-dev-${{ runner.os }}-
- name: Install dependencies
if: steps.cache-dev-deps.outputs.cache-hit != 'true'
run: |
poetry config virtualenvs.in-project true
poetry install
- name: Run linters
run: |
poetry run ./scripts/lint
build:
name: Build Container
runs-on: ubuntu-20.04
needs:
- lint
steps:
- uses: actions/checkout@v1
- name: Build image and publish to registry
run: |
docker build -t tor_to_relays .
docker login -u $DOCKER_USER --password $DOCKER_PASSWORD
docker tag tor_to_relays $IMAGE_NAME:latest
docker push $IMAGE_NAME:latest