yubioath-flutter/.github/workflows/linux.yml

128 lines
4.4 KiB
YAML
Raw Normal View History

2021-11-19 11:22:27 +03:00
name: Linux
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
container:
2023-06-21 10:13:34 +03:00
image: ubuntu:20.04
env:
DEBIAN_FRONTEND: noninteractive
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: .github/workflows/env
- name: Read variables from repo
run: cat .github/workflows/env >> $GITHUB_ENV
- name: Install dependencies
run: |
2023-04-17 10:58:37 +03:00
export PYVER_MINOR=${PYVER%.*}
echo "PYVER_MINOR: $PYVER_MINOR"
apt-get update
2023-06-21 10:34:54 +03:00
apt-get install -qq curl software-properties-common libnotify-dev libayatana-appindicator3-dev patchelf
add-apt-repository -y ppa:git-core/ppa
add-apt-repository -y ppa:deadsnakes/ppa
2023-04-17 10:58:37 +03:00
apt-get install -qq git python$PYVER_MINOR-dev python$PYVER_MINOR-venv
git config --global --add safe.directory "$GITHUB_WORKSPACE"
2023-04-17 10:58:37 +03:00
ln -s `which python$PYVER_MINOR` /usr/local/bin/python
2023-12-05 12:07:03 +03:00
ln -s `which python$PYVER_MINOR` /usr/local/bin/python3
2023-04-17 10:58:37 +03:00
PYVER_TEMP=`/usr/local/bin/python --version`
export PYVERINST=${PYVER_TEMP#* }
echo "PYVERINST=$PYVERINST" >> $GITHUB_ENV
echo "Installed python version: $PYVERINST"
2023-11-29 12:41:45 +03:00
python -m ensurepip --user
python -m pip install -U pip pipx
2023-04-17 10:58:37 +03:00
- name: Verify Python version
if: ${{ env.PYVERINST != env.PYVER }}
run: |
echo "Python version not compatible"
echo "Installed python version: $PYVERINST"
echo "Expected: $PYVER"
exit 1
- uses: actions/checkout@v4
2021-11-19 11:22:27 +03:00
2022-11-24 18:33:37 +03:00
- name: Check app versions
run: |
python set-version.py
git diff --exit-code
- name: Cache helper
id: cache-helper
2024-02-05 17:09:30 +03:00
uses: actions/cache@v4
2021-11-19 11:22:27 +03:00
with:
path: |
build/linux/helper
assets/licenses/helper.json
key: ${{ runner.os }}-py${{ env.PYVER }}-${{ hashFiles('helper/**') }}
2023-11-29 12:41:45 +03:00
- name: Build the Helper
if: steps.cache-helper.outputs.cache-hit != 'true'
run: |
apt-get install -qq swig libpcsclite-dev build-essential cmake
2023-11-29 12:41:45 +03:00
export PATH=$PATH:$HOME/.local/bin # Needed to ensure pipx/poetry on PATH
2023-02-01 12:30:12 +03:00
pipx install poetry
./build-helper.sh
- name: Install Flutter dependencies
2021-11-19 11:22:27 +03:00
run: |
apt-get install -qq clang cmake ninja-build pkg-config libgtk-3-dev jq
2021-11-19 11:22:27 +03:00
- uses: subosito/flutter-action@v2
2021-11-19 11:22:27 +03:00
with:
2022-05-12 09:36:47 +03:00
channel: 'stable'
flutter-version: ${{ env.FLUTTER }}
- name: Configure Flutter
run: |
2024-04-03 13:09:58 +03:00
git config --global --add safe.directory $FLUTTER_ROOT
flutter config --enable-linux-desktop
flutter --version
2021-11-19 11:22:27 +03:00
2023-11-29 12:41:45 +03:00
- name: Run lints/tests
2023-11-30 19:48:04 +03:00
env:
SKIP: ${{ steps.cache-helper.outputs.cache-hit == 'true' && 'mypy,flake8,black,bandit' || ''}}
2023-11-29 12:41:45 +03:00
run: |
export PATH=$PATH:$HOME/.local/bin # Needed to ensure pip/pre-commit on PATH
pipx install pre-commit
pre-commit run --all-files
flutter test
2023-11-30 13:25:20 +03:00
- name: Build the app
run: flutter build linux
- name: Check generated files
run: git diff --exit-code
2023-02-24 16:24:13 +03:00
- name: Embedd appindicator
run: |
patchelf --set-rpath '$ORIGIN' build/linux/x64/release/bundle/lib/libtray_manager_plugin.so
cp -L /usr/lib/x86_64-linux-gnu/libayatana-appindicator3.so.1 build/linux/x64/release/bundle/lib/
patchelf --set-rpath '$ORIGIN' build/linux/x64/release/bundle/lib/libayatana-appindicator3.so.1
cp -L /usr/lib/x86_64-linux-gnu/libayatana-indicator3.so.7 build/linux/x64/release/bundle/lib/
patchelf --set-rpath '$ORIGIN' build/linux/x64/release/bundle/lib/libayatana-indicator3.so.7
cp -L /usr/lib/x86_64-linux-gnu/libdbusmenu-glib.so.4 build/linux/x64/release/bundle/lib/
patchelf --set-rpath '$ORIGIN' build/linux/x64/release/bundle/lib/libdbusmenu-glib.so.4
cp -L /usr/lib/x86_64-linux-gnu/libdbusmenu-gtk3.so.4 build/linux/x64/release/bundle/lib/
patchelf --set-rpath '$ORIGIN' build/linux/x64/release/bundle/lib/libdbusmenu-gtk3.so.4
2021-11-19 11:22:27 +03:00
- name: Rename and archive app
run: |
export REF=$(echo ${GITHUB_REF} | cut -d '/' -f 3)
export BASENAME="yubioath-desktop-${REF}-linux"
2021-11-19 11:22:27 +03:00
mkdir deploy
mv build/linux/x64/release/bundle "build/${BASENAME}"
tar -czf deploy/${BASENAME}.tar.gz -C build "${BASENAME}"
2021-11-19 11:22:27 +03:00
- name: Upload artifact
uses: actions/upload-artifact@v4
2021-11-19 11:22:27 +03:00
with:
name: yubioath-desktop-linux
path: deploy