Skip to content

Commit

Permalink
update workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
btrautmann committed Sep 16, 2024
1 parent 93a0a75 commit 04c9d7e
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 10 deletions.
33 changes: 26 additions & 7 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,19 @@ name: alchemist

on: [pull_request]

env:
FLUTTER_VERSION: 3.16.0

jobs:
build:
analyze:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- uses: subosito/flutter-action@v2
with:
flutter-version: '3.16.0'
flutter-version: ${{ env.FLUTTER_VERSION }}
channel: 'stable'
cache: true

Expand All @@ -24,20 +27,36 @@ jobs:
- name: Analyze project source
uses: invertase/github-action-dart-analyzer@v1

- uses: codecov/codecov-action@v2
with:
files: coverage/lcov.info

test:
runs-on: ubuntu-latest
strategy:
matrix:
flutter-version: ['3.16.9', '3.19.6', '3.22.3', '3.24.3']
steps:
- uses: actions/checkout@v3

- uses: subosito/flutter-action@v2
with:
flutter-version: ${{ matrix.flutter-version }}
channel: 'stable'
cache: true

- name: Run tests
run: flutter test --no-pub --coverage --test-randomize-ordering-seed=random
run: ALCHEMIST_FLUTTER_VERSION=${{ matrix.flutter-version }} flutter test --no-pub --coverage --test-randomize-ordering-seed=random

- name: Upload failures
if: failure()
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
with:
name: "golden_failures"
name: "golden_failures_${{ matrix.flutter-version }}"
path: |
**/failures/**/*.png

- uses: codecov/codecov-action@v2
with:
files: coverage/lcov.info

pana:
runs-on: ubuntu-latest
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/post_merge.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ on:
branches:
- 'main'

env:
FLUTTER_VERSION: 3.16.0

jobs:
upload_coverage:
runs-on: ubuntu-latest
Expand All @@ -14,7 +17,7 @@ jobs:

- uses: subosito/flutter-action@v2
with:
flutter-version: '3.16.0'
flutter-version: ${{ env.FLUTTER_VERSION }}
cache: true

- name: Install Dependencies
Expand Down
27 changes: 25 additions & 2 deletions .github/workflows/update_goldens.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ on:
branch:
description: 'Branch to generate goldens from'
required: true
flutter_version:
description: 'Flutter version to use'
required: true
default: '3.16.0'
permissions:
contents: write

Expand All @@ -14,6 +18,7 @@ jobs:
steps:
- name: Checkout repo
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

- name: Validate branch input
run: |
BRANCH_PATTERN="^[a-zA-Z0-9/_.-]+$"
Expand All @@ -32,6 +37,24 @@ jobs:
exit 1
fi
- name: Validate Flutter version input
run: |
VERSION_PATTERN="^[0-9]+\.[0-9]+\.[0-9]+$"
# Input string (branch name) to be validated
VERSION_INPUT=${{ inputs.branch}}
echo "Checking version input: $VERSION_INPUT"
# Validate branch name against the regex pattern
if [[ $VERSION_INPUT =~ $VERSION_PATTERN ]]; then
echo "Version input is valid."
exit 0
else
echo "Version input is invalid."
exit 1
fi
- name: Ensure branch is not main
if: ${{ github.event.inputs.branch == 'main' || github.event.inputs.branch == 'origin/main'}}
run: exit 1
Expand All @@ -43,13 +66,13 @@ jobs:

- uses: subosito/flutter-action@v2
with:
flutter-version: '3.16.0'
flutter-version: ${{ github.event.inputs.flutter_version }}
channel: 'stable'
cache: true

- name: Update Goldens
run: |
flutter test --update-goldens
ALCHEMIST_FLUTTER_VERSION=${{ inputs.flutter_version }} flutter test --update-goldens
continue-on-error: true

- name: Commit Changes
Expand Down

0 comments on commit 04c9d7e

Please sign in to comment.