Workflows um Format Stage erweitern #175

Merged
flixcoo merged 326 commits from setup/44-workflows-um-format-stage-erweitern into development 2026-01-20 10:48:49 +00:00
2 changed files with 86 additions and 45 deletions

View File

@@ -6,23 +6,17 @@ on:
jobs: jobs:
lint: lint:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout code - name: Checkout code
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Install jq
run: |
apt-get update
apt-get install -y jq
- name: Install Flutter (wget) - name: Install Flutter (wget)
run: | run: |
wget https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/flutter_linux_3.38.2-stable.tar.xz wget --show-progress --progress=bar:force:noscroll:giga https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/flutter_linux_3.38.2-stable.tar.xz
tar xf flutter_linux_3.38.2-stable.tar.xz tar xf flutter_linux_3.38.2-stable.tar.xz
# Set Git safe directory for Flutter path
git config --global --add safe.directory "$(pwd)/flutter" git config --global --add safe.directory "$(pwd)/flutter"
# Set Flutter path echo "$(pwd)/flutter/bin" >> $GITEA_PATH
echo "$(pwd)/flutter/bin" >> $GITHUB_PATH
- name: Get dependencies - name: Get dependencies
run: flutter pub get run: flutter pub get
@@ -32,26 +26,22 @@ jobs:
test: test:
runs-on: ubuntu-latest runs-on: ubuntu-latest
env:
RUNNER_TOOL_CACHE: /toolcache
steps: steps:
- name: Checkout code - name: Checkout code
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Install dependencies
run: |
apt-get update
apt-get install -y jq
- name: Install Flutter (wget) - name: Install Flutter (wget)
run: | run: |
wget https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/flutter_linux_3.38.2-stable.tar.xz wget --show-progress --progress=bar:force:noscroll:giga https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/flutter_linux_3.38.2-stable.tar.xz
tar xf flutter_linux_3.38.2-stable.tar.xz tar xf flutter_linux_3.38.2-stable.tar.xz
# Set Git safe directory for Flutter path
git config --global --add safe.directory "$(pwd)/flutter" git config --global --add safe.directory "$(pwd)/flutter"
# Set Flutter path echo "$(pwd)/flutter/bin" >> $GITEA_PATH
echo "$(pwd)/flutter/bin" >> $GITHUB_PATH
- name: Get dependencies - name: Get dependencies
run: flutter pub get run: flutter pub get
- name: Run tests - name: Run tests
run: flutter test run: flutter test

View File

@@ -7,44 +7,95 @@ on:
- "main" - "main"
jobs: jobs:
format: test:
runs-on: ubuntu-latest runs-on: ubuntu-latest
if: false # Needs bot user
steps: steps:
- name: Checkout code - name: Checkout code
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Install dependencies - name: Install Flutter (wget)
run: | run: |
apt-get update wget --show-progress --progress=bar:force:noscroll:giga https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/flutter_linux_3.38.2-stable.tar.xz
apt-get install -y jq tar xf flutter_linux_3.38.2-stable.tar.xz
git config --global --add safe.directory "$(pwd)/flutter"
echo "$(pwd)/flutter/bin" >> $GITEA_PATH
- name: Get dependencies
run: flutter pub get
- name: Run tests
run: flutter test
format:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Flutter (wget) - name: Install Flutter (wget)
run: | run: |
wget https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/flutter_linux_3.38.2-stable.tar.xz wget --show-progress --progress=bar:force:noscroll:giga https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/flutter_linux_3.38.2-stable.tar.xz
tar xf flutter_linux_3.38.2-stable.tar.xz tar xf flutter_linux_3.38.2-stable.tar.xz
# Set Git safe directory for Flutter path
git config --global --add safe.directory "$(pwd)/flutter" git config --global --add safe.directory "$(pwd)/flutter"
# Set Flutter path echo "$(pwd)/flutter/bin" >> $GITEA_PATH
echo "$(pwd)/flutter/bin" >> $GITHUB_PATH
- name: Get & upgrade dependencies - name: Get dependencies
run: | run: flutter pub get
flutter pub get
flutter pub upgrade --major-versions
- name: Auto-format - name: Check code format
sneeex marked this conversation as resolved Outdated

wofür brauchst du jq? gemini sagt ist unnötig

wofür brauchst du jq? gemini sagt ist unnötig

Das war schon vorher drin, und das hatte ohne nicht funktioniert. Ich kann gleich nochmal prüfen

Das war schon vorher drin, und das hatte ohne nicht funktioniert. Ich kann gleich nochmal prüfen
run: | id: check_format
dart format lib continue-on-error: true
dart fix --apply lib run: flutter analyze lib test
# Needs credentials, push access and the right files need to be staged - name: Format code
- name: Commit Changes if: steps.check_format.outcome == 'failure'
env:
GITEA_TOKEN: ${{ secrets.BOT_TOKEN }}
run: | run: |
git config --global user.name "Gitea Actions" git fetch origin ${{ gitea.head_ref }}
git config --global user.email "actions@gitea.com" git checkout ${{ gitea.head_ref }}
git status
git add lib/ dart fix --apply lib
git status dart fix --apply test
git commit -m "Actions: Auto-formatting [skip ci]"
git push if [ -n "$(git status --porcelain lib test)" ]; then
git config --global user.name "Gitea Actions [bot]"
git config --global user.email "actions@yannick-weigert.de"
git add lib test
git commit -m "Auto-format code [skip ci]"
git push origin HEAD:${{ gitea.head_ref }}
else
echo "No changes to commit"
fi
- name: Verify format
run: flutter analyze lib test
update_version:
runs-on: ubuntu-latest
needs: Format
if: gitea.ref == 'refs/heads/development'
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.BOT_TOKEN }}
ref: ${{ gitea.head_ref }}
- name: Increment version number
uses: https://github.com/stikkyapp/update-pubspec-version@v2
with:
strategy: 'patch'
path: './pubspec.yaml'
- name: Commit version update
env:
GITEA_TOKEN: ${{ secrets.BOT_TOKEN }}
run: |
git config --global user.name "Gitea Actions [bot]"
git config --global user.email "actions@yannick-weigert.de"
git add pubspec.yaml
git commit -m "Updated version number [skip ci]"
git push origin HEAD:${{ gitea.head_ref }}