From 2bfda1271bcdbe13e823579fc406f3eaa229573b Mon Sep 17 00:00:00 2001 From: rockerBOO Date: Mon, 19 May 2025 20:25:42 -0400 Subject: [PATCH 1/2] Update workflows to read-all instead of write-all --- .github/workflows/tests.yml | 5 ++++- .github/workflows/typos.yml | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 2eddedc7..9e037e53 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -12,6 +12,9 @@ on: - dev - sd3 +# CKV2_GHA_1: "Ensure top-level permissions are not set to write-all" +permissions: read-all + jobs: build: runs-on: ${{ matrix.os }} @@ -40,7 +43,7 @@ jobs: - name: Install dependencies run: | # Pre-install torch to pin version (requirements.txt has dependencies like transformers which requires pytorch) - pip install dadaptation==3.2 torch==${{ matrix.pytorch-version }} torchvision==0.19.0 pytest==8.3.4 + pip install dadaptation==3.2 torch==${{ matrix.pytorch-version }} torchvision pytest==8.3.4 pip install -r requirements.txt - name: Test with pytest diff --git a/.github/workflows/typos.yml b/.github/workflows/typos.yml index f53cda21..b9d6acc9 100644 --- a/.github/workflows/typos.yml +++ b/.github/workflows/typos.yml @@ -12,6 +12,9 @@ on: - synchronize - reopened +# CKV2_GHA_1: "Ensure top-level permissions are not set to write-all" +permissions: read-all + jobs: build: runs-on: ubuntu-latest From e4d6923409e6406436a4e9f98ae3f74a07a8dd8d Mon Sep 17 00:00:00 2001 From: rockerBOO Date: Tue, 3 Jun 2025 16:12:02 -0400 Subject: [PATCH 2/2] Add tests for syntax checking training scripts --- tests/test_fine_tune.py | 6 ++++++ tests/test_flux_train.py | 6 ++++++ tests/test_flux_train_network.py | 5 +++++ tests/test_sd3_train.py | 6 ++++++ tests/test_sd3_train_network.py | 5 +++++ tests/test_sdxl_train.py | 6 ++++++ tests/test_sdxl_train_network.py | 6 ++++++ tests/test_train.py | 6 ++++++ tests/test_train_network.py | 5 +++++ tests/test_train_textual_inversion.py | 5 +++++ 10 files changed, 56 insertions(+) create mode 100644 tests/test_fine_tune.py create mode 100644 tests/test_flux_train.py create mode 100644 tests/test_flux_train_network.py create mode 100644 tests/test_sd3_train.py create mode 100644 tests/test_sd3_train_network.py create mode 100644 tests/test_sdxl_train.py create mode 100644 tests/test_sdxl_train_network.py create mode 100644 tests/test_train.py create mode 100644 tests/test_train_network.py create mode 100644 tests/test_train_textual_inversion.py diff --git a/tests/test_fine_tune.py b/tests/test_fine_tune.py new file mode 100644 index 00000000..fd39ce61 --- /dev/null +++ b/tests/test_fine_tune.py @@ -0,0 +1,6 @@ +import fine_tune + + +def test_syntax(): + # Very simply testing that the train_network imports without syntax errors + assert True diff --git a/tests/test_flux_train.py b/tests/test_flux_train.py new file mode 100644 index 00000000..2b8739cf --- /dev/null +++ b/tests/test_flux_train.py @@ -0,0 +1,6 @@ +import flux_train + + +def test_syntax(): + # Very simply testing that the train_network imports without syntax errors + assert True diff --git a/tests/test_flux_train_network.py b/tests/test_flux_train_network.py new file mode 100644 index 00000000..aaff8962 --- /dev/null +++ b/tests/test_flux_train_network.py @@ -0,0 +1,5 @@ +import flux_train_network + +def test_syntax(): + # Very simply testing that the flux_train_network imports without syntax errors + assert True diff --git a/tests/test_sd3_train.py b/tests/test_sd3_train.py new file mode 100644 index 00000000..a7c5d27a --- /dev/null +++ b/tests/test_sd3_train.py @@ -0,0 +1,6 @@ +import sd3_train + + +def test_syntax(): + # Very simply testing that the train_network imports without syntax errors + assert True diff --git a/tests/test_sd3_train_network.py b/tests/test_sd3_train_network.py new file mode 100644 index 00000000..10c0795c --- /dev/null +++ b/tests/test_sd3_train_network.py @@ -0,0 +1,5 @@ +import sd3_train_network + +def test_syntax(): + # Very simply testing that the flux_train_network imports without syntax errors + assert True diff --git a/tests/test_sdxl_train.py b/tests/test_sdxl_train.py new file mode 100644 index 00000000..1c0e8579 --- /dev/null +++ b/tests/test_sdxl_train.py @@ -0,0 +1,6 @@ +import sdxl_train + + +def test_syntax(): + # Very simply testing that the train_network imports without syntax errors + assert True diff --git a/tests/test_sdxl_train_network.py b/tests/test_sdxl_train_network.py new file mode 100644 index 00000000..58300ae7 --- /dev/null +++ b/tests/test_sdxl_train_network.py @@ -0,0 +1,6 @@ +import sdxl_train_network + + +def test_syntax(): + # Very simply testing that the train_network imports without syntax errors + assert True diff --git a/tests/test_train.py b/tests/test_train.py new file mode 100644 index 00000000..51c79492 --- /dev/null +++ b/tests/test_train.py @@ -0,0 +1,6 @@ +import train_db + + +def test_syntax(): + # Very simply testing that the train_network imports without syntax errors + assert True diff --git a/tests/test_train_network.py b/tests/test_train_network.py new file mode 100644 index 00000000..fe17263c --- /dev/null +++ b/tests/test_train_network.py @@ -0,0 +1,5 @@ +import train_network + +def test_syntax(): + # Very simply testing that the train_network imports without syntax errors + assert True diff --git a/tests/test_train_textual_inversion.py b/tests/test_train_textual_inversion.py new file mode 100644 index 00000000..ab6a9342 --- /dev/null +++ b/tests/test_train_textual_inversion.py @@ -0,0 +1,5 @@ +import train_textual_inversion + +def test_syntax(): + # Very simply testing that the train_network imports without syntax errors + assert True