From 6440b36f0a4d971d3263c586499f1c299d94e11c Mon Sep 17 00:00:00 2001 From: Angelo Cassano Date: Mon, 25 Aug 2025 11:49:16 +0200 Subject: [PATCH 1/5] New build pipeline --- .fvmrc | 4 +++ .github/actions/setup/action.yml | 10 +++++++ .github/workflows/analyze.yml | 15 ++++++++++ .github/workflows/build.yml | 29 ++++++++++++++++++ .github/workflows/default.yml | 35 ++++++++++++++++++++++ .github/workflows/main.yml | 51 -------------------------------- .github/workflows/publish.yml | 11 +++++++ .github/workflows/test.yml | 15 ++++++++++ README.md | 2 +- 9 files changed, 120 insertions(+), 52 deletions(-) create mode 100644 .fvmrc create mode 100644 .github/actions/setup/action.yml create mode 100644 .github/workflows/analyze.yml create mode 100644 .github/workflows/build.yml create mode 100644 .github/workflows/default.yml delete mode 100644 .github/workflows/main.yml create mode 100644 .github/workflows/publish.yml create mode 100644 .github/workflows/test.yml diff --git a/.fvmrc b/.fvmrc new file mode 100644 index 0000000..e848c2e --- /dev/null +++ b/.fvmrc @@ -0,0 +1,4 @@ +{ + "flutter": "3.3.2", + "flavors": {} +} \ No newline at end of file diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml new file mode 100644 index 0000000..5637696 --- /dev/null +++ b/.github/actions/setup/action.yml @@ -0,0 +1,10 @@ +name: Setup Flutter environment and get dependencies + +runs: + using: "composite" + steps: + - name: Install Flutter + uses: kuhnroyal/flutter-fvm-config-action/setup@v3 + - name: Get dependencies + shell: bash + run: flutter pub get \ No newline at end of file diff --git a/.github/workflows/analyze.yml b/.github/workflows/analyze.yml new file mode 100644 index 0000000..9066b16 --- /dev/null +++ b/.github/workflows/analyze.yml @@ -0,0 +1,15 @@ +name: Run Flutter Analyze + +on: + workflow_call: + +jobs: + analyze: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v5 + - name: Setup Flutter + uses: ./.github/actions/setup + - name: Analyze + run: flutter analyze \ No newline at end of file diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..c73da9c --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,29 @@ +name: Build Artifacts + +on: + workflow_call: + inputs: + platform: + required: true + type: string + +jobs: + build: + runs-on: ${{ inputs.platform == 'linux' && 'ubuntu-latest' || inputs.platform == 'windows' && 'windows-latest' || inputs.platform == 'macos' && 'macos-latest' }} + steps: + - name: Checkout code + uses: actions/checkout@v5 + - name: Install dependencies + if: ${{ inputs.platform == 'linux' }} + run: | + sudo apt-get update -y + sudo apt-get install \ + clang cmake git \ + ninja-build pkg-config \ + libgtk-3-dev liblzma-dev \ + libstdc++-12-dev + - name: Setup Flutter + uses: ./.github/actions/setup + - name: Build Artifacts + working-directory: example/${{ inputs.platform }} + run: flutter build ${{ inputs.platform }} --release \ No newline at end of file diff --git a/.github/workflows/default.yml b/.github/workflows/default.yml new file mode 100644 index 0000000..5b3a90e --- /dev/null +++ b/.github/workflows/default.yml @@ -0,0 +1,35 @@ +name: Pipeline + +on: + pull_request: + push: + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + analyze: + name: Testing + uses: ./.github/workflows/analyze.yml + + test: + name: Testing + uses: ./.github/workflows/test.yml + + build: + name: Build ${{ matrix.platform }} + needs: + - analyze + strategy: + matrix: + platform: [ linux, windows, macos ] + uses: ./.github/workflows/build.yml + with: + platform: ${{ matrix.platform }} + + publish: + name: Publish + needs: + - build + uses: ./.github/workflows/publish.yml \ No newline at end of file diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml deleted file mode 100644 index 2f1144d..0000000 --- a/.github/workflows/main.yml +++ /dev/null @@ -1,51 +0,0 @@ -name: Flutter CI - -on: push - -jobs: - tests-linux: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v5 - - uses: subosito/flutter-action@v2 - with: - channel: 'stable' - flutter-version: '3.3.2' - - name: Install dependencies - run: flutter pub get - - name: Generate support files - run: flutter pub run build_runner build --delete-conflicting-outputs - - name: Run Linux Tests - run: flutter test test/linux/disks_test.dart - - tests-windows: - runs-on: windows-latest - - steps: - - uses: actions/checkout@v5 - - uses: subosito/flutter-action@v2 - with: - channel: 'stable' - flutter-version: '3.3.2' - - name: Install dependencies - run: flutter pub get - - name: Run Windows Tests - run: flutter test test/windows/disks_test.dart - - tests-macos: - runs-on: macos-latest - - steps: - - uses: actions/checkout@v5 - - uses: subosito/flutter-action@v2 - with: - channel: 'stable' - flutter-version: '3.3.2' - architecture: x64 - - name: Install dependencies - run: flutter pub get - - name: Generate support files - run: flutter pub run build_runner build --delete-conflicting-outputs - - name: Run macOS Tests - run: flutter test test/macos/disks_test.dart \ No newline at end of file diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..d4405de --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,11 @@ +name: Publish Artifacts + +on: + workflow_call: + +jobs: + publish: + if: startsWith(github.ref, 'refs/tags/') + permissions: + id-token: write + uses: dart-lang/setup-dart/.github/workflows/publish.yml@v1 \ No newline at end of file diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..cea6bac --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,15 @@ +name: Run Flutter Tests + +on: + workflow_call: + +jobs: + test: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v5 + - name: Setup Flutter + uses: ./.github/actions/setup + - name: Run Tests + run: flutter test diff --git a/README.md b/README.md index 73f3f44..d37d9ac 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ Disks Desktop is Flutter desktop library able to retrieve the installed devices information [![Pub](https://img.shields.io/pub/v/disks_desktop.svg)](https://pub.dev/packages/disks_desktop) -![Flutter CI](https://github.com/AngeloAvv/disks/workflows/Flutter%20CI/badge.svg) +![Flutter CI](https://github.com/AngeloAvv/disks/workflows/Pipeline/badge.svg) [![Star on GitHub](https://img.shields.io/github/stars/AngeloAvv/disks.svg?style=flat&logo=github&colorB=deeppink&label=stars)](https://github.com/AngeloAvv/disks) [![License: MIT](https://img.shields.io/badge/license-MIT-purple.svg)](https://opensource.org/licenses/MIT) From c692352d19f5205d40638964658868c0eb62f414 Mon Sep 17 00:00:00 2001 From: Angelo Cassano Date: Mon, 25 Aug 2025 11:50:35 +0200 Subject: [PATCH 2/5] Fixed naming --- .github/workflows/default.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/default.yml b/.github/workflows/default.yml index 5b3a90e..411533c 100644 --- a/.github/workflows/default.yml +++ b/.github/workflows/default.yml @@ -10,7 +10,7 @@ concurrency: jobs: analyze: - name: Testing + name: Analyze uses: ./.github/workflows/analyze.yml test: @@ -21,6 +21,7 @@ jobs: name: Build ${{ matrix.platform }} needs: - analyze + - test strategy: matrix: platform: [ linux, windows, macos ] From 93fcfa7c9a810f6baf5e6d73893442ab3e633dad Mon Sep 17 00:00:00 2001 From: Angelo Cassano Date: Mon, 25 Aug 2025 11:54:57 +0200 Subject: [PATCH 3/5] Generate intermediates --- .github/actions/setup/action.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml index 5637696..5868cb7 100644 --- a/.github/actions/setup/action.yml +++ b/.github/actions/setup/action.yml @@ -7,4 +7,7 @@ runs: uses: kuhnroyal/flutter-fvm-config-action/setup@v3 - name: Get dependencies shell: bash - run: flutter pub get \ No newline at end of file + run: flutter pub get + - name: Generate intermediates + shell: bash + run: flutter pub run build_runner build --delete-conflicting-outputs \ No newline at end of file From e4e4ad69f3abded53b083006ae67b77c2c34e7eb Mon Sep 17 00:00:00 2001 From: Angelo Cassano Date: Mon, 25 Aug 2025 12:05:04 +0200 Subject: [PATCH 4/5] Fixed tests --- .github/workflows/default.yml | 7 ++++++- .github/workflows/test.yml | 6 +++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/.github/workflows/default.yml b/.github/workflows/default.yml index 411533c..21f9c6a 100644 --- a/.github/workflows/default.yml +++ b/.github/workflows/default.yml @@ -16,16 +16,21 @@ jobs: test: name: Testing uses: ./.github/workflows/test.yml + strategy: + matrix: + platform: [ linux, windows, macos ] + with: + platform: ${{ matrix.platform }} build: name: Build ${{ matrix.platform }} needs: - analyze - test + uses: ./.github/workflows/build.yml strategy: matrix: platform: [ linux, windows, macos ] - uses: ./.github/workflows/build.yml with: platform: ${{ matrix.platform }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index cea6bac..03fb801 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -2,6 +2,10 @@ name: Run Flutter Tests on: workflow_call: + inputs: + platform: + required: true + type: string jobs: test: @@ -12,4 +16,4 @@ jobs: - name: Setup Flutter uses: ./.github/actions/setup - name: Run Tests - run: flutter test + run: flutter test test/${{ inputs.platform }}/disks_test.dart \ No newline at end of file From 93cd41cd8959b45623386bc5345bab6a5ea28a51 Mon Sep 17 00:00:00 2001 From: Angelo Cassano Date: Mon, 25 Aug 2025 12:06:18 +0200 Subject: [PATCH 5/5] Fixed test OS --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 03fb801..bc0c594 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -9,7 +9,7 @@ on: jobs: test: - runs-on: ubuntu-latest + runs-on: ${{ inputs.platform == 'linux' && 'ubuntu-latest' || inputs.platform == 'windows' && 'windows-latest' || inputs.platform == 'macos' && 'macos-latest' }} steps: - name: Checkout code uses: actions/checkout@v5