yubioath-flutter/.github/workflows/linux.yml
Emil Lundberg 371dbafb7a
Add directory prefix to linux tar.gz build
Archives are a bit nicer to work with if they unpack into a single
directory instead of putting all the contents separately in the
current working directory. A common convention is for an archive like
`archive-version-os.tar.gz` to unpack into a directory of the same
name: `archive-version-os/`.
2022-11-14 13:19:24 +01:00

97 lines
2.3 KiB
YAML

name: Linux
on: [push, pull_request]
jobs:
helper:
name: Build helper
runs-on: ubuntu-latest
container:
image: ubuntu:18.04
env:
DEBIAN_FRONTEND: noninteractive
steps:
- uses: actions/checkout@v3
- name: Install dependencies
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 python3.11-dev python3.11-venv
python3.11 -m ensurepip --user
python3.11 -m pip install -U pip
python3.11 -m pip install poetry
- name: Build the Helper
run: ./build-helper.sh
- name: Create archive
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: Download helper
uses: actions/download-artifact@v3
with:
name: helper
- name: Unpack helper
run: |
tar -xf helper.tar.gz
- name: Check app versions
run: |
python set-version.py
git diff --exit-code
- 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.7'
- 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