yubioath-flutter/.github/workflows/linux.yml
2023-02-06 17:02:57 +01:00

98 lines
2.6 KiB
YAML

name: Linux
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
env:
PYVER: 3.11
FLUTTER: '3.7.1'
container:
image: ubuntu:18.04
env:
DEBIAN_FRONTEND: noninteractive
steps:
- name: Install dependencies
run: |
apt-get update
apt-get install -qq software-properties-common
add-apt-repository -y ppa:git-core/ppa
add-apt-repository -y ppa:deadsnakes/ppa
apt-get install -qq git python$PYVER-dev python$PYVER-venv
git config --global --add safe.directory "$GITHUB_WORKSPACE"
ln -s `which python$PYVER` /usr/local/bin/python
- uses: actions/checkout@v3
- name: Check app versions
run: |
python set-version.py
git diff --exit-code
- name: Cache helper
id: cache-helper
uses: actions/cache@v3
with:
path: |
build/linux/helper
assets/licenses/helper.json
key: ${{ runner.os }}-py${{ env.PYVER }}-${{ hashFiles('helper/**') }}
- name: Install helper dependencies
if: steps.cache-helper.outputs.cache-hit != 'true'
run: |
apt-get install -qq swig libpcsclite-dev build-essential cmake
python -m ensurepip --user
python -m pip install -U pip pipx
pipx ensurepath
pipx install poetry
- name: Build the Helper
if: steps.cache-helper.outputs.cache-hit != 'true'
run: |
. ~/.bashrc # Needed to ensure poetry on PATH
./build-helper.sh
- name: Install Flutter dependencies
run: |
apt-get install -qq clang cmake ninja-build pkg-config libgtk-3-dev jq
- uses: subosito/flutter-action@v2
with:
channel: 'stable'
flutter-version: ${{ env.FLUTTER }}
- name: Configure Flutter
run: |
git config --global --add safe.directory /opt/hostedtoolcache/flutter/stable-$FLUTTER-x64
flutter config --enable-linux-desktop
flutter --version
- name: Run tests
run: |
flutter test
flutter analyze
- name: Build the app
run: flutter build linux
- name: Check generated files
run: git diff --exit-code
- name: Rename and archive app
run: |
export REF=$(echo ${GITHUB_REF} | cut -d '/' -f 3)
export BASENAME="yubioath-desktop-${REF}-linux"
mkdir deploy
mv build/linux/x64/release/bundle "build/${BASENAME}"
tar -czf deploy/${BASENAME}.tar.gz -C build "${BASENAME}"
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: yubioath-desktop-linux
path: deploy