From 68b7694f7771a2529c2575483981868631e333d5 Mon Sep 17 00:00:00 2001 From: Juarez Rudsatz Date: Thu, 14 Mar 2024 18:47:52 -0300 Subject: [PATCH 1/9] ci: add workflow_call to code analysis workflows --- .github/workflows/codacy-analysis.yml | 1 + .github/workflows/codeql-analysis.yml | 1 + 2 files changed, 2 insertions(+) diff --git a/.github/workflows/codacy-analysis.yml b/.github/workflows/codacy-analysis.yml index e408a6f2..bac088de 100644 --- a/.github/workflows/codacy-analysis.yml +++ b/.github/workflows/codacy-analysis.yml @@ -36,6 +36,7 @@ on: - info - warning - debug + workflow_call: permissions: contents: read diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index bc425d95..4973e32b 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -33,6 +33,7 @@ on: - info - warning - debug + workflow_call: jobs: analyze: From 44623b37fdccbfbe05a132b1835bb24e3e3adb3f Mon Sep 17 00:00:00 2001 From: Juarez Rudsatz Date: Thu, 14 Mar 2024 19:02:02 -0300 Subject: [PATCH 2/9] ci: misc change to trigger build --- .github/workflows/test-changes.yml | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/.github/workflows/test-changes.yml b/.github/workflows/test-changes.yml index 01439065..fda15bd8 100644 --- a/.github/workflows/test-changes.yml +++ b/.github/workflows/test-changes.yml @@ -7,7 +7,7 @@ on: push: branches: [ "master" ] pull_request: - types: [opened, reopened, synchronize, ready_for_review] # labeled + types: [opened, reopened, synchronize, ready_for_review] workflow_dispatch: inputs: logLevel: @@ -19,14 +19,6 @@ on: - info - warning - debug - # tags: - # description: 'Test scenario tags' - # required: false - # type: boolean - # environment: - # description: 'Environment to run tests against' - # type: environment - # required: true jobs: run-guard: From 8dd5e1d61ad3fcac8b3442cf85e4729c72004940 Mon Sep 17 00:00:00 2001 From: Juarez Rudsatz Date: Thu, 14 Mar 2024 19:11:26 -0300 Subject: [PATCH 3/9] ci: revert back trigger to code analysis workflows --- .github/workflows/codacy-analysis.yml | 20 ++++++++++---------- .github/workflows/codeql-analysis.yml | 19 ++++++++++--------- 2 files changed, 20 insertions(+), 19 deletions(-) diff --git a/.github/workflows/codacy-analysis.yml b/.github/workflows/codacy-analysis.yml index bac088de..546b2958 100644 --- a/.github/workflows/codacy-analysis.yml +++ b/.github/workflows/codacy-analysis.yml @@ -16,15 +16,16 @@ name: Codacy Security Scan on: schedule: - cron: '59 11 27 * *' - # push: - # branches: [ "master" ] - # pull_request: - # # The branches below must be a subset of the branches above - # branches: [ "master" ] - workflow_run: - workflows: [Test Changes] - types: - - completed + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + types: [opened, reopened, synchronize, ready_for_review] + # workflow_run: + # workflows: [Test Changes] + # types: + # - completed + workflow_call: workflow_dispatch: inputs: logLevel: @@ -36,7 +37,6 @@ on: - info - warning - debug - workflow_call: permissions: contents: read diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 4973e32b..090b900f 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -14,14 +14,16 @@ name: "CodeQL" on: schedule: - cron: '59 10 27 * *' - # push: - # branches: [ "master" ] - # pull_request: - # branches: [ "master" ] - workflow_run: - workflows: [Test Changes] - types: - - completed + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + types: [opened, reopened, synchronize, ready_for_review] +# workflow_run: + # workflows: [Test Changes] + # types: + # - completed + workflow_call: workflow_dispatch: inputs: logLevel: @@ -33,7 +35,6 @@ on: - info - warning - debug - workflow_call: jobs: analyze: From 641898d2e876dc800ebac3fe295318e142bb82e0 Mon Sep 17 00:00:00 2001 From: Juarez Rudsatz Date: Thu, 14 Mar 2024 19:12:05 -0300 Subject: [PATCH 4/9] ci: trigger workflow Test Changes only on master --- .github/workflows/test-changes.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test-changes.yml b/.github/workflows/test-changes.yml index fda15bd8..01954695 100644 --- a/.github/workflows/test-changes.yml +++ b/.github/workflows/test-changes.yml @@ -7,6 +7,7 @@ on: push: branches: [ "master" ] pull_request: + branches: [ "master" ] types: [opened, reopened, synchronize, ready_for_review] workflow_dispatch: inputs: From 6453683e78996d84c7d1fee732944be4fd926a34 Mon Sep 17 00:00:00 2001 From: Juarez Rudsatz Date: Thu, 14 Mar 2024 19:20:22 -0300 Subject: [PATCH 5/9] ci: trigger code analysis workflows by workflow_call of test-changes --- .github/workflows/codacy-analysis.yml | 10 +++++----- .github/workflows/codeql-analysis.yml | 10 +++++----- .github/workflows/test-changes.yml | 8 ++++++++ 3 files changed, 18 insertions(+), 10 deletions(-) diff --git a/.github/workflows/codacy-analysis.yml b/.github/workflows/codacy-analysis.yml index 546b2958..d1e612b0 100644 --- a/.github/workflows/codacy-analysis.yml +++ b/.github/workflows/codacy-analysis.yml @@ -16,11 +16,11 @@ name: Codacy Security Scan on: schedule: - cron: '59 11 27 * *' - push: - branches: [ "master" ] - pull_request: - branches: [ "master" ] - types: [opened, reopened, synchronize, ready_for_review] + # push: + # branches: [ "master" ] + # pull_request: + # branches: [ "master" ] + # types: [opened, reopened, synchronize, ready_for_review] # workflow_run: # workflows: [Test Changes] # types: diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 090b900f..2db3c985 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -14,11 +14,11 @@ name: "CodeQL" on: schedule: - cron: '59 10 27 * *' - push: - branches: [ "master" ] - pull_request: - branches: [ "master" ] - types: [opened, reopened, synchronize, ready_for_review] + # push: + # branches: [ "master" ] + # pull_request: + # branches: [ "master" ] + # types: [opened, reopened, synchronize, ready_for_review] # workflow_run: # workflows: [Test Changes] # types: diff --git a/.github/workflows/test-changes.yml b/.github/workflows/test-changes.yml index 01954695..a82f96ad 100644 --- a/.github/workflows/test-changes.yml +++ b/.github/workflows/test-changes.yml @@ -201,3 +201,11 @@ jobs: run: | cd docs sphinx-build -W -b singlehtml -d ../build/doctrees . ../build/singlehtml + + call-workflow-codeql: + needs: test-source-code + uses: ./.github/workflows/codeql-analysis.yml + + call-workflow-codacity: + needs: test-source-code + uses: ./.github/workflows/codacy-analysis.yml From 18b25b7ebd2ba6621a82f807a3224184b5431df3 Mon Sep 17 00:00:00 2001 From: Juarez Rudsatz Date: Thu, 14 Mar 2024 19:40:38 -0300 Subject: [PATCH 6/9] ci: fix workflow_call of test-changes --- .github/workflows/test-changes.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-changes.yml b/.github/workflows/test-changes.yml index a82f96ad..29f07e0d 100644 --- a/.github/workflows/test-changes.yml +++ b/.github/workflows/test-changes.yml @@ -204,8 +204,9 @@ jobs: call-workflow-codeql: needs: test-source-code - uses: ./.github/workflows/codeql-analysis.yml + uses: ./.github/workflows/codeql-analysis.yml@master call-workflow-codacity: needs: test-source-code - uses: ./.github/workflows/codacy-analysis.yml + uses: ./.github/workflows/codacy-analysis.yml@master + From 3ed6dbe5ae4399756ed6ff817d0ae56fd0b2944e Mon Sep 17 00:00:00 2001 From: Juarez Rudsatz Date: Thu, 14 Mar 2024 19:41:13 -0300 Subject: [PATCH 7/9] fix: fix python syntax on issue_219.py --- examples/notes/issue_219.py | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/examples/notes/issue_219.py b/examples/notes/issue_219.py index 48b94f4a..4b612160 100644 --- a/examples/notes/issue_219.py +++ b/examples/notes/issue_219.py @@ -11,21 +11,20 @@ # -import sys -sys.path.insert(0, '../src') -import petl; print petl.VERSION -from petl.fluent import etl -import psycopg2 import MySQLdb +import psycopg2 -# +import petl +from petl.fluent import etl +# +print(petl.VERSION) tbl_dummy_data = etl().dummytable(100000) tbl_dummy_data.look() # -print tbl_dummy_data.nrows() +print(tbl_dummy_data.nrows()) # @@ -48,12 +47,12 @@ # # memory usage using default cursor -print etl.fromdb(psql_connection, 'select * from issue_219 order by foo').look(2) +print(etl.fromdb(psql_connection, 'select * from issue_219 order by foo').look(2)) # # memory usage using server-side cursor -print etl.fromdb(lambda: psql_connection.cursor(name='server-side'), 'select * from issue_219 order by foo').look(2) +print(etl.fromdb(lambda: psql_connection.cursor(name='server-side'), 'select * from issue_219 order by foo').look(2)) # @@ -77,10 +76,10 @@ # # memory usage with default cursor -print etl.fromdb(mysql_connection, 'select * from issue_219 order by foo').look(2) +print(etl.fromdb(mysql_connection, 'select * from issue_219 order by foo').look(2)) # # memory usage with server-side cursor -print etl.fromdb(lambda: mysql_connection.cursor(MySQLdb.cursors.SSCursor), 'select * from issue_219 order by foo').look(2) +print(etl.fromdb(lambda: mysql_connection.cursor(MySQLdb.cursors.SSCursor), 'select * from issue_219 order by foo').look(2)) From 84e28f2230ff34db3159a5d64396cb2b978e296d Mon Sep 17 00:00:00 2001 From: Juarez Rudsatz Date: Thu, 14 Mar 2024 19:47:10 -0300 Subject: [PATCH 8/9] ci: set permissions for nested workflows --- .github/workflows/test-changes.yml | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-changes.yml b/.github/workflows/test-changes.yml index 29f07e0d..baea6c53 100644 --- a/.github/workflows/test-changes.yml +++ b/.github/workflows/test-changes.yml @@ -204,9 +204,19 @@ jobs: call-workflow-codeql: needs: test-source-code - uses: ./.github/workflows/codeql-analysis.yml@master + uses: ./.github/workflows/codeql-analysis.yml + permissions: + actions: read + contents: read + pull-requests: write + security-events: write call-workflow-codacity: needs: test-source-code - uses: ./.github/workflows/codacy-analysis.yml@master + uses: ./.github/workflows/codacy-analysis.yml + permissions: + actions: read + contents: read + pull-requests: write + security-events: write From 23de056b390f9caf2646a41fd4baacf96dd53459 Mon Sep 17 00:00:00 2001 From: Juarez Rudsatz Date: Thu, 14 Mar 2024 20:04:14 -0300 Subject: [PATCH 9/9] ci: use pull_request as trigger to code analysis workflows --- .github/workflows/codacy-analysis.yml | 10 ++++---- .github/workflows/codeql-analysis.yml | 10 ++++---- .github/workflows/test-changes.yml | 37 +++++++++++++++------------ 3 files changed, 30 insertions(+), 27 deletions(-) diff --git a/.github/workflows/codacy-analysis.yml b/.github/workflows/codacy-analysis.yml index d1e612b0..546b2958 100644 --- a/.github/workflows/codacy-analysis.yml +++ b/.github/workflows/codacy-analysis.yml @@ -16,11 +16,11 @@ name: Codacy Security Scan on: schedule: - cron: '59 11 27 * *' - # push: - # branches: [ "master" ] - # pull_request: - # branches: [ "master" ] - # types: [opened, reopened, synchronize, ready_for_review] + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + types: [opened, reopened, synchronize, ready_for_review] # workflow_run: # workflows: [Test Changes] # types: diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 2db3c985..090b900f 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -14,11 +14,11 @@ name: "CodeQL" on: schedule: - cron: '59 10 27 * *' - # push: - # branches: [ "master" ] - # pull_request: - # branches: [ "master" ] - # types: [opened, reopened, synchronize, ready_for_review] + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + types: [opened, reopened, synchronize, ready_for_review] # workflow_run: # workflows: [Test Changes] # types: diff --git a/.github/workflows/test-changes.yml b/.github/workflows/test-changes.yml index baea6c53..2a3bfa82 100644 --- a/.github/workflows/test-changes.yml +++ b/.github/workflows/test-changes.yml @@ -202,21 +202,24 @@ jobs: cd docs sphinx-build -W -b singlehtml -d ../build/doctrees . ../build/singlehtml - call-workflow-codeql: - needs: test-source-code - uses: ./.github/workflows/codeql-analysis.yml - permissions: - actions: read - contents: read - pull-requests: write - security-events: write - - call-workflow-codacity: - needs: test-source-code - uses: ./.github/workflows/codacy-analysis.yml - permissions: - actions: read - contents: read - pull-requests: write - security-events: write + # TODO: 1 configuration not found: https://docs.github.com/en/actions/using-workflows/reusing-workflows#overview + # call-workflow-codeql: + # needs: test-source-code + # uses: ./.github/workflows/codeql-analysis.yml + # permissions: + # actions: read + # contents: read + # pull-requests: write + # security-events: write + # secrets: inherit # pass all secrets + + # call-workflow-codacity: + # needs: test-source-code + # uses: ./.github/workflows/codacy-analysis.yml + # permissions: + # actions: read + # contents: read + # pull-requests: write + # security-events: write + # secrets: inherit # pass all secrets