Skip to content

Merge pull request #420 from soliplex/chore/version-0.93.0+66 #750

Merge pull request #420 from soliplex/chore/version-0.93.0+66

Merge pull request #420 from soliplex/chore/version-0.93.0+66 #750

Workflow file for this run

name: Flutter CI
on:
push:
branches: [main]
paths-ignore:
- "docs/**"
- "**.md"
- ".markdownlint.json"
- "LICENSE"
pull_request:
branches: [main, 'feat/**', 'fix/**', 'refactor/**', 'chore/**']
paths-ignore:
- "docs/**"
- "**.md"
- ".markdownlint.json"
- "LICENSE"
workflow_dispatch:
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true
env:
SLACK_NOTIFY_URL: ${{ secrets.SLACK_NOTIFY_URL }}
jobs:
lint:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v6
- name: Setup Dart environment
uses: ./.github/actions/setup-dart-env
- name: Check formatting
run: dart format --set-exit-if-changed .
- name: Analyze code
run: flutter analyze --fatal-infos
- name: Check documentation
run: dart doc --dry-run
- name: Lint markdown
run: npx markdownlint-cli2 "**/*.md" "#node_modules"
test:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v6
- name: Setup Dart environment
uses: ./.github/actions/setup-dart-env
- name: Generate random seed
id: seed
run: echo "value=$RANDOM" >> "$GITHUB_OUTPUT"
- name: Run app tests
run: |
SEED="${{ steps.seed.outputs.value }}"
echo "::notice::Test ordering seed: $SEED"
flutter test --test-randomize-ordering-seed="$SEED" --coverage
- name: Run package tests
run: |
# Exclude integration-tagged tests (require a live backend)
for pkg in packages/soliplex_agent packages/soliplex_client packages/soliplex_logging; do
echo "::group::Testing $pkg"
(cd "$pkg" && dart test --exclude-tags integration)
echo "::endgroup::"
done
echo "::group::Testing packages/soliplex_client_native"
(cd packages/soliplex_client_native && flutter test)
echo "::endgroup::"
# Full suite incl. goldens. Goldens render per-platform; the
# committed baseline is rendered on Linux at the Flutter version
# pinned in setup-dart-env, so it's authoritative here. Refresh it
# with the update-goldens workflow.
echo "::group::Testing packages/soliplex_design"
(cd packages/soliplex_design && flutter test)
echo "::endgroup::"
- name: Report seed on failure
if: failure()
run: |
SEED="${{ steps.seed.outputs.value }}"
echo "::error::Tests failed with ordering seed: $SEED"
echo "Reproduce with: --test-randomize-ordering-seed=$SEED"
- name: Upload golden diffs on failure
if: failure()
uses: actions/upload-artifact@v7
with:
name: golden-failures
path: packages/soliplex_design/test/components/**/failures/
if-no-files-found: ignore
retention-days: 7
- name: Check coverage threshold
run: |
sudo apt-get update -qq
sudo apt-get install -y -qq lcov
lcov --remove coverage/lcov.info 'packages/*' \
-o coverage/lcov.info --ignore-errors unused
COVERAGE=$(lcov --summary coverage/lcov.info 2>&1 \
| grep "lines" | sed 's/.*: \([0-9.]*\)%.*/\1/')
echo "Coverage: ${COVERAGE}%"
if [ -z "$COVERAGE" ]; then
echo "::error::Could not parse coverage from lcov.info"
exit 1
fi
COVERAGE_INT=${COVERAGE%.*}
if [ "$COVERAGE_INT" -lt 80 ]; then
echo "::error::Coverage ${COVERAGE}% is below minimum 80%"
exit 1
fi
echo "::notice::Coverage check passed with ${COVERAGE}%"
- name: Upload coverage artifact
uses: actions/upload-artifact@v7
with:
name: coverage-report
path: coverage/
retention-days: 7
- name: Notify Slack on failure
if: failure() && env.SLACK_NOTIFY_URL != ''
uses: slackapi/slack-github-action@v3.0.3
env:
COMMIT_MSG: ${{ github.event.head_commit.message }}
REF: ${{ github.ref }}
RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
with:
webhook: ${{ env.SLACK_NOTIFY_URL }}
webhook-type: incoming-webhook
payload: |
{
"channel": "#soliplex",
"username": "flutter-ci",
"text": ":x: Tests failed on ${{ env.REF }}:\n${{ env.COMMIT_MSG }}\n${{ env.RUN_URL }}",
"icon_emoji": ":flutter:"
}
build-web:
needs: [lint]
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v6
- name: Setup Dart environment
uses: ./.github/actions/setup-dart-env
- name: Build web
run: flutter build web --release
- name: Upload web artifact
uses: actions/upload-artifact@v7
with:
name: web-build
path: build/web/
retention-days: 7
- name: Notify Slack on failure
if: failure() && env.SLACK_NOTIFY_URL != ''
uses: slackapi/slack-github-action@v3.0.3
env:
COMMIT_MSG: ${{ github.event.head_commit.message }}
REF: ${{ github.ref }}
RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
with:
webhook: ${{ env.SLACK_NOTIFY_URL }}
webhook-type: incoming-webhook
payload: |
{
"channel": "#soliplex",
"username": "flutter-ci",
"text": ":x: Web build failed on ${{ env.REF }}:\n${{ env.COMMIT_MSG }}\n${{ env.RUN_URL }}",
"icon_emoji": ":flutter:"
}