-
-
Notifications
You must be signed in to change notification settings - Fork 187
162 lines (155 loc) · 5.15 KB
/
build.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
151
152
153
154
155
156
157
158
159
160
161
162
name: Build
on:
pull_request:
push:
branches:
- master
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: 3.8
- name: set PY
run: echo "::set-env name=PY::$(python --version --version | sha256sum | cut -d' ' -f1)"
- uses: actions/cache@v1
with:
path: ~/.cache/pre-commit
key: pre-commit|${{ env.PY }}|${{ hashFiles('.pre-commit-config.yaml') }}
- name: Lint with Pre-commit
uses: pre-commit/action@v1.0.0
- name: Lint with Flake8
run: |
# flake8 pre-commit hook is causing errors
# try again once new version of pyflakes is released (> 2.1.1)
pip install git+https://github.com/PyCQA/pyflakes.git@1911c203a13826d2eb03d582d60874b91e36f4fc --upgrade
pip install flake8==3.7.9
flake8 gaphor
linux:
needs: lint
runs-on: ubuntu-latest
strategy:
matrix:
py_ver: [3.7, 3.8]
steps:
- uses: actions/checkout@v1
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.py_ver }}
- name: Use Python Dependency Cache
uses: actions/cache@v1.0.3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-poetry-${{ hashFiles('**/poetry.lock') }}
restore-keys: ${{ runner.os }}-poetry-
- name: Install Ubuntu dependencies
run: >
sudo apt-get update -q && sudo apt-get install
--no-install-recommends -y xvfb python3-dev python3-gi
python3-gi-cairo gir1.2-gtk-3.0 libgirepository1.0-dev libcairo2-dev
- name: Install Poetry
uses: dschep/install-poetry-action@v1.3
with:
version: 1.0.3
- name: Install Python Dependencies
run: poetry install
- name: Test with Pytest
run: xvfb-run pytest --cov=gaphor/
- name: Code Climate Coverage Action
uses: paambaati/codeclimate-action@v2.3.0
env:
CC_TEST_REPORTER_ID: 05f6288b94a87daa172d3e96a33ec331a4374be7d01eb9a42b3b21c4c550a8ff
with:
coverageCommand: coverage xml
- name: Build
run: |
make translate
poetry build
- name: Publish to PyPI
if: github.event_name == "release"
run: |
poetry publish -u __token__ -p ${{ secrets.PYPI_TOKEN }}
windows:
needs: lint
runs-on: windows-latest
env:
MSYSTEM: MINGW64
MSYS2_ARCH: x86_64
steps:
- uses: actions/checkout@v1
- name: Install MSYS2
run: |
choco install --no-progress msys2 --params="/NoUpdate /NoPath"
- name: Update MSYS2
run: |
$env:PATH = "C:\tools\msys64\usr\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem"
C:\tools\msys64\usr\bin\pacman --noconfirm -Syyuu
C:\tools\msys64\usr\bin\pacman --noconfirm -Syuu
- name: Use Python Dependency Cache
uses: actions/cache@v1.0.3
with:
path: ~\AppData\Local\pip\Cache
key: ${{ runner.os }}-poetry-${{ hashFiles('**/poetry.lock') }}
restore-keys: ${{ runner.os }}-poetry-
- name: Install Dependencies
run: |
$env:PATH = "C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem"
C:\tools\msys64\usr\bin\bash -lc "win-installer/msys2-install.sh"
env:
CHERE_INVOKING: yes
- name: Run Tests
run: |
$env:PATH = "C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem"
C:\tools\msys64\usr\bin\bash -lc "win-installer/msys2-test.sh"
env:
CHERE_INVOKING: yes
PY_IGNORE_IMPORTMISMATCH: yes
macos:
needs: lint
runs-on: macOS-latest
env:
PKG_CONFIG_PATH: /usr/local/Cellar/libffi/3.2.1/lib/pkgconfig:${PKG_CONFIG_PATH:-}
steps:
- uses: actions/checkout@v1
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: 3.8
- name: Install macOS Dependencies
run: brew install gobject-introspection gtk+3 adwaita-icon-theme
- name: Install Poetry
uses: dschep/install-poetry-action@v1.3
with:
version: 1.0.3
- name: Use Python Dependency Cache
uses: actions/cache@v1.0.3
with:
path: ~/Library/Caches/pip
key: ${{ runner.os }}-poetry-${{ hashFiles('**/poetry.lock') }}
restore-keys: ${{ runner.os }}-poetry-
- name: Install Python Dependencies
run: |
poetry install
pip install pytest-xvfb
- name: Test with Pytest
run: pytest
- name: Create macOS Binary
run: |
poetry build
cd macos-dmg
./package.sh
- name: Upload Assets
uses: actions/upload-artifact@v1
with:
name: Gaphor.dmg
path: macos-dmg/*dmg
- name: Upload Assets to release
uses: AButler/upload-release-assets@v2.0
if: github.event_name == "release"
with:
files: 'macos-dmg/*dmg;dist/*'
repo-token: ${{ secrets.GITHUB_TOKEN }}