Skip to content

Golden test generation - Examples #122

Golden test generation - Examples

Golden test generation - Examples #122

name: "Golden test generation - Examples"
on:
workflow_dispatch:
inputs:
package:
description: 'The name of the package'
required: true
type: choice
options:
- booking_app
- todoapp
- reminders
- rx_bloc_cli_all_enabled
- rx_bloc_cli_default
jobs:
example_project:
if: startsWith(inputs.package, 'rx_bloc_cli') == false
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: subosito/flutter-action@v2
with:
channel: "stable"
cache: true
cache-key: flutter-:os:-:channel:-:version:-:arch:-:hash:-${{ hashFiles('**/pubspec.lock') }}
- run: dart --version
- run: flutter --version
- name: Install Dependencies
working-directory: "examples/${{ inputs.package }}"
run: dart pub get
- name: Build Runner Build
working-directory: "examples/${{ inputs.package }}"
run: flutter pub run build_runner build --delete-conflicting-outputs
- name: Analyze
working-directory: "examples/${{ inputs.package }}"
run: flutter analyze lib
- name: Generate golden files
working-directory: "examples/${{ inputs.package }}"
run: flutter test --update-goldens --dart-define=CI=true
- name: Upload test directory
uses: actions/upload-artifact@v4
with:
name: "${{ inputs.package }}_tests"
path: "examples/${{ inputs.package }}/test/"
rx_bloc_cli_project:
if: startsWith(inputs.package, 'rx_bloc_cli')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: subosito/flutter-action@v2
with:
channel: "stable"
cache: true
cache-key: flutter-:os:-:channel:-:version:-:arch:-:hash:-${{ hashFiles('**/pubspec.lock') }}
- run: dart --version
- run: flutter --version
- name: Generate rx_bloc_cli project
working-directory: "packages/rx_bloc_cli"
run: |
bin/compile_bundles.sh
type=$(echo ${{inputs.package}} | sed 's/^[^_]*_[^_]*_[^_]*_//')
bin/generate_test_project.sh $type
- name: Generate golden files
working-directory: "packages/rx_bloc_cli/example/testapp"
run: flutter test --update-goldens --dart-define=CI=true
- name: Upload test directory
uses: actions/upload-artifact@v4
with:
name: "${{ inputs.package }}_tests"
path: "packages/rx_bloc_cli/example/testapp/test/"