Workflows um Format Stage erweitern #175
@@ -56,84 +56,4 @@ jobs:
|
|||||||
run: flutter pub get
|
run: flutter pub get
|
||||||
|
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
run: flutter test
|
run: flutter test
|
||||||
|
|
||||||
Format:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
if: false
|
|
||||||
steps:
|
|
||||||
- name: Checkout code
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Install dependencies
|
|
||||||
run: |
|
|
||||||
apt-get update
|
|
||||||
apt-get install -y jq
|
|
||||||
|
|
||||||
- name: Install Flutter (wget)
|
|
||||||
run: |
|
|
||||||
wget --progress=dot: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
|
|
||||||
# Set Git safe directory for Flutter path
|
|
||||||
git config --global --add safe.directory "$(pwd)/flutter"
|
|
||||||
# Set Flutter path
|
|
||||||
echo "$(pwd)/flutter/bin" >> $GITHUB_PATH
|
|
||||||
|
|
||||||
- name: Get dependencies
|
|
||||||
run: flutter pub get
|
|
||||||
|
|
||||||
- name: Check code format
|
|
||||||
id: check_format
|
|
||||||
continue-on-error: true
|
|
||||||
run: flutter analyze lib test
|
|
||||||
|
|
||||||
- name: Format code
|
|
||||||
if: steps.check_format.outcome == 'failure'
|
|
||||||
env:
|
|
||||||
GITEA_TOKEN: ${{ secrets.BOT_TOKEN }}
|
|
||||||
run: |
|
|
||||||
git fetch origin ${{ gitea.head_ref }}
|
|
||||||
git checkout ${{ gitea.head_ref }}
|
|
||||||
|
|
||||||
dart fix --apply lib
|
|
||||||
dart fix --apply test
|
|
||||||
|
|
||||||
if [ -n "$(git status --porcelain lib test)" ]; then
|
|
||||||
git config --global user.name "Gitea Actions [bot]"
|
|
||||||
git config --global user.email ""
|
|
||||||
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
|
|
||||||
steps:
|
|
||||||
- name: Checkout code
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
token: ${{ secrets.BOT_TOKEN }}
|
|
||||||
ref: ${{ gitea.head_ref }}
|
|
||||||
|
|
||||||
- name: Update version
|
|
||||||
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 ""
|
|
||||||
git add pubspec.yaml
|
|
||||||
git commit -m "Updated version number [skip ci]"
|
|
||||||
git push origin HEAD:${{ gitea.head_ref }}
|
|
||||||
@@ -7,6 +7,33 @@ on:
|
|||||||
- "main"
|
- "main"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
Test:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
if: false
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: |
|
||||||
|
apt-get update
|
||||||
|
apt-get install -y jq
|
||||||
|
|
||||||
|
- name: Install Flutter (wget)
|
||||||
|
run: |
|
||||||
|
wget --quiet 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
|
||||||
|
# Set Git safe directory for Flutter path
|
||||||
|
git config --global --add safe.directory "$(pwd)/flutter"
|
||||||
|
# Set Flutter path
|
||||||
|
echo "$(pwd)/flutter/bin" >> $GITHUB_PATH
|
||||||
|
|
||||||
|
- name: Get dependencies
|
||||||
|
run: flutter pub get
|
||||||
|
|
||||||
|
- name: Run tests
|
||||||
|
run: flutter test
|
||||||
|
|
||||||
Format:
|
Format:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
if: false
|
if: false
|
||||||
@@ -38,6 +65,8 @@ jobs:
|
|||||||
|
|
||||||
- name: Format code
|
- name: Format code
|
||||||
if: steps.check_format.outcome == 'failure'
|
if: steps.check_format.outcome == 'failure'
|
||||||
|
env:
|
||||||
|
GITEA_TOKEN: ${{ secrets.BOT_TOKEN }}
|
||||||
run: |
|
run: |
|
||||||
git fetch origin ${{ gitea.head_ref }}
|
git fetch origin ${{ gitea.head_ref }}
|
||||||
git checkout ${{ gitea.head_ref }}
|
git checkout ${{ gitea.head_ref }}
|
||||||
@@ -47,10 +76,10 @@ jobs:
|
|||||||
|
|
||||||
if [ -n "$(git status --porcelain lib test)" ]; then
|
if [ -n "$(git status --porcelain lib test)" ]; then
|
||||||
git config --global user.name "Gitea Actions [bot]"
|
git config --global user.name "Gitea Actions [bot]"
|
||||||
git config --global user.email "actions@gitea.com"
|
git config --global user.email ""
|
||||||
git add lib test
|
git add lib test
|
||||||
git commit -m "Auto-format code"
|
git commit -m "Auto-format code [skip ci]"
|
||||||
git push
|
git push origin HEAD:${{ gitea.head_ref }}
|
||||||
else
|
else
|
||||||
echo "No changes to commit"
|
echo "No changes to commit"
|
||||||
fi
|
fi
|
||||||
@@ -58,28 +87,30 @@ jobs:
|
|||||||
- name: Verify format
|
- name: Verify format
|
||||||
run: flutter analyze lib test
|
run: flutter analyze lib test
|
||||||
|
|
||||||
|
Update-Version:
|
||||||
Update Version:
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
if: github.ref == 'refs/heads/development'
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
token: ${{ secrets.BOT_TOKEN }}
|
||||||
|
ref: ${{ gitea.head_ref }}
|
||||||
|
|
||||||
- name: Update version
|
- name: Update version
|
||||||
uses: https://github.com/stikkyapp/update-pubspec-version@v2
|
uses: https://github.com/stikkyapp/update-pubspec-version@v2
|
||||||
with:
|
with:
|
||||||
strategy: 'minor'
|
strategy: 'patch'
|
||||||
path: './pubspec.yaml'
|
path: './pubspec.yaml'
|
||||||
|
|
||||||
|
|
||||||
- name: Commit version update
|
- name: Commit version update
|
||||||
|
env:
|
||||||
|
GITEA_TOKEN: ${{ secrets.BOT_TOKEN }}
|
||||||
run: |
|
run: |
|
||||||
git fetch origin ${{ gitea.head_ref }}
|
|
||||||
git checkout ${{ gitea.head_ref }}
|
|
||||||
|
|
||||||
git config --global user.name "Gitea Actions [bot]"
|
git config --global user.name "Gitea Actions [bot]"
|
||||||
git config --global user.email "actions@gitea.com"
|
git config --global user.email ""
|
||||||
git add pubspec.yaml
|
git add pubspec.yaml
|
||||||
git commit -m "Updated version number"
|
git commit -m "Updated version number [skip ci]"
|
||||||
|
sneeex marked this conversation as resolved
Outdated
|
|||||||
git push
|
git push origin HEAD:${{ gitea.head_ref }}
|
||||||
Reference in New Issue
Block a user
(Mein kommentar placement hat keine relevanz)
Was hältst du davon wenn man die Version erst erhöht, wenn tests & lint erfolgreich waren? also dass die needs test und format sind, wobei doch eigentlich tests und lint auch unnötig sind? ich mein wenn die fehlschlagen, kann doch nicht gemerget werden und push.yaml läuft doch erst nach merge?
und:
Gitea unterstützt caching, also könnte man die flutter dependencies cachen um zeit zu sparen, das gleiche bei pull request natürlich.
Könntest ne eigene action zur flutter installation benutzen und dann diesen cache nutzen https://github.com/subosito/flutter-action
Also die Flutter Action funktioniert auf Gitea nicht, das hab ich schon geprüft.
Dependencies cachen, ja okay, aber das dauert reel 5 Sekunden oder so. Was ich gerne Cachen würde wäre die Flutter installation, falls du da n besseren weg findest, das dauert nämlich am längsten
ja ich meine mit dependencies flutter auch
Ja aber wenn du sagst das geht nur mit der Flutter Action dann ist das raus, ich hab das versucht aber wenn ich die implementiere funktionioert der Flutter installationsprozess nicht
https://gitea.com/actions/cache haste dir das angeguckt?
und was ist mit dem ersten teil von meinem comment?
Ja also checke was du meinst, aber eig auch irrelevant. Weil Format kannst du ja nur auf einer Branch machen, wo du selber nicht aktiv arbeitest. Und man kann ja auch irgendwann drüber nachdenken, ob man die Checks in der PR optional macht und nicht zwingend brauch (z.B. format).
Versionserhöhung hab ich nur ans ende gemacht, damit es da keine konflikte gibt, wenn die
pubspec.yamlformatiert wird.