diff --git a/.github/workflows/release_notes.yml b/.github/workflows/prepare_release.yml similarity index 67% rename from .github/workflows/release_notes.yml rename to .github/workflows/prepare_release.yml index 2c0acd9d..30cfd4c0 100644 --- a/.github/workflows/release_notes.yml +++ b/.github/workflows/prepare_release.yml @@ -1,12 +1,12 @@ -name: Release Notes Generator +name: Release Prep on: workflow_dispatch: inputs: branch: - description: 'Branch to merge release notes into.' + description: 'Branch to merge release notes and code analysis into.' required: true - default: 'main' + default: 'issue-421-prepare-release' version: description: 'Version to use for the release. Must be in format: X.Y.Z.' @@ -15,7 +15,7 @@ on: 'Date of the release. Must be in format YYYY-MM-DD.' jobs: - releasenotesgeneration: + preparerelease: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -28,6 +28,8 @@ jobs: run: | python -m pip install --upgrade pip python -m pip install requests==2.31.0 + python -m pip install bandit==1.7.7 + python -m pip install .[test] - name: Generate release notes env: @@ -37,16 +39,19 @@ jobs: -v ${{ inputs.version }} -d ${{ inputs.date }} + - name: Save static code analysis + run: bandit -r . -x ./tests,./scripts,./build -f txt -o static_code_analysis.txt --exit-zero + - name: Create pull request id: cpr uses: peter-evans/create-pull-request@v4 with: token: ${{ secrets.GH_ACCESS_TOKEN }} - commit-message: Release notes for v${{ inputs.version }} + commit-message: Prepare release for v${{ inputs.version }} author: "github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>" committer: "github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>" - title: v${{ inputs.version }} Release Notes - body: "This is an auto-generated PR to update the release notes." - branch: release-notes + title: v${{ inputs.version }} Release Preparation + body: "This is an auto-generated PR to prepare the release." + branch: prepared-release branch-suffix: short-commit-hash base: ${{ inputs.branch }} diff --git a/.github/workflows/static_code_analysis.yml b/.github/workflows/static_code_analysis.yml deleted file mode 100644 index 6bb8de34..00000000 --- a/.github/workflows/static_code_analysis.yml +++ /dev/null @@ -1,35 +0,0 @@ -name: Static Code Analysis - -on: - release: - types: [published] - workflow_dispatch: - -jobs: - code-analysis: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: Set up Python 3.10 - uses: actions/setup-python@v5 - with: - python-version: '3.10' - - name: Install dependencies - run: | - python -m pip install --upgrade pip - python -m pip install bandit==1.7.7 - - name: Save code analysis - run: bandit -r . -x ./tests -f txt -o static_code_analysis.txt --exit-zero - - name: Create pull request - id: cpr - uses: peter-evans/create-pull-request@v4 - with: - token: ${{ secrets.GH_ACCESS_TOKEN }} - commit-message: Update static code analysis - author: "github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>" - committer: "github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>" - title: Latest Code Analysis - body: "This is an auto-generated PR with the **latest** code analysis results." - branch: static-code-analysis - branch-suffix: short-commit-hash - base: main diff --git a/HISTORY.md b/HISTORY.md index ee1da1fa..71bc67d1 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -1,6 +1,12 @@ # History -### v0.10.2 - 2024-10-22 +### v0.10.3 - 2025-01-09 + +### Maintenance + +* Combine `static_code_analysis.yml` with `release_notes.yml` - Issue [#421](https://github.com/sdv-dev/CTGAN/issues/421) by @R-Palazzo + +## v0.10.2 - 2024-10-22 ### Bugs Fixed diff --git a/static_code_analysis.txt b/static_code_analysis.txt index f777fc28..d84ac42a 100644 --- a/static_code_analysis.txt +++ b/static_code_analysis.txt @@ -1,14 +1,14 @@ -Run started:2024-10-22 16:18:16.010383 +Run started:2025-01-09 11:06:33.730015 Test results: >> Issue: [B101:assert_used] Use of assert detected. The enclosed code will be removed when compiling to optimised byte code. Severity: Low Confidence: High CWE: CWE-703 (https://cwe.mitre.org/data/definitions/703.html) More Info: https://bandit.readthedocs.io/en/1.7.7/plugins/b101_assert_used.html - Location: ./ctgan/__main__.py:122:8 -121 if args.sample_condition_column is not None: -122 assert args.sample_condition_column_value is not None -123 + Location: ./ctgan/__main__.py:121:8 +120 if args.sample_condition_column is not None: +121 assert args.sample_condition_column_value is not None +122 -------------------------------------------------- >> Issue: [B101:assert_used] Use of assert detected. The enclosed code will be removed when compiling to optimised byte code. @@ -80,34 +80,22 @@ Test results: 100 assert st == recon_x.size()[1] 101 KLD = -0.5 * torch.sum(1 + logvar - mu**2 - logvar.exp()) --------------------------------------------------- ->> Issue: [B105:hardcoded_password_string] Possible hardcoded password: '# History - -' - Severity: Low Confidence: Medium - CWE: CWE-259 (https://cwe.mitre.org/data/definitions/259.html) - More Info: https://bandit.readthedocs.io/en/1.7.7/plugins/b105_hardcoded_password_string.html - Location: ./scripts/release_notes_generator.py:134:12 -133 -134 token = '# History\n\n' -135 split_index = history.find(token) + len(token) + 1 - -------------------------------------------------- Code scanned: - Total lines of code: 1508 + Total lines of code: 1387 Total lines skipped (#nosec): 0 Total potential issues skipped due to specifically being disabled (e.g., #nosec BXXX): 0 Run metrics: Total issues (by severity): Undefined: 0 - Low: 9 + Low: 8 Medium: 0 High: 0 Total issues (by confidence): Undefined: 0 Low: 0 - Medium: 1 + Medium: 0 High: 8 Files skipped (0):