Skip to content

Commit

Permalink
Merge pull request #214 from osociety/fix-analyzer
Browse files Browse the repository at this point in the history
Shorten workflow file and expressions
  • Loading branch information
git-elliot authored Nov 17, 2024
2 parents 33657c6 + 1c66610 commit 2683e16
Showing 1 changed file with 16 additions and 15 deletions.
31 changes: 16 additions & 15 deletions .github/workflows/flutter_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,14 @@ jobs:
pull-requests: read
# Set job outputs to values from filter step
outputs:
lib: ${{ steps.filter.outputs.lib }}
test: ${{ steps.filter.outputs.test }}
android: ${{ steps.filter.outputs.android }}
linux: ${{ steps.filter.outputs.linux }}
macos: ${{ steps.filter.outputs.macos }}
yaml: ${{ steps.filter.outputs.yaml }}
windows: ${{ steps.filter.outputs.windows }}
lib: ${{ steps.filter.outputs.lib == 'true' }}
test: ${{ steps.filter.outputs.test == 'true' }}
android: ${{ steps.filter.outputs.android == 'true' }}
linux: ${{ steps.filter.outputs.linux == 'true' }}
macos: ${{ steps.filter.outputs.macos == 'true' }}
yaml: ${{ steps.filter.outputs.yaml == 'true' }}
windows: ${{ steps.filter.outputs.windows == 'true'}}
branch: ${{steps.extract_branch.branch}}
steps:
# For pull requests it's not necessary to checkout the code
- name: Extract branch name
Expand Down Expand Up @@ -57,7 +58,7 @@ jobs:
matrix:
os: [macos, ubuntu, windows]
needs: changes
if: ${{ needs.changes.outputs.lib == 'true' || needs.changes.outputs.test == 'true' || needs.changes.outputs.yaml == 'true' || needs.changes.outputs.android == 'true' || needs.changes.outputs.linux == 'true' || needs.changes.outputs.macos == 'true' || needs.changes.outputs.windows == 'true' }}
if: ${{ needs.changes.outputs.lib || needs.changes.outputs.test || needs.changes.outputs.yaml || needs.changes.outputs.android || needs.changes.outputs.linux || needs.changes.outputs.macos || needs.changes.outputs.windows }}
runs-on: ${{ matrix.os }}-latest
steps:
- name: Checkout
Expand Down Expand Up @@ -101,10 +102,10 @@ jobs:
- name: Run tests
run: flutter test
- name: Run integration tests
if: needs.changes.extract_branch.outputs.branch == 'dev'
if: needs.changes.outputs.branch == 'dev'
run: flutter test integration_test --coverage -d ${{ matrix.os == 'ubuntu' && 'linux' || matrix.os }}
- name: Upload Coverage to CodeCov
if: needs.changes.extract_branch.outputs.branch == 'dev'
if: needs.changes.outputs.branch == 'dev'
uses: codecov/codecov-action@v3
with:
token: ${{secrets.CODECOV_TOKEN}}
Expand All @@ -116,7 +117,7 @@ jobs:
matrix:
os: [macos, windows, ubuntu]
needs: [changes, flutter-test]
if: ${{ (needs.changes.outputs.lib == 'true' || needs.changes.outputs.test == 'true' || needs.changes.outputs.android == 'true' || needs.changes.outputs.linux == 'true' || needs.changes.outputs.macos == 'true' || needs.changes.outputs.windows == 'true' || needs.changes.outputs.yaml == 'true') && (needs.changes.extract_branch.outputs.branch == 'dev') }}
if: ${{ (needs.changes.outputs.lib || needs.changes.outputs.test || needs.changes.outputs.android || needs.changes.outputs.linux || needs.changes.outputs.macos || needs.changes.outputs.windows || needs.changes.outputs.yaml ) && (needs.changes.outputs.branch == 'dev') }}
runs-on: ${{ matrix.os }}-latest
steps:
- name: Checkout
Expand Down Expand Up @@ -148,7 +149,7 @@ jobs:
build-runner-${{ hashFiles('**/asset_graph.json', '**/*.dart', '**/pubspec.lock', '**/outputs.json') }}
build-runner-
- name: Cache pods
if: ${{ (matrix.os == 'macos') && (needs.changes.extract_branch.outputs.branch == 'dev') && (needs.changes.outputs.lib == 'true' || needs.changes.outputs.test == 'true' || needs.changes.outputs.macos == 'true' || needs.changes.outputs.yaml == 'true' ) }}
if: ${{ (matrix.os == 'macos') && (needs.changes.outputs.branch == 'dev') && (needs.changes.outputs.lib || needs.changes.outputs.test || needs.changes.outputs.macos || needs.changes.outputs.yaml ) }}
uses: actions/cache@v3
with:
path: macos/Pods
Expand All @@ -161,14 +162,14 @@ jobs:
- name: Run build_runner
run: flutter pub run build_runner build
- name: Build Android
if: ${{ (matrix.os == 'ubuntu') && (needs.changes.extract_branch.outputs.branch == 'dev') && (needs.changes.outputs.lib == 'true' || needs.changes.outputs.test == 'true' || needs.changes.outputs.android == 'true' || needs.changes.outputs.yaml == 'true' )}}
if: ${{ (matrix.os == 'ubuntu') && (needs.changes.outputs.branch == 'dev') && (needs.changes.outputs.lib || needs.changes.outputs.test || needs.changes.outputs.android || needs.changes.outputs.yaml )}}
run: |
flutter build apk --debug --flavor dev
# Run only if test, lib, and linux folder is changed
- name: Install Linux dependencies
if: ${{ (matrix.os == 'ubuntu') && (needs.changes.extract_branch.outputs.branch == 'dev') && (needs.changes.outputs.lib == 'true' || needs.changes.outputs.test == 'true' || needs.changes.outputs.linux == 'true' || needs.changes.outputs.yaml == 'true') }}
if: ${{ (matrix.os == 'ubuntu') && (needs.changes.outputs.branch == 'dev') && (needs.changes.outputs.lib || needs.changes.outputs.test || needs.changes.outputs.linux || needs.changes.outputs.yaml ) }}
run: sudo apt-get install -y clang cmake ninja-build pkg-config libgtk-3-dev liblzma-dev
- name: Build Linux
if: ${{ (needs.changes.extract_branch.outputs.branch == 'dev') && (needs.changes.outputs.lib == 'true' || needs.changes.outputs.test == 'true' || needs.changes.outputs.linux == 'true' || needs.changes.outputs.macos == 'true' || needs.changes.outputs.windows == 'true' || needs.changes.outputs.yaml == 'true') }}
if: ${{ (needs.changes.outputs.branch == 'dev') && (needs.changes.outputs.lib || needs.changes.outputs.test || needs.changes.outputs.linux || needs.changes.outputs.macos || needs.changes.outputs.windows || needs.changes.outputs.yaml ) }}
run: flutter build ${{ matrix.os == 'ubuntu' && 'linux' || matrix.os }}

0 comments on commit 2683e16

Please sign in to comment.