From 4b89a6049ad238de55b62160fa1761446c37766a Mon Sep 17 00:00:00 2001 From: William Cunha Cardoso Date: Fri, 26 Apr 2024 13:47:29 -0300 Subject: [PATCH] refactor: ci action --- .github/workflows/ci.yaml | 194 +++++++------------------------------- 1 file changed, 36 insertions(+), 158 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index c2fcb3f..a2c6e88 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -2,68 +2,31 @@ name: Continuous Integration on: [pull_request, workflow_dispatch] +env: + FLUTTER_VERSION: "3.19.5" + jobs: setup: - runs-on: ${{ matrix.os }} - - strategy: - matrix: - os: [ubuntu-latest] - include: - - os: ubuntu-latest - flutter_path: /opt/hostedtoolcache/flutter - fail-fast: false + runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - name: Cache Flutter dependencies - uses: actions/cache@v2 + - uses: ./.github/workflows/setup-and-cache.yml with: - path: ${{ matrix.flutter_path }} - key: ${{ runner.os }}-flutter-3.0.0 - - uses: subosito/flutter-action@v2 - with: - channel: "stable" - - name: "Prepare Flutter Environment" - run: ./.github/workflows/scripts/prepare-env.sh - - name: "Install Tools" - run: | - ./.github/workflows/scripts/install-tools.sh + java-version: 12.x + flutter-version: ${{ env.FLUTTER_VERSION }} analyze: timeout-minutes: 15 - runs-on: ubuntu-latest needs: setup + runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - name: Cancel Previous Runs - uses: styfle/cancel-workflow-action@0.5.0 - with: - access_token: ${{ github.token }} - - name: Configuring java - uses: actions/setup-java@v1 + - name: Configure Java, Cache, and Prepare Environment + uses: ./.github/workflows/setup-and-cache.yml with: java-version: 12.x - - name: Cache Flutter dependencies - uses: actions/cache@v2 - with: - path: /opt/hostedtoolcache/flutter - key: ${{ runner.os }}-flutter-3.0.0 - - name: Configuring flutter environment - uses: subosito/flutter-action@v2 - with: - flutter-version: "3.0.0" - channel: "stable" - - name: "Prepare Flutter Environment" - run: ./.github/workflows/scripts/prepare-env.sh - - name: "Install Tools" - run: | - ./.github/workflows/scripts/install-tools.sh - - name: "Bootstrap Workspace" - run: melos bootstrap - - name: "Dart Analyze" + flutter-version: ${{ env.FLUTTER_VERSION }} + + - name: Dart Analyze run: melos run analyze format: @@ -71,73 +34,30 @@ jobs: timeout-minutes: 15 needs: setup steps: - - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - name: Cancel Previous Runs - uses: styfle/cancel-workflow-action@0.5.0 - with: - access_token: ${{ github.token }} - - name: Configuring java - uses: actions/setup-java@v1 + - name: Configure Java, Cache, and Prepare Environment + uses: ./.github/workflows/setup-and-cache.yml with: java-version: 12.x - - name: Cache Flutter dependencies - uses: actions/cache@v2 - with: - path: /opt/hostedtoolcache/flutter - key: ${{ runner.os }}-flutter-3.0.0 - - name: Configuring flutter environment - uses: subosito/flutter-action@v2 - with: - flutter-version: "3.0.0" - channel: "stable" - - name: "Prepare Flutter Environment" - run: ./.github/workflows/scripts/prepare-env.sh - - name: "Install Tools" - run: | - ./.github/workflows/scripts/install-tools.sh - curl -sL https://github.com/google/google-java-format/releases/download/google-java-format-1.3/google-java-format-1.3-all-deps.jar -o $HOME/google-java-format.jar - - name: "Bootstrap Workspace" - run: melos bootstrap - - name: "Formatter" + flutter-version: ${{ env.FLUTTER_VERSION }} + + - name: Formatter run: melos run format - - name: "Validating formatter" + + - name: Validate Formatting run: ./.github/workflows/scripts/validate-formatting.sh build_torch_controller_example_ubuntu: timeout-minutes: 20 - runs-on: ubuntu-latest needs: setup + runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - name: Cancel Previous Runs - uses: styfle/cancel-workflow-action@0.5.0 - with: - access_token: ${{ github.token }} - - name: Configuring java - uses: actions/setup-java@v1 + - name: Configure Java, Cache, and Prepare Environment + uses: ./.github/workflows/setup-and-cache.yml with: java-version: 12.x - - name: Cache Flutter dependencies - uses: actions/cache@v2 - with: - path: /opt/hostedtoolcache/flutter - key: ${{ runner.os }}-flutter-3.0.0 - - name: Configuring flutter environment - uses: subosito/flutter-action@v2 - with: - flutter-version: "3.0.0" - channel: "stable" - - name: "Prepare Flutter Environment" - run: ./.github/workflows/scripts/prepare-env.sh - - name: "Install Tools" - run: ./.github/workflows/scripts/install-tools.sh - - name: "Bootstrap Workspace" - run: melos bootstrap - - name: "torch_controller_example app bundle" + flutter-version: ${{ env.FLUTTER_VERSION }} + + - name: Build torch_controller_example app bundle run: cd packages/torch_controller/example && flutter build appbundle test_torch_controller: @@ -145,34 +65,13 @@ jobs: timeout-minutes: 15 needs: setup steps: - - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - name: Cancel Previous Runs - uses: styfle/cancel-workflow-action@0.5.0 - with: - access_token: ${{ github.token }} - - name: Configuring java - uses: actions/setup-java@v1 + - name: Configure Java, Cache, and Prepare Environment + uses: ./.github/workflows/setup-and-cache.yml with: java-version: 12.x - - name: Cache Flutter dependencies - uses: actions/cache@v2 - with: - path: /opt/hostedtoolcache/flutter - key: ${{ runner.os }}-flutter-3.0.0 - - name: Configuring flutter environment - uses: subosito/flutter-action@v2 - with: - flutter-version: "3.0.0" - channel: "stable" - - name: "Prepare Flutter Environment" - run: ./.github/workflows/scripts/prepare-env.sh - - name: "Install Tools" - run: ./.github/workflows/scripts/install-tools.sh - - name: "Bootstrap Workspace" - run: melos bootstrap - - name: "Flutter Test" + flutter-version: ${{ env.FLUTTER_VERSION }} + + - name: Flutter Test run: melos run test:torch:controller test_storage_controller: @@ -180,32 +79,11 @@ jobs: timeout-minutes: 15 needs: setup steps: - - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - name: Cancel Previous Runs - uses: styfle/cancel-workflow-action@0.5.0 - with: - access_token: ${{ github.token }} - - name: Configuring java - uses: actions/setup-java@v1 + - name: Configure Java, Cache, and Prepare Environment + uses: ./.github/workflows/setup-and-cache.yml with: java-version: 12.x - - name: Cache Flutter dependencies - uses: actions/cache@v2 - with: - path: /opt/hostedtoolcache/flutter - key: ${{ runner.os }}-flutter-3.0.0 - - name: Configuring flutter environment - uses: subosito/flutter-action@v2 - with: - flutter-version: "3.0.0" - channel: "stable" - - name: "Prepare Flutter Environment" - run: ./.github/workflows/scripts/prepare-env.sh - - name: "Install Tools" - run: ./.github/workflows/scripts/install-tools.sh - - name: "Bootstrap Workspace" - run: melos bootstrap - - name: "Flutter Test" + flutter-version: ${{ env.FLUTTER_VERSION }} + + - name: Flutter Test run: melos run test:storage:controller