yubioath-flutter/.github/workflows/linux.yml
2022-11-28 15:59:35 +01:00

109 lines
2.7 KiB
YAML

name: Linux
on: [push, pull_request]
jobs:
helper:
name: Build helper
runs-on: ubuntu-latest
env:
PYVER: 3.11
container:
image: ubuntu:18.04
env:
DEBIAN_FRONTEND: noninteractive
steps:
- uses: actions/checkout@v3
- name: Cache helper
id: cache-helper
uses: actions/cache@v3
with:
path: helper.tar.gz
key: ${{ runner.os }}-py${{ env.PYVER }}-${{ hashFiles('helper/**') }}
- name: Install dependencies
if: steps.cache-helper.outputs.cache-hit != 'true'
run: |
apt-get update
apt-get install -qq swig libpcsclite-dev software-properties-common build-essential cmake git
add-apt-repository -y ppa:deadsnakes/ppa
apt-get install -qq python$PYVER-dev python$PYVER-venv
python$PYVER -m ensurepip --user
python$PYVER -m pip install -U pip
python$PYVER -m pip install poetry
- name: Build the Helper
if: steps.cache-helper.outputs.cache-hit != 'true'
run: ./build-helper.sh
- name: Create archive
if: steps.cache-helper.outputs.cache-hit != 'true'
run: tar -czf helper.tar.gz build/linux/helper assets/licenses/helper.json
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: helper
path: helper.tar.gz
build:
name: Build app
runs-on: ubuntu-latest
needs: helper
steps:
- uses: actions/checkout@v3
- name: Check app versions
run: |
python set-version.py
git diff --exit-code
- name: Download helper
uses: actions/download-artifact@v3
with:
name: helper
- name: Unpack helper
run: |
tar -xf helper.tar.gz
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -qq clang cmake ninja-build pkg-config libgtk-3-dev
- uses: subosito/flutter-action@v2
with:
channel: 'stable'
flutter-version: '3.3.9'
- run: flutter config --enable-linux-desktop
- run: 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