Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: deduplicate and cleanup actions #2534

Merged
merged 25 commits into from
Dec 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions .github/actions/coverage/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,6 @@ runs:
using: composite

steps:
- name: Format coverage info
if: ${{ inputs.coverage != '' }}
run: dart pub run coverage:format_coverage --lcov --in=coverage --out=coverage/lcov.info --packages=.dart_tool/package_config.json --report-on=lib
shell: bash
working-directory: ${{ inputs.directory }}

- uses: codecov/codecov-action@e28ff129e5465c2c0dcc6f003fc735cb6ae0c673 # pin@v3
if: ${{ inputs.coverage != '' }}
with:
Expand All @@ -39,3 +33,4 @@ runs:
with:
path: './${{ inputs.directory }}/coverage/lcov.info'
min_coverage: ${{ inputs.min-coverage }}
exclude: 'lib/src/native/cocoa/binding.dart'
11 changes: 9 additions & 2 deletions .github/actions/dart-test/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,16 @@ runs:
working-directory: ${{ inputs.directory }}

- name: Test VM
run: dart test -p vm ${{ (runner.os == 'Linux' && matrix.sdk == 'stable' && '--coverage=coverage') || '' }} --test-randomize-ordering-seed=random --chain-stack-traces
shell: bash
working-directory: ${{ inputs.directory }}
shell: bash
run: |
testCmd="dart test -p vm --test-randomize-ordering-seed=random --chain-stack-traces"
if ${{ (matrix.os == 'ubuntu' && matrix.sdk == 'stable' && 'true') || 'false' }} ; then
$testCmd --coverage=coverage
dart run coverage:format_coverage --lcov --in=coverage --out=coverage/lcov.info --packages=.dart_tool/package_config.json --report-on=lib
else
$testCmd
fi

- name: Test dart2js
if: ${{ inputs.web == 'true' }}
Expand Down
56 changes: 56 additions & 0 deletions .github/actions/flutter-test/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Flutter tests
description: Run Flutter tests
inputs:
directory:
description: The directory to run tests in
required: false
default: ''

runs:
using: composite

steps:
- uses: subosito/flutter-action@f2c4f6686ca8e8d6e6d0f28410eeef506ed66aff # [email protected]
with:
channel: ${{ matrix.sdk }}

- uses: actions/setup-java@v4
if: ${{ matrix.target == 'android' }}
with:
java-version: '17'
distribution: 'adopt'

# Install required dependencies for Flutter on Linux on Ubuntu
- name: "Setup Linux"
if: matrix.target == 'linux'
shell: bash
run: |
sudo apt-get update -qq
sudo apt-get install -qq -y cmake dbus libblkid-dev libgtk-3-dev liblzma-dev ninja-build pkg-config xvfb libcurl4-openssl-dev network-manager upower

- run: flutter pub get
shell: bash
working-directory: ${{ inputs.directory }}

- name: Test VM
if: matrix.target == 'linux' || matrix.target == 'windows' || matrix.target == 'macos'
working-directory: ${{ inputs.directory }}
shell: bash
run: |
testCmd="flutter test ${{ (inputs.directory == 'isar' && '-j 1') || '' }} --test-randomize-ordering-seed=random"
if ${{ (matrix.target == 'linux' && matrix.sdk == 'stable' && 'true') || 'false' }} ; then
$testCmd --coverage
if [[ '${{ inputs.directory }}' == 'flutter' ]] ; then
dart run remove_from_coverage -f coverage/lcov.info -r 'binding.dart'
fi
else
$testCmd
fi

- name: Test web (${{ matrix.target }})
if: matrix.target == 'js' || matrix.target == 'wasm'
working-directory: ${{ inputs.directory }}
shell: bash
run: |
flutter test --platform chrome ${{ (matrix.target == 'wasm' && '--wasm') || '' }} --test-randomize-ordering-seed=random --exclude-tags canvasKit
flutter test --platform chrome ${{ (matrix.target == 'wasm' && '--wasm') || '' }} --test-randomize-ordering-seed=random --tags canvasKit
6 changes: 5 additions & 1 deletion .github/workflows/dart.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ on:
- '!**/*.md'
- '!**/class-diagram.svg'
- '.github/workflows/dart.yml'
- '.github/workflows/analyze.yml'
- '.github/actions/dart-test/**'
- '.github/actions/coverage/**'
- 'dart/**'

jobs:
Expand All @@ -21,7 +24,7 @@ jobs:
access_token: ${{ github.token }}

build:
name: Dart ${{matrix.sdk}} on ${{matrix.os}}
name: '${{ matrix.os }} | ${{ matrix.sdk }}'
runs-on: ${{ matrix.os }}-latest
timeout-minutes: 30
strategy:
Expand All @@ -36,6 +39,7 @@ jobs:
- '3.2'
- '3.3'
- '3.4'
- '3.5'
- stable
- beta
include:
Expand Down
15 changes: 7 additions & 8 deletions .github/workflows/dio.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ on:
- '!**/*.md'
- '!**/class-diagram.svg'
- '.github/workflows/dio.yml'
- '.github/workflows/analyze.yml'
- '.github/actions/dart-test/**'
- '.github/actions/coverage/**'
- 'dart/**'
- 'dio/**'

Expand All @@ -22,19 +25,15 @@ jobs:
access_token: ${{ github.token }}

