@@ -3,41 +3,62 @@ name: Linux
3
3
on : [push, pull_request]
4
4
5
5
jobs :
6
- build :
6
+ run-checks :
7
+ runs-on : ubuntu-latest
8
+
9
+ steps :
10
+ - uses : actions/checkout@v4
11
+
12
+ - name : Read variables from repo
13
+ run : cat .github/workflows/env >> $GITHUB_ENV
14
+
15
+ - name : Set up Python
16
+ uses : actions/setup-python@v5
17
+ with :
18
+ python-version : ${{ env.PYVER }}
19
+
20
+ - name : Install Flutter dependencies
21
+ run : |
22
+ sudo apt-get update
23
+ sudo apt-get install -qq swig libpcsclite-dev build-essential
24
+ sudo apt-get install -qq clang cmake ninja-build pkg-config libgtk-3-dev jq
25
+
26
+ - uses : subosito/flutter-action@v2
27
+ with :
28
+ channel : ' stable'
29
+ flutter-version : ${{ env.FLUTTER }}
30
+
31
+ - name : Check app versions
32
+ run : |
33
+ python3 set-version.py
34
+ git diff --exit-code
35
+
36
+ - name : Run lints/tests
37
+ run : |
38
+ export PATH=$PATH:$HOME/.local/bin
39
+ python3 -m pip install --upgrade pip
40
+ pip install poetry pre-commit
41
+ (cd helper && poetry install)
42
+ pre-commit run --all-files
43
+ flutter test
7
44
45
+ build-helper :
8
46
runs-on : ubuntu-latest
9
47
container :
10
- image : ubuntu:20.04
48
+ image : python:3.12.2-slim-bullseye # This need to be manually updates in sync with env
11
49
env :
12
50
DEBIAN_FRONTEND : noninteractive
13
51
14
52
steps :
53
+
15
54
- uses : actions/checkout@v4
16
- with :
17
- sparse-checkout : .github/workflows/env
18
55
19
56
- name : Read variables from repo
20
- run : cat .github/workflows/env >> $GITHUB_ENV
21
-
22
- - name : Install dependencies
23
57
run : |
24
- echo "PYVER=3.12.1" >> $GITHUB_ENV # Remove once 3.12.2 is available from PPA
25
- export PYVER_MINOR=${PYVER%.*}
26
- echo "PYVER_MINOR: $PYVER_MINOR"
27
- apt-get update
28
- apt-get install -qq curl software-properties-common libnotify-dev libayatana-appindicator3-dev patchelf
29
- add-apt-repository -y ppa:git-core/ppa
30
- add-apt-repository -y ppa:deadsnakes/ppa
31
- apt-get install -qq git python$PYVER_MINOR-dev python$PYVER_MINOR-venv
32
- git config --global --add safe.directory "$GITHUB_WORKSPACE"
33
- ln -s `which python$PYVER_MINOR` /usr/local/bin/python
34
- ln -s `which python$PYVER_MINOR` /usr/local/bin/python3
35
- PYVER_TEMP=`/usr/local/bin/python --version`
58
+ cat .github/workflows/env >> $GITHUB_ENV
59
+ PYVER_TEMP=`python --version`
36
60
export PYVERINST=${PYVER_TEMP#* }
37
61
echo "PYVERINST=$PYVERINST" >> $GITHUB_ENV
38
- echo "Installed python version: $PYVERINST"
39
- python -m ensurepip --user
40
- python -m pip install -U pip pipx
41
62
42
63
- name : Verify Python version
43
64
if : ${{ env.PYVERINST != env.PYVER }}
@@ -47,12 +68,63 @@ jobs:
47
68
echo "Expected: $PYVER"
48
69
exit 1
49
70
50
- - uses : actions/checkout@v4
71
+ - name : Calculate cache key
72
+ run : echo "CACHE_KEY=$CACHE_KEY" >> $GITHUB_ENV
73
+ env :
74
+ CACHE_KEY : ${{ runner.os }}-py${{ env.PYVER }}-${{ hashFiles('helper/**') }}
51
75
52
- - name : Check app versions
76
+ - name : Cache helper
77
+ id : cache-helper
78
+ uses : actions/cache@v4
79
+ with :
80
+ path : |
81
+ build/linux/helper
82
+ assets/licenses/helper.json
83
+ key : ${{ env.CACHE_KEY }}
84
+
85
+ - name : Build the Helper
86
+ if : steps.cache-helper.outputs.cache-hit != 'true'
87
+ working-directory : ./helper
53
88
run : |
54
- python set-version.py
55
- git diff --exit-code
89
+ apt-get update
90
+ apt-get install -qq swig libpcsclite-dev build-essential
91
+ pip install poetry
92
+ poetry install
93
+ poetry run pyinstaller authenticator-helper.spec
94
+ find dist/helper -type f -exec chmod a-x {} +
95
+ chmod a+x dist/helper/authenticator-helper
96
+ mkdir -p ../build/linux
97
+ mv dist/helper ../build/linux/
98
+ poetry build
99
+ python -m venv .venv
100
+ .venv/bin/pip install --upgrade pip wheel
101
+ .venv/bin/pip install dist/authenticator_helper-0.1.0-py3-none-any.whl pip-licenses
102
+ mkdir licenses
103
+ .venv/bin/pip-licenses --format=json --no-license-path --with-license-file --ignore-packages authenticator-helper zxing-cpp --output-file ../assets/licenses/helper.json
104
+
105
+ build-app :
106
+
107
+ needs : build-helper
108
+ runs-on : ubuntu-latest
109
+ container :
110
+ image : ubuntu:20.04
111
+ env :
112
+ DEBIAN_FRONTEND : noninteractive
113
+
114
+ steps :
115
+
116
+ - name : Install git
117
+ run : |
118
+ apt-get update
119
+ apt-get install -qq curl software-properties-common
120
+ add-apt-repository -y ppa:git-core/ppa
121
+ apt-get install -qq git
122
+ git config --global --add safe.directory "$GITHUB_WORKSPACE"
123
+
124
+ - uses : actions/checkout@v4
125
+
126
+ - name : Read variables from repo
127
+ run : cat .github/workflows/env >> $GITHUB_ENV
56
128
57
129
- name : Cache helper
58
130
id : cache-helper
@@ -63,16 +135,14 @@ jobs:
63
135
assets/licenses/helper.json
64
136
key : ${{ runner.os }}-py${{ env.PYVER }}-${{ hashFiles('helper/**') }}
65
137
66
- - name : Build the Helper
138
+ - name : Require the Helper
67
139
if : steps.cache-helper.outputs.cache-hit != 'true'
68
- run : |
69
- apt-get install -qq swig libpcsclite-dev build-essential cmake
70
- export PATH=$PATH:$HOME/.local/bin # Needed to ensure pipx/poetry on PATH
71
- pipx install poetry
72
- ./build-helper.sh
140
+ run : exit 1
73
141
74
142
- name : Install Flutter dependencies
75
143
run : |
144
+ apt-get update
145
+ apt-get install -qq libnotify-dev libayatana-appindicator3-dev patchelf
76
146
apt-get install -qq clang cmake ninja-build pkg-config libgtk-3-dev jq
77
147
78
148
- uses : subosito/flutter-action@v2
@@ -86,15 +156,6 @@ jobs:
86
156
flutter config --enable-linux-desktop
87
157
flutter --version
88
158
89
- - name : Run lints/tests
90
- env :
91
- SKIP : ${{ steps.cache-helper.outputs.cache-hit == 'true' && 'mypy,flake8,black,bandit' || ''}}
92
- run : |
93
- export PATH=$PATH:$HOME/.local/bin # Needed to ensure pip/pre-commit on PATH
94
- pipx install pre-commit
95
- pre-commit run --all-files
96
- flutter test
97
-
98
159
- name : Build the app
99
160
run : flutter build linux
100
161
0 commit comments