diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 8bd23978..0cd03277 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -34,6 +34,10 @@ jobs: export PYVERINST=${PYVER_TEMP#* } echo "PYVERINST=$PYVERINST" >> $GITHUB_ENV echo "Installed python version: $PYVERINST" + python -m ensurepip --user + python -m pip install -U pip pipx + # pipx ensurepath + echo "export PATH=$PATH:$HOME/.local/bin" >> ~/.bashrc - name: Verify Python version if: ${{ env.PYVERINST != env.PYVER }} @@ -59,21 +63,12 @@ jobs: 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 - echo "export PATH=$PATH:$HOME/.local/bin" >> ~/.bashrc - . ~/.bashrc # Needed to ensure poetry on PATH - pipx install poetry - - name: Build the Helper if: steps.cache-helper.outputs.cache-hit != 'true' run: | - . ~/.bashrc # Needed to ensure poetry on PATH + apt-get install -qq swig libpcsclite-dev build-essential cmake + export PATH=$PATH:$HOME/.local/bin # Needed to ensure pipx/poetry on PATH + pipx install poetry ./build-helper.sh - name: Install Flutter dependencies @@ -91,17 +86,19 @@ jobs: 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: Run lints/tests + 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 + - name: Embedd appindicator run: | patchelf --set-rpath '$ORIGIN' build/linux/x64/release/bundle/lib/libtray_manager_plugin.so diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index 090fb0d5..75662624 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -18,6 +18,11 @@ jobs: python3 set-version.py git diff --exit-code + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: ${{ env.PYVER }} + - name: Cache helper id: cache-helper uses: actions/cache@v3 @@ -27,12 +32,6 @@ jobs: assets/licenses/helper.json key: ${{ runner.os }}-py${{ env.PYVER }}-${{ hashFiles('helper/**') }} - - name: Set up Python - if: steps.cache-helper.outputs.cache-hit != 'true' - uses: actions/setup-python@v4 - with: - python-version: ${{ env.PYVER }} - - name: Install dependencies if: steps.cache-helper.outputs.cache-hit != 'true' run: | @@ -53,10 +52,11 @@ jobs: - run: flutter config --enable-macos-desktop - run: flutter --version - - name: Run tests + - name: Run lints/tests run: | + python -m pip install pre-commit + python -m pre_commit run --all-files flutter test - flutter analyze - name: Build the app run: | diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index f3073dc6..eb071498 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -19,6 +19,14 @@ jobs: python set-version.py git diff --exit-code + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: ${{ env.PYVER }} + + - name: Update pip + run: python -m pip install --upgrade pip + - name: Cache helper id: cache-helper uses: actions/cache@v3 @@ -28,21 +36,11 @@ jobs: assets/licenses/helper.json key: ${{ runner.os }}-py${{ env.PYVER }}-${{ hashFiles('helper/**') }} - - name: Set up Python - if: steps.cache-helper.outputs.cache-hit != 'true' - uses: actions/setup-python@v4 - with: - python-version: ${{ env.PYVER }} - - - name: Install dependencies - if: steps.cache-helper.outputs.cache-hit != 'true' - run: | - python -m pip install --upgrade pip - pip install poetry - - name: Build the Helper if: steps.cache-helper.outputs.cache-hit != 'true' - run: .\build-helper.bat + run: | + pip install poetry + .\build-helper.bat - uses: subosito/flutter-action@v2 with: @@ -51,16 +49,17 @@ jobs: - run: flutter config --enable-windows-desktop - run: flutter --version - - name: Run tests - run: | - flutter test - flutter analyze - - name: Build the app run: | $version = python set-version.py | select-object -first 1 flutter build windows --build-name=$version + - name: Run lints/tests + run: | + pip install pre-commit + pre-commit run --all-files + flutter test + - name: Check generated files run: git diff -I '.*android.*flutter_plugins.*qrscanner_zxing' --exit-code diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index da5ca8e9..dd373b9f 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -4,9 +4,7 @@ repos: rev: "4afcaa82fc368d40d486256bf4edba329bf667bb" hooks: - id: flutter-analyze - args: [lib/*] - id: dart-format - args: [lib/*] # Python - repo: https://github.com/PyCQA/flake8