-
-
Notifications
You must be signed in to change notification settings - Fork 89
130 lines (106 loc) · 4.47 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
name: "Build Kanmail"
on:
push:
tags:
branches:
- main
jobs:
build:
# Build platforms definition
strategy:
fail-fast: false
matrix:
include:
- name: Windows
runs-on: windows-2019
# pythonnet is not 3.9 compatible, so Windows is behind
python-version: "3.8.10"
- name: macOS
runs-on: macos-10.15
python-version: "3.9.12"
- name: Linux
runs-on: ubuntu-18.04
python-version: "3.9.12"
name: Build ${{ matrix.name }}
runs-on: ${{ matrix.runs-on }}
env:
MACOSX_DEPLOYMENT_TARGET: "10.9"
steps:
- name: "[Linux] Install apt packages"
if: ${{ matrix.name == 'Linux' }}
run: sudo apt update && sudo apt install libcairo2-dev libgirepository1.0-dev libgtk-3-dev libwebkit2gtk-4.0-37 gir1.2-webkit2-4.0 xvfb
- name: "[Windows] Install webview2-runtime"
if: ${{ matrix.name == 'Windows' }}
# TODO: don't use ignore-checksums, why is this broken upstream?
run: choco install --ignore-checksums webview2-runtime
- name: Checkout
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4
with:
fetch-depth: 0 # ensure we fetch tags
# JavaScript client build
- name: Install yarn
uses: actions/setup-node@aa759c6c94d3800c55b8601f21ba4b2371704cb7 # 2.3.0
with:
node-version: 16.1.0
- name: Install yarn packages
run: yarn install --frozen-lockfile
- name: Build JS bundle
run: yarn build
# Python app build
- name: "[Windows, Linux] Install Python"
if: ${{ matrix.name != 'macOS' }}
uses: actions/setup-python@dc73133d4da04e56a135ae2246682783cc7c7cb6 # v2.2.2
with:
python-version: ${{ matrix.python-version }}
# See: https://github.com/actions/virtual-environments/issues/1256#issuecomment-770270252
- name: "[MacOS] Install Python"
if: ${{ matrix.name == 'macOS' }}
run: |
curl https://www.python.org/ftp/python/${{ matrix.python-version }}/python-${{ matrix.python-version }}-macosx10.9.pkg -o "python.pkg"
sudo installer -pkg python.pkg -target /
echo "/Library/Frameworks/Python.framework/Versions/3.9/bin/" >> $GITHUB_PATH
# Bootstrap requirements, pip to install pipx, pipx to install poetry. The below install
# with poetry will then remove pipx, leaving an orphaned isolated poetry.
- name: Install Poetry via pipx
run: pip3 install pipx && pipx install "poetry<2"
- name: Install packages with Poetry
run: poetry install --no-root --remove-untracked
# Run the tests
- name: "[MacOS, Windows] Run Tests"
if: ${{ matrix.name != 'Linux' }}
run: poetry run honcho run pytest -sv
env:
GOOGLE_OAUTH_CLIENT_ID: ${{ secrets.GOOGLE_OAUTH_CLIENT_ID }}
GOOGLE_OAUTH_CLIENT_SECRET: ${{ secrets.GOOGLE_OAUTH_CLIENT_SECRET }}
SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
POSTHOG_API_KEY: ${{ secrets.POSTHOG_API_KEY }}
- name: "[Linux] Run Tests"
if: ${{ matrix.name == 'Linux' }}
run: xvfb-run poetry run honcho run pytest -sv
env:
GOOGLE_OAUTH_CLIENT_ID: ${{ secrets.GOOGLE_OAUTH_CLIENT_ID }}
GOOGLE_OAUTH_CLIENT_SECRET: ${{ secrets.GOOGLE_OAUTH_CLIENT_SECRET }}
SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
POSTHOG_API_KEY: ${{ secrets.POSTHOG_API_KEY }}
- name: Remove development dependencies
run: poetry install --no-root --no-dev --remove-untracked
- name: Make empty .pyupdater directory
run: mkdir .pyupdater
- name: Copy in fake config file
run: cp make/github-config.pyu .pyupdater/config.pyu
- name: Make build
run: poetry run python -m make
env:
GOOGLE_OAUTH_CLIENT_ID: ${{ secrets.GOOGLE_OAUTH_CLIENT_ID }}
GOOGLE_OAUTH_CLIENT_SECRET: ${{ secrets.GOOGLE_OAUTH_CLIENT_SECRET }}
SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
POSTHOG_API_KEY: ${{ secrets.POSTHOG_API_KEY }}
# Upload app to S3
- name: Install AWS CLI
run: pip3 install awscli
- name: Upload to S3
run: aws s3 sync --no-progress pyu-data/new/ s3://builds.kanmail.io/
env:
AWS_DEFAULT_REGION: eu-west-1
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_KEY_SECRET }}