From ea29aed3d4fbe9eee27c647827f4fefd67783ad9 Mon Sep 17 00:00:00 2001 From: Patryk Andrzejewski Date: Mon, 8 May 2023 14:24:03 +0200 Subject: [PATCH] Checking old macaw-ui/material ui usage in the modules (#3596) * MacawUI migration workflow * Trigger on pr * Checkout action version --- .github/workflows/dependency-check.yaml | 58 +++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 .github/workflows/dependency-check.yaml diff --git a/.github/workflows/dependency-check.yaml b/.github/workflows/dependency-check.yaml new file mode 100644 index 000000000..fd1cd92fc --- /dev/null +++ b/.github/workflows/dependency-check.yaml @@ -0,0 +1,58 @@ +name: MacawUI migration +on: [pull_request] + +jobs: + current_state: + runs-on: ubuntu-latest + name: "Calculate current state" + outputs: + main_statistics: ${{ steps.store_import_stats.outputs.MAIN_STATISTICS }} + steps: + - uses: actions/checkout@v3 + with: + ref: "main" + - uses: actions/setup-node@v3 + with: + node-version-file: '.nvmrc' + - name: Install deps + run: | + npm ci + - name: Store import stats + id: store_import_stats + run: | + stats=$(npx depcruise --config .dependency-cruiser.js src --output-type json | jq ".summary.info") + echo "Statistics on main branch: ${stats}" + echo "MAIN_STATISTICS=${stats}" >> $GITHUB_OUTPUT + + check_migation_status: + runs-on: ubuntu-latest + name: "Migration check" + needs: current_state + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version-file: '.nvmrc' + - name: Install deps + run: | + npm ci + - name: "Calculate stats" + env: + latest: ${{ needs.current_state.outputs.main_statistics }} + run: | + current=$(npx depcruise --config .dependency-cruiser.js src --output-type json | jq ".summary.info") + difference=$(( $current - $latest )) + echo "Imports in main: ${latest}" + echo "Incomming imports: ${current}" + echo "Difference: ${difference}" + echo "IMPORT_DIFFERENCE=${difference}" >> $GITHUB_ENV + - name: "MacawUI regression reported" + if: ${{ env.IMPORT_DIFFERENCE > 0 }} + run: | + echo "Regression detected: +${{ env.IMPORT_DIFFERENCE }} imports" + exit 1 + - name: "MacawUI migration progress" + if: ${{ env.IMPORT_DIFFERENCE <= 0 }} + run: | + echo "Progress by: ${{ env.IMPORT_DIFFERENCE }} imports" + exit 0 \ No newline at end of file