-
Notifications
You must be signed in to change notification settings - Fork 5
103 lines (91 loc) · 2.21 KB
/
ci.yml
File metadata and controls
103 lines (91 loc) · 2.21 KB
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
name: CI
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
defaults:
run:
shell: bash
jobs:
test:
name: Unit Test
runs-on: ubuntu-latest
container:
image: 'ubuntu:20.04'
steps:
- uses: actions/checkout@v1
with:
submodules: recursive
- name: Install Deps
run: |
apt update
apt install --no-install-recommends -y \
make \
g++ \
git \
python3-dev \
python3-pip \
valgrind
python3 -m pip install -U \
alephzero \
pip \
wheel \
setuptools \
pytest \
pytest-asyncio \
requests \
websockets==9.1
- name: Build API
run: make bin/api -j DEBUG=1
- name: Run Test
run: python3 -m pytest test/
lint:
name: Lint
runs-on: ubuntu-latest
container:
image: 'ubuntu:20.04'
steps:
- uses: actions/checkout@v1
- name: install deps
run: |
apt update
apt install --no-install-recommends -y clang-format python3-pip
python3 -m pip install -U flake8 yapf
- name: flake8
run: python3 -m flake8
- name: yapf
run: python3 -m yapf -d -r .
- name: clang-format
run: |
find . -name '*.[ch]pp' | xargs \
clang-format --dry-run --Werror --style=file
docker:
name: Push Docker
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
with:
submodules: recursive
- name: Log into GHCR
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GHCR_TOKEN }}
- name: Build & Push Latest
if: github.ref == 'refs/heads/master'
uses: docker/build-push-action@v2
with:
context: .
push: true
file: ./Dockerfile
tags: ghcr.io/alephzero/api:latest
- name: Build & Push Tag
if: startsWith(github.ref, 'refs/tags')
uses: docker/build-push-action@v2
with:
context: .
push: true
file: ./Dockerfile
tags: ghcr.io/alephzero/api:${{ steps.tagname.outputs.tag }}