diff --git a/.github/workflows/canary-main.yml b/.github/workflows/canary-main.yml index 30d5a77b..1282ef9c 100644 --- a/.github/workflows/canary-main.yml +++ b/.github/workflows/canary-main.yml @@ -2,9 +2,12 @@ name: Canary on: pull_request: - branches: [main, latest] - types: [opened, synchronize, reopened, ready_for_review] - workflow_dispatch: {} + types: + - opened + - synchronize + - reopened + branches: + - main permissions: contents: write @@ -12,7 +15,7 @@ permissions: packages: write concurrency: - group: canary-pr-${{ github.event.pull_request.number }} + group: canary-${{ github.run_id }} cancel-in-progress: true jobs: @@ -36,6 +39,44 @@ jobs: npm whoami || true env: NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + - name: Configure Git identity + run: | + git config --global user.name "github-actions[bot]" + git config --global user.email "github-actions[bot]@users.noreply.github.com" + - name: Set GitHub CLI token + run: echo "GH_TOKEN=${{ secrets.GITHUB_TOKEN }}" >> $GITHUB_ENV + - name: Validate Lerna version + run: | + # Checkout PR branch + git fetch origin ${{ github.head_ref }} + git checkout ${{ github.head_ref }} + + # Get Lerna version from PR branch + pr_version=$(jq -r .version lerna.json) + echo "PR_VERSION=$pr_version" >> $GITHUB_ENV + + # Checkout main branch + git fetch origin main + git checkout main + + # Get Lerna version from main branch + main_version=$(jq -r .version lerna.json) + echo "MAIN_VERSION=$main_version" >> $GITHUB_ENV + + # Return to PR branch + git checkout ${{ github.head_ref }} + echo "Branch ativa após retornar para PR: $(git rev-parse --abbrev-ref HEAD)" + + # Display versions being compared + echo "VERSION MAIN: $main_version" + echo "VERSION PR: $pr_version" + + # Compare versions + if printf "%s\n%s" "$main_version" "$pr_version" | sort -V | head -n1 | grep -q "$pr_version"; then + echo -e "⚠️ A versão do lerna.json no PR ($pr_version) não é válida.\n\nEla deve ser **MAIOR** que a versão atual da main ($main_version).\n\nPor favor, atualize sua branch com a main e rode o seguinte script para corrigir: version:patch" > comment.txt + gh issue comment ${{ github.event.pull_request.number }} --body-file comment.txt + exit 1 + fi - name: Install deps run: yarn install --frozen-lockfile - name: Build libs @@ -96,25 +137,19 @@ jobs: if: success() id: version run: | - BASE_VERSION=$(node -p 'require("./lerna.json").version') - SHORT_SHA=$(git rev-parse --short HEAD) - EPHEMERAL_VERSION="${BASE_VERSION}-next.${SHORT_SHA}.${GITHUB_RUN_ATTEMPT}" - echo "EPHEMERAL_VERSION=$EPHEMERAL_VERSION" >> $GITHUB_ENV - echo "EPHEMERAL_VERSION=$EPHEMERAL_VERSION" >> $GITHUB_OUTPUT + BASE_VERSION=$(jq -r .version lerna.json) + CANARY_VERSION="${BASE_VERSION}-next.$(git rev-parse --short HEAD)" + echo "CANARY_VERSION=$CANARY_VERSION" >> $GITHUB_ENV + echo "CANARY_VERSION=$CANARY_VERSION" >> $GITHUB_OUTPUT - name: Inject ephemeral version in packages if: success() run: | - EPV="$EPHEMERAL_VERSION" + EPV="$CANARY_VERSION" echo "Aplicando versão efêmera $EPV nos package.json (sem commit)" jq --arg v "$EPV" '.version = $v' lerna.json > lerna.tmp && mv lerna.tmp lerna.json for PKG in packages/*/package.json; do jq --arg v "$EPV" '.version = $v' "$PKG" > "$PKG.tmp" && mv "$PKG.tmp" "$PKG" || exit 1 done - - name: Git identity for ephemeral commit - if: success() - run: | - git config --global user.name 'github-actions[bot]' - git config --global user.email 'github-actions[bot]@users.noreply.github.com' - name: Ephemeral commit (local, not pushed) if: success() run: | @@ -123,7 +158,7 @@ jobs: if git diff --cached --quiet; then echo "Sem mudanças para commit (rerun?)" else - git commit -m "chore(ci): ephemeral canary version $EPHEMERAL_VERSION" || true + git commit -m "chore(ci): ephemeral canary version $CANARY_VERSION" || true fi git status --short - name: Publish canary (no commit/tag) @@ -132,8 +167,7 @@ jobs: NPM_TOKEN: ${{ secrets.NPM_TOKEN }} run: | npx lerna publish from-package --dist-tag next --yes --no-verify-access || echo "Nenhum pacote alterado para publicar (ok)" - echo "CURRENT_VERSION=$EPHEMERAL_VERSION" >> $GITHUB_ENV - + echo "CURRENT_VERSION=$CANARY_VERSION" >> $GITHUB_ENV - name: Revert ephemeral commit (keep tree clean for PR) if: success() run: | @@ -156,17 +190,3 @@ jobs: repo: context.repo.repo, body }); - - name: PR Failure Comment - if: failure() - uses: actions/github-script@v6 - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - script: | - const number = context.payload.pull_request.number; - const body = 'Canary não publicado: testes falharam. Verifique os logs do workflow.'; - await github.rest.issues.createComment({ - issue_number: number, - owner: context.repo.owner, - repo: context.repo.repo, - body - }); diff --git a/.github/workflows/patch-release-main.yml b/.github/workflows/patch-release-main.yml index 9ee800cc..a0649bd8 100644 --- a/.github/workflows/patch-release-main.yml +++ b/.github/workflows/patch-release-main.yml @@ -40,13 +40,10 @@ jobs: run: yarn install --frozen-lockfile - name: Build libs run: yarn build:libs - - name: Patch version & publish - id: patch - run: | - yarn publish:patch - VERSION=$(node -p 'require("./lerna.json").version') - echo "CURRENT_VERSION=$VERSION" >> $GITHUB_ENV - echo "PREVIOUS_TAG=$(git describe --tags --abbrev=0 --exclude $VERSION 2>/dev/null || echo '')" >> $GITHUB_ENV + - name: Publish to NPM + run: lerna publish from-package --yes --no-verify-access + env: + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} - name: PR Comment uses: actions/github-script@v6 with: diff --git a/.github/workflows/prerelease.yml b/.github/workflows/prerelease.yml deleted file mode 100644 index a9b9c8b7..00000000 --- a/.github/workflows/prerelease.yml +++ /dev/null @@ -1,20 +0,0 @@ -name: Pre-release - -on: - pull_request: - types: [closed] - branches: - - main - workflow_dispatch: {} - -permissions: - contents: write # for checkout and tag - pull-requests: write # for comments - packages: write # for publish - -jobs: - disabled: - runs-on: ubuntu-latest - if: false - steps: - - run: echo "Workflow legacy desativado. Use canary-main.yml / patch-release-main.yml / minor-release-latest.yml" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index 3cb3f1e5..00000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,20 +0,0 @@ -name: release prod -on: - # When Release Pull Request is merged - pull_request: - branches: - - latest - types: [closed] - workflow_dispatch: {} - -permissions: - contents: write # for checkout and tag - pull-requests: write # for comments - packages: write # for publish - -jobs: - disabled: - runs-on: ubuntu-latest - if: false - steps: - - run: echo "Workflow legacy desativado. Use minor-release-latest.yml" diff --git a/lerna.json b/lerna.json index 93e3ce7b..c0029a32 100644 --- a/lerna.json +++ b/lerna.json @@ -1,8 +1,6 @@ { - "packages": [ - "packages/*" - ], - "version": "0.9.6", + "packages": ["packages/*"], + "version": "0.9.8", "npmClient": "yarn", "command": { "publish": { @@ -19,4 +17,4 @@ "message": "chore(release): publish %s" } } -} \ No newline at end of file +} diff --git a/packages/atlas-theme/package.json b/packages/atlas-theme/package.json index 2c583eaa..c2fd1a7d 100644 --- a/packages/atlas-theme/package.json +++ b/packages/atlas-theme/package.json @@ -1,6 +1,6 @@ { "name": "@iq-firebolt/atlas-theme", - "version": "0.9.6", + "version": "0.9.8", "description": "> ATLAS Theme", "author": "iq team", "homepage": "https://github.com/IQ-tech/firebolt#readme", diff --git a/packages/aurora-theme/package.json b/packages/aurora-theme/package.json index efd9fb1a..c0a4341e 100644 --- a/packages/aurora-theme/package.json +++ b/packages/aurora-theme/package.json @@ -1,6 +1,6 @@ { "name": "@iq-firebolt/aurora-theme", - "version": "0.9.6", + "version": "0.9.8", "description": "> AURORA Theme", "author": "iq team", "homepage": "https://github.com/IQ-tech/firebolt#readme", diff --git a/packages/blueberry/package.json b/packages/blueberry/package.json index 335b6e6e..6f9a9a2c 100644 --- a/packages/blueberry/package.json +++ b/packages/blueberry/package.json @@ -1,6 +1,6 @@ { "name": "@iq-firebolt/blueberry-theme", - "version": "0.9.6", + "version": "0.9.8", "description": "> TODO: description", "author": "iq team", "homepage": "https://github.com/IQ-tech/firebolt#readme", @@ -24,7 +24,7 @@ "iq-blueberry": "^0.0.88" }, "devDependencies": { - "@iq-firebolt/validators": "0.9.6", + "@iq-firebolt/validators": "0.9.8", "react": "18.2.0", "react-dom": "18.2.0" }, diff --git a/packages/br-addons/package.json b/packages/br-addons/package.json index 4fb1b36e..26062c72 100644 --- a/packages/br-addons/package.json +++ b/packages/br-addons/package.json @@ -1,6 +1,6 @@ { "name": "@iq-firebolt/br-addons", - "version": "0.9.6", + "version": "0.9.8", "description": "> TODO: description", "author": "iq team", "homepage": "https://github.com/IQ-tech/firebolt#readme", diff --git a/packages/client-core/package.json b/packages/client-core/package.json index 043df002..5d94d5a5 100644 --- a/packages/client-core/package.json +++ b/packages/client-core/package.json @@ -1,6 +1,6 @@ { "name": "@iq-firebolt/client-core", - "version": "0.9.6", + "version": "0.9.8", "description": "> TODO: description", "author": "iq team", "homepage": "https://github.com/IQ-tech/firebolt#readme", diff --git a/packages/client/package.json b/packages/client/package.json index e30d3d94..4239c0b3 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -1,6 +1,6 @@ { "name": "@iq-firebolt/client", - "version": "0.9.6", + "version": "0.9.8", "description": "> TODO: description", "author": "iq team", "homepage": "https://github.com/IQ-tech/firebolt#readme", @@ -36,8 +36,8 @@ }, "dependencies": { "@babel/runtime": "^7.16.3", - "@iq-firebolt/client-core": "0.9.6", - "@iq-firebolt/validators": "0.9.6", + "@iq-firebolt/client-core": "0.9.8", + "@iq-firebolt/validators": "0.9.8", "classnames": "^2.3.1", "fast-levenshtein": "^3.0.0", "regex-parser": "^2.2.11", @@ -49,7 +49,7 @@ "@babel/plugin-transform-runtime": "^7.16.0", "@babel/preset-env": "^7.15.6", "@babel/preset-react": "^7.14.5", - "@iq-firebolt/material-theme": "0.9.6", + "@iq-firebolt/material-theme": "0.9.8", "@rollup/plugin-node-resolve": "^16.0.1", "@testing-library/react-hooks": "^7.0.2", "autoprefixer": "^10.4.2", diff --git a/packages/client/src/Main.test.tsx b/packages/client/src/Main.test.tsx index a2d65dcf..613b4050 100644 --- a/packages/client/src/Main.test.tsx +++ b/packages/client/src/Main.test.tsx @@ -81,3 +81,9 @@ describe("testing props-presets render", () => { ).toBeInTheDocument() }) }) + +describe("Force failure", () => { + it("should pass intentionally", () => { + expect(true).toBe(true) + }) +}) diff --git a/packages/entities/package.json b/packages/entities/package.json index c650bbbe..ac8637a3 100644 --- a/packages/entities/package.json +++ b/packages/entities/package.json @@ -1,6 +1,6 @@ { "name": "@iq-firebolt/entities", - "version": "0.9.6", + "version": "0.9.8", "description": "> TODO: description", "author": "iq team", "private": true, diff --git a/packages/json-schema/package.json b/packages/json-schema/package.json index b3043e2c..9a6d2649 100644 --- a/packages/json-schema/package.json +++ b/packages/json-schema/package.json @@ -1,6 +1,6 @@ { "name": "@iq-firebolt/json-schema", - "version": "0.9.6", + "version": "0.9.8", "description": "json schema lib", "author": "iq team", "homepage": "https://github.com/IQ-tech/firebolt#readme", diff --git a/packages/lab/package.json b/packages/lab/package.json index 0d3e2863..c4178667 100644 --- a/packages/lab/package.json +++ b/packages/lab/package.json @@ -1,14 +1,14 @@ { "name": "@iq-firebolt/lab", - "version": "0.9.6", + "version": "0.9.8", "private": true, "license": "Apache-2.0", "dependencies": { - "@iq-firebolt/blueberry-theme": "0.9.6", - "@iq-firebolt/br-addons": "0.8.3-next.148", - "@iq-firebolt/client": "0.9.6", - "@iq-firebolt/client-core": "0.9.6", - "@iq-firebolt/material-theme": "0.9.6", + "@iq-firebolt/blueberry-theme": "0.9.8", + "@iq-firebolt/br-addons": "0.9.8", + "@iq-firebolt/client": "0.9.8", + "@iq-firebolt/client-core": "0.9.8", + "@iq-firebolt/material-theme": "0.9.8", "iq-blueberry": "^0.0.88", "react": "18.2.0", "react-dom": "18.2.0", diff --git a/packages/material-theme/package.json b/packages/material-theme/package.json index d863bbe4..86040da2 100644 --- a/packages/material-theme/package.json +++ b/packages/material-theme/package.json @@ -1,6 +1,6 @@ { "name": "@iq-firebolt/material-theme", - "version": "0.9.6", + "version": "0.9.8", "description": "> TODO: description", "author": "iq team", "homepage": "https://github.com/IQ-tech/firebolt#readme", diff --git a/packages/validators/package.json b/packages/validators/package.json index 44dab336..2c01d7e4 100644 --- a/packages/validators/package.json +++ b/packages/validators/package.json @@ -1,6 +1,6 @@ { "name": "@iq-firebolt/validators", - "version": "0.9.6", + "version": "0.9.8", "description": "> TODO: description", "author": "iq team", "homepage": "https://github.com/IQ-tech/firebolt#readme", diff --git a/vitest.config.ts b/vitest.config.ts index a6c6153c..70036776 100644 --- a/vitest.config.ts +++ b/vitest.config.ts @@ -38,7 +38,7 @@ export default defineConfig({ // Coverage configuration coverage: { provider: "v8", - reporter: ["text", "json", "html", "lcov"], + reporter: ["text", "json", "json-summary", "html", "lcov"], // Added json-summary // Only include files that have corresponding tests all: false, include: [