build:
name: Build ${{matrix.sdk}} on ${{matrix.os}}
runs-on: ${{ matrix.os }}
name: '${{ matrix.os }} | ${{ matrix.sdk }}'
runs-on: ${{ matrix.os }}-latest
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
os: [macos, ubuntu, windows]
sdk: [stable, beta]
exclude:
- os: windows-latest
sdk: beta
- os: macos-latest
sdk: beta

steps:
- uses: actions/checkout@v4

Expand Down
101 changes: 20 additions & 81 deletions .github/workflows/drift.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,14 @@ on:
- release/**
pull_request:
paths:
- "!**/*.md"
- "!**/class-diagram.svg"
- ".github/workflows/drift.yml"
- "dart/**"
- "drift/**"
- '!**/*.md'
- '!**/class-diagram.svg'
- '.github/workflows/drift.yml'
- '.github/workflows/analyze.yml'
- '.github/actions/flutter-test/**'
- '.github/actions/coverage/**'
- 'dart/**'
- 'drift/**'

jobs:
cancel-previous-workflow:
Expand All @@ -22,96 +25,32 @@ jobs:
access_token: ${{ github.token }}

build:
name: ${{ matrix.target }} | ${{ matrix.os }} | ${{ matrix.sdk }}
runs-on: ${{ matrix.os }}
name: '${{ matrix.target }} | ${{ matrix.sdk }}'
runs-on: ${{ matrix.target == 'linux' && 'ubuntu' || matrix.target }}-latest
timeout-minutes: 30
defaults:
run:
shell: bash
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
target: ["ios", "android", "macos", "linux", "windows"]
sdk: ["stable", "beta"]
exclude:
- os: ubuntu-latest
target: ios
- os: ubuntu-latest
target: macos
- os: ubuntu-latest
target: windows
- os: windows-latest
target: ios
- os: windows-latest
target: android
- os: windows-latest
target: macos
- os: windows-latest
target: linux
# macos-latest is taking hours due to limited resources
- os: macos-latest
target: android
- os: macos-latest
target: linux
- os: macos-latest
target: windows
# Bad CPU type in executable
- os: macos-latest
sdk: beta
# Exclude beta for windows for now until the flutter set up action does not fail anymore
- os: windows-latest
sdk: beta
target: [macos, linux, windows]
sdk: [stable, beta]

steps:
- uses: actions/checkout@v4

- uses: actions/setup-java@v4
if: ${{ matrix.target == 'android' }}
- uses: ./.github/actions/flutter-test
with:
java-version: "11"
distribution: "adopt"
directory: drift

# Install required dependencies for Flutter on Linux on Ubuntu
- name: "Setup Linux"
run: |
sudo apt update
sudo apt install -y cmake dbus libblkid-dev libgtk-3-dev liblzma-dev ninja-build pkg-config xvfb
sudo apt install -y network-manager upower
if: matrix.os == 'ubuntu-latest' && matrix.target == 'linux'

- uses: subosito/flutter-action@f2c4f6686ca8e8d6e6d0f28410eeef506ed66aff # [email protected]
with:
channel: ${{ matrix.sdk }}

- run: flutter upgrade

- name: Pub Get
run: |
cd drift
flutter pub get

- name: Test VM with coverage
run: |
cd drift
flutter test --coverage --test-randomize-ordering-seed=random

- uses: codecov/codecov-action@7f8b4b4bde536c465e797be725718b88c5d95e0e # pin@v3
if: runner.os == 'Linux' && matrix.sdk == 'stable' && matrix.target == 'linux'
- uses: ./.github/actions/coverage
if: matrix.target == 'linux' && matrix.sdk == 'stable'
with:
name: sentry_drift
file: ./drift/coverage/lcov.info
functionalities: "search" # remove after https://github.com/codecov/codecov-action/issues/600
token: ${{ secrets.CODECOV_TOKEN }}

- uses: VeryGoodOpenSource/very_good_coverage@c953fca3e24a915e111cc6f55f03f756dcb3964c # [email protected]
if: runner.os == 'Linux' && matrix.sdk == 'stable' && matrix.target == 'linux'
with:
path: "./drift/coverage/lcov.info"
min_coverage: 80
directory: drift
coverage: sentry_drift
min-coverage: 80

analyze:
uses: ./.github/workflows/analyze.yml
with:
package: drift
sdk: flutter
sdk: flutter
1 change: 1 addition & 0 deletions .github/workflows/e2e_dart.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ on:
- "!**/*.md"
- "!**/class-diagram.svg"
- ".github/workflows/e2e_dart.yml"
- '.github/workflows/analyze.yml'
- "dart/**"
- "e2e_test/**"

Expand Down
15 changes: 7 additions & 8 deletions .github/workflows/file.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ on:
- '!**/*.md'
- '!**/class-diagram.svg'
- '.github/workflows/file.yml'
- '.github/workflows/analyze.yml'
- '.github/actions/dart-test/**'
- '.github/actions/coverage/**'
- 'dart/**'
- 'flutter/**'
- 'file/**'
Expand All @@ -23,19 +26,15 @@ jobs:
access_token: ${{ github.token }}

build:
name: Build ${{matrix.sdk}} on ${{matrix.os}}
runs-on: ${{ matrix.os }}
name: '${{ matrix.os }} | ${{ matrix.sdk }}'
runs-on: ${{ matrix.os }}-latest
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
os: [macos, ubuntu, windows]
sdk: [stable, beta]
exclude:
- os: windows-latest
sdk: beta
- os: macos-latest
sdk: beta

steps:
- uses: actions/checkout@v4

Expand Down
Loading
Loading