Skip to content

Commit

Permalink
Convert action to composite
Browse files Browse the repository at this point in the history
* move the current action to a sub folder and create a new top level composite action that reuses the old config action
* add workflow tests
  • Loading branch information
kuhnroyal committed Aug 20, 2024
1 parent 34c3905 commit 83a1497
Show file tree
Hide file tree
Showing 11 changed files with 86 additions and 3 deletions.
40 changes: 40 additions & 0 deletions .github/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Tests

on:
push:
pull_request:

# Ensure that new pushes/updates cancel running jobs
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
test-config:
name: Config only
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Flutter
id: config
uses: ./
with:
path: test/.fvmrc
- run: echo ${{ steps.config.outputs.FLUTTER_VERSION }}
- run: echo ${{ steps.config.outputs.FLUTTER_CHANNEL }}
- run: echo ${{ env.FLUTTER_VERSION }}
- run: echo ${{ env.FLUTTER_CHANNEL }}

test-setup:
name: Setup
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Flutter
uses: ./
with:
path: test/.fvmrc
setup-flutter: true
- run: flutter --version
23 changes: 20 additions & 3 deletions action.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: 'Flutter FVM config action'
description: 'Action that parses an FVM config file in order to configure the subosito/flutter-action.'
description: 'Action that parses an FVM config file in order to configure or setup the subosito/flutter-action.'
author: 'Peter Leibiger'
inputs:
path:
Expand All @@ -9,14 +9,31 @@ inputs:
description: 'Flavor to use'
required: false
default: ''
setup-flutter:
description: 'Setup Flutter (default: false)'
required: false
default: 'false'
outputs:
FLUTTER_VERSION:
description: 'The version of Flutter specified in the fvm configuration file'
value: ${{ steps.config-action.outputs.FLUTTER_VERSION }}
FLUTTER_CHANNEL:
description: 'The channel of Flutter specified in the fvm configuration file'
value: ${{ steps.config-action.outputs.FLUTTER_CHANNEL }}
runs:
using: 'node20'
main: 'dist/index.js'
using: 'composite'
steps:
- uses: ./config-action
id: config-action
with:
path: ${{ inputs.path }}
flavor: ${{ inputs.flavor }}
- uses: subosito/flutter-action@v2
if: inputs.setup-flutter == 'true'
with:
cache: true
flutter-version: ${{ steps.config-action.outputs.FLUTTER_VERSION }}
channel: ${{ steps.config-action.outputs.FLUTTER_CHANNEL }}
branding:
icon: 'maximize'
color: 'blue'
File renamed without changes.
File renamed without changes.
22 changes: 22 additions & 0 deletions config-action/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: 'Flutter FVM config action'
description: 'Action that parses an FVM config file in order to configure the subosito/flutter-action.'
author: 'Peter Leibiger'
inputs:
path:
description: 'Path to the FVM config file'
required: false
flavor:
description: 'Flavor to use'
required: false
default: ''
outputs:
FLUTTER_VERSION:
description: 'The version of Flutter specified in the fvm configuration file'
FLUTTER_CHANNEL:
description: 'The channel of Flutter specified in the fvm configuration file'
runs:
using: 'node20'
main: 'dist/index.js'
branding:
icon: 'maximize'
color: 'blue'
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 4 additions & 0 deletions test/.fvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"flutter": "3.24.0@stable",
"flavors": {}
}

0 comments on commit 83a1497

Please sign in to comment.