From 3e4d7868f26d2e06b9557f63e12fd576bd146db6 Mon Sep 17 00:00:00 2001 From: Sysix Date: Sun, 3 Nov 2024 02:01:15 +0100 Subject: [PATCH 01/12] ci: check code generation --- .github/workflows/generate.yml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 .github/workflows/generate.yml diff --git a/.github/workflows/generate.yml b/.github/workflows/generate.yml new file mode 100644 index 0000000..f7d4aac --- /dev/null +++ b/.github/workflows/generate.yml @@ -0,0 +1,24 @@ +name: Code generation + +on: + pull_request: + types: [opened, synchronize] + push: + branches: + - main + - 'renovate/**' + +jobs: + generate: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Clone oxc_linter project + run: pnpm run clone + + - name: Generate from source code + run: pnpm run generate + + - name: Format generated code + run: pnpm run format From e2fd1e306245d0a33fe5b8fa51e5059be5ad1cfa Mon Sep 17 00:00:00 2001 From: Sysix Date: Sun, 3 Nov 2024 02:02:15 +0100 Subject: [PATCH 02/12] ci: check code generation --- .github/workflows/generate.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/generate.yml b/.github/workflows/generate.yml index f7d4aac..b2b3896 100644 --- a/.github/workflows/generate.yml +++ b/.github/workflows/generate.yml @@ -14,6 +14,8 @@ jobs: steps: - uses: actions/checkout@v4 + - uses: ./.github/actions/pnpm + - name: Clone oxc_linter project run: pnpm run clone From 0ed7fe09fb44805d8fdaf5e1937e88faff0780af Mon Sep 17 00:00:00 2001 From: Sysix Date: Sun, 3 Nov 2024 02:30:19 +0100 Subject: [PATCH 03/12] ci: check code generation --- .github/workflows/generate.yml | 6 ++++++ scripts/rules-generator.ts | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/generate.yml b/.github/workflows/generate.yml index b2b3896..8f23b63 100644 --- a/.github/workflows/generate.yml +++ b/.github/workflows/generate.yml @@ -24,3 +24,9 @@ jobs: - name: Format generated code run: pnpm run format + + - name: Check for git diff + run: | + if [[ -n $(git status --porcelain) ]]; then + echo "changes=true" >> "$GITHUB_OUTPUT"; + fi diff --git a/scripts/rules-generator.ts b/scripts/rules-generator.ts index 9c5af30..d37ac8e 100644 --- a/scripts/rules-generator.ts +++ b/scripts/rules-generator.ts @@ -52,7 +52,7 @@ export class RulesGenerator { const exportGrouping: string[] = []; let code = - '// These rules are automatically generated by scripts/generate-rules.ts\n\n'; + '// hello - These rules are automatically generated by scripts/generate-rules.ts\n\n'; for (const grouping of rulesMap.keys()) { exportGrouping.push(grouping); From 1ba2ee93b40ee59dc0d668e146caf186b1b47bb6 Mon Sep 17 00:00:00 2001 From: Sysix Date: Sun, 3 Nov 2024 02:41:58 +0100 Subject: [PATCH 04/12] ci: check code generation --- .github/workflows/generate.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/generate.yml b/.github/workflows/generate.yml index 8f23b63..4cd9ce9 100644 --- a/.github/workflows/generate.yml +++ b/.github/workflows/generate.yml @@ -26,7 +26,4 @@ jobs: run: pnpm run format - name: Check for git diff - run: | - if [[ -n $(git status --porcelain) ]]; then - echo "changes=true" >> "$GITHUB_OUTPUT"; - fi + run: git diff-index --quiet HEAD -- From 0f17945a992496242582ba4171fbf564253dd96f Mon Sep 17 00:00:00 2001 From: Sysix Date: Sun, 3 Nov 2024 02:43:05 +0100 Subject: [PATCH 05/12] ci: check code generation --- scripts/rules-generator.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/rules-generator.ts b/scripts/rules-generator.ts index d37ac8e..9c5af30 100644 --- a/scripts/rules-generator.ts +++ b/scripts/rules-generator.ts @@ -52,7 +52,7 @@ export class RulesGenerator { const exportGrouping: string[] = []; let code = - '// hello - These rules are automatically generated by scripts/generate-rules.ts\n\n'; + '// These rules are automatically generated by scripts/generate-rules.ts\n\n'; for (const grouping of rulesMap.keys()) { exportGrouping.push(grouping); From 6c056414f694d65f239edafd5c51ccdb7395efa7 Mon Sep 17 00:00:00 2001 From: Sysix Date: Mon, 11 Nov 2024 14:56:50 +0100 Subject: [PATCH 06/12] ci: check code generation --- .github/workflows/generate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/generate.yml b/.github/workflows/generate.yml index 4cd9ce9..f84351b 100644 --- a/.github/workflows/generate.yml +++ b/.github/workflows/generate.yml @@ -26,4 +26,4 @@ jobs: run: pnpm run format - name: Check for git diff - run: git diff-index --quiet HEAD -- + run: git diff --exit-code --quiet From 6c95a7c94ec3dd6197cedfac037f92e43fe635a9 Mon Sep 17 00:00:00 2001 From: Sysix Date: Mon, 11 Nov 2024 14:58:03 +0100 Subject: [PATCH 07/12] ci: check code generation --- scripts/config-generator.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/config-generator.ts b/scripts/config-generator.ts index ab6acff..9e8a1bb 100644 --- a/scripts/config-generator.ts +++ b/scripts/config-generator.ts @@ -38,7 +38,7 @@ export class ConfigGenerator { } public generateRulesCode() { - console.log(`Generating config, grouped by ${this.rulesGrouping}`); + console.log(`Generating config2, grouped by ${this.rulesGrouping}`); const rulesGrouping = this.rulesGrouping; const rulesArray = this.rulesArray; From 0f9501660cbe0795b4a2a37e4cf3d131ebca325b Mon Sep 17 00:00:00 2001 From: Sysix Date: Mon, 11 Nov 2024 15:00:03 +0100 Subject: [PATCH 08/12] ci: check code generation --- scripts/config-generator.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/config-generator.ts b/scripts/config-generator.ts index 9e8a1bb..9c0d584 100644 --- a/scripts/config-generator.ts +++ b/scripts/config-generator.ts @@ -38,7 +38,7 @@ export class ConfigGenerator { } public generateRulesCode() { - console.log(`Generating config2, grouped by ${this.rulesGrouping}`); + console.log(`Generating config, grouped by ${this.rulesGrouping}`); const rulesGrouping = this.rulesGrouping; const rulesArray = this.rulesArray; @@ -48,7 +48,7 @@ export class ConfigGenerator { const exportGrouping: string[] = []; let code = - '// These rules are automatically generated by scripts/generate-rules.ts\n\n'; + '// These rules are automatically generated2 by scripts/generate-rules.ts\n\n'; code += `import * as rules from "./rules-by-${this.rulesGrouping}.js";\n\n`; From 287530ac78e16533ce5601ac367c617b03dca1db Mon Sep 17 00:00:00 2001 From: Sysix Date: Mon, 11 Nov 2024 15:01:16 +0100 Subject: [PATCH 09/12] ci: check code generation --- .github/workflows/generate.yml | 2 +- scripts/config-generator.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/generate.yml b/.github/workflows/generate.yml index f84351b..1d930de 100644 --- a/.github/workflows/generate.yml +++ b/.github/workflows/generate.yml @@ -26,4 +26,4 @@ jobs: run: pnpm run format - name: Check for git diff - run: git diff --exit-code --quiet + run: git diff --exit-code diff --git a/scripts/config-generator.ts b/scripts/config-generator.ts index 9c0d584..ab6acff 100644 --- a/scripts/config-generator.ts +++ b/scripts/config-generator.ts @@ -48,7 +48,7 @@ export class ConfigGenerator { const exportGrouping: string[] = []; let code = - '// These rules are automatically generated2 by scripts/generate-rules.ts\n\n'; + '// These rules are automatically generated by scripts/generate-rules.ts\n\n'; code += `import * as rules from "./rules-by-${this.rulesGrouping}.js";\n\n`; From 7dacb1823101759af1913d0a286ee23e99433132 Mon Sep 17 00:00:00 2001 From: Sysix Date: Mon, 11 Nov 2024 15:04:17 +0100 Subject: [PATCH 10/12] ci: check code generation --- .github/workflows/generate.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/generate.yml b/.github/workflows/generate.yml index 1d930de..7030b02 100644 --- a/.github/workflows/generate.yml +++ b/.github/workflows/generate.yml @@ -19,6 +19,9 @@ jobs: - name: Clone oxc_linter project run: pnpm run clone + - name: Remove current generated code + run: rm -r ./src/generated/ + - name: Generate from source code run: pnpm run generate From 70e706667b9f171b77fefe70b6dd6a38c75e6983 Mon Sep 17 00:00:00 2001 From: Sysix Date: Wed, 20 Nov 2024 21:38:18 +0100 Subject: [PATCH 11/12] build: add generate check in CI --- .github/workflows/generate.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/workflows/generate.yml b/.github/workflows/generate.yml index 7030b02..e1bb3bc 100644 --- a/.github/workflows/generate.yml +++ b/.github/workflows/generate.yml @@ -1,12 +1,21 @@ name: Code generation on: + workflow_dispatch: pull_request: types: [opened, synchronize] + paths: + - 'pnpm-lock.yaml' + - 'scripts/**' + - '.github/worfkflows/generate.yml' push: branches: - main - 'renovate/**' + paths: + - 'pnpm-lock.yaml' + - 'scripts/**' + - '.github/worfkflows/generate.yml' jobs: generate: From f7e4286102a0c3a3a7346715b5c22afa79b42fa4 Mon Sep 17 00:00:00 2001 From: Sysix Date: Wed, 20 Nov 2024 21:41:47 +0100 Subject: [PATCH 12/12] build: add generate check in CI --- .github/workflows/generate.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/generate.yml b/.github/workflows/generate.yml index e1bb3bc..bf52ff2 100644 --- a/.github/workflows/generate.yml +++ b/.github/workflows/generate.yml @@ -7,7 +7,7 @@ on: paths: - 'pnpm-lock.yaml' - 'scripts/**' - - '.github/worfkflows/generate.yml' + - '.github/workflows/generate.yml' push: branches: - main @@ -15,7 +15,7 @@ on: paths: - 'pnpm-lock.yaml' - 'scripts/**' - - '.github/worfkflows/generate.yml' + - '.github/workflows/generate.yml' jobs: generate: