From d3d88dfb75d56dcaa1cb2ceb61f64fcbeddea290 Mon Sep 17 00:00:00 2001 From: Oscar Salazar Date: Mon, 17 Jun 2024 08:43:40 -0600 Subject: [PATCH 01/69] Create python-app.yml --- .github/workflows/python-app.yml | 39 ++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 .github/workflows/python-app.yml diff --git a/.github/workflows/python-app.yml b/.github/workflows/python-app.yml new file mode 100644 index 0000000..1b2c1d1 --- /dev/null +++ b/.github/workflows/python-app.yml @@ -0,0 +1,39 @@ +# This workflow will install Python dependencies, run tests and lint with a single version of Python +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python + +name: Python application + +on: + push: + branches: [ GITHUB_REF ] + pull_request: + branches: [ GITHUB_HEAD_REF ] + +permissions: + contents: read + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - name: Set up Python 3.10 + uses: actions/setup-python@v3 + with: + python-version: "3.10" + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install flake8 pytest + if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + - name: Lint with flake8 + run: | + # stop the build if there are Python syntax errors or undefined names + flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics + # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide + flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics + - name: Test with pytest + run: | + pytest From 97ea1672a9947f33c5a8955e51cf13d69078b8fd Mon Sep 17 00:00:00 2001 From: Oscar Salazar Date: Mon, 17 Jun 2024 08:49:47 -0600 Subject: [PATCH 02/69] change yml name --- .github/workflows/{python-app.yml => ci.yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{python-app.yml => ci.yml} (100%) diff --git a/.github/workflows/python-app.yml b/.github/workflows/ci.yml similarity index 100% rename from .github/workflows/python-app.yml rename to .github/workflows/ci.yml From 8de4c428a997f7e71fb8e49357ad7ece5167c72c Mon Sep 17 00:00:00 2001 From: Oscar Salazar Date: Mon, 17 Jun 2024 08:59:49 -0600 Subject: [PATCH 03/69] Update ci.yml --- .github/workflows/ci.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1b2c1d1..41f14fa 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,13 +7,17 @@ on: push: branches: [ GITHUB_REF ] pull_request: - branches: [ GITHUB_HEAD_REF ] + types: + - opened + - edited + - labeled + - unlabeled permissions: contents: read jobs: - build: + Audit-Pull-Request: runs-on: ubuntu-latest From a2c979801e7a7dc5f386c0c2e582855210eabdc4 Mon Sep 17 00:00:00 2001 From: Oscar Salazar Date: Mon, 17 Jun 2024 09:38:55 -0600 Subject: [PATCH 04/69] Update ci.yml --- .github/workflows/ci.yml | 45 ++++++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 23 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 41f14fa..db9edfb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,7 +1,7 @@ # This workflow will install Python dependencies, run tests and lint with a single version of Python # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python -name: Python application +name: native-app-examples on: push: @@ -17,27 +17,26 @@ permissions: contents: read jobs: - Audit-Pull-Request: - + audit-mailorder: runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: Set up Python 3.10 - uses: actions/setup-python@v3 - with: - python-version: "3.10" - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install flake8 pytest - if [ -f requirements.txt ]; then pip install -r requirements.txt; fi - - name: Lint with flake8 - run: | - # stop the build if there are Python syntax errors or undefined names - flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics - # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide - flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics - - name: Test with pytest - run: | - pytest + - uses: actions/checkout@v4 + - name: Set up Python 3.10 + uses: actions/setup-python@v3 + with: + python-version: "3.10" + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install flake8 pytest + if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + - name: Lint with flake8 + run: | + # stop the build if there are Python syntax errors or undefined names + flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics + # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide + flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics + - name: Test with pytest + run: | + pytest + \ No newline at end of file From f93389016053b7dae2521bafb8c71394ec68b047 Mon Sep 17 00:00:00 2001 From: Oscar Salazar Date: Mon, 17 Jun 2024 09:59:16 -0600 Subject: [PATCH 05/69] Update ci.yml --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index db9edfb..99b1a25 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,7 +17,7 @@ permissions: contents: read jobs: - audit-mailorder: + Audit-Pull-Request: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 From e2c6f1e63e72746670e4306d801899cb202db3d4 Mon Sep 17 00:00:00 2001 From: Oscar Salazar Date: Mon, 17 Jun 2024 10:03:58 -0600 Subject: [PATCH 06/69] Update ci.yml --- .github/workflows/ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 99b1a25..adf75ba 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,12 +12,13 @@ on: - edited - labeled - unlabeled + - synchronize permissions: contents: read jobs: - Audit-Pull-Request: + audit-mailorder: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 From 069f8c13c341da45bab10ad11d818b819e3ffcc3 Mon Sep 17 00:00:00 2001 From: Oscar Salazar Date: Mon, 17 Jun 2024 10:28:13 -0600 Subject: [PATCH 07/69] Update ci.yml --- .github/workflows/ci.yml | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index adf75ba..aed4e19 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -26,18 +26,13 @@ jobs: uses: actions/setup-python@v3 with: python-version: "3.10" - - name: Install dependencies + - name: Setup testing environment + working-directory: ./native-apps-examples/mailorder run: | - python -m pip install --upgrade pip - pip install flake8 pytest - if [ -f requirements.txt ]; then pip install -r requirements.txt; fi - - name: Lint with flake8 - run: | - # stop the build if there are Python syntax errors or undefined names - flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics - # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide - flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics - - name: Test with pytest + conda env update -f local_test_env.yml + conda activate mailorder-testing + - name: Run tests + working-directory: ./native-apps-examples/mailorder run: | pytest \ No newline at end of file From 24bdb0b01b7061f13a4f36fed70179b3bad3f0a8 Mon Sep 17 00:00:00 2001 From: Oscar Salazar Date: Mon, 17 Jun 2024 10:31:19 -0600 Subject: [PATCH 08/69] Update ci.yml --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index aed4e19..3aefe5d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,7 +27,7 @@ jobs: with: python-version: "3.10" - name: Setup testing environment - working-directory: ./native-apps-examples/mailorder + working-directory: mailorder run: | conda env update -f local_test_env.yml conda activate mailorder-testing From e9a44b872de232212d533fc8cc76abe2879bf2e4 Mon Sep 17 00:00:00 2001 From: Oscar Salazar Date: Mon, 17 Jun 2024 10:33:54 -0600 Subject: [PATCH 09/69] Update ci.yml --- .github/workflows/ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3aefe5d..520b782 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -30,9 +30,10 @@ jobs: working-directory: mailorder run: | conda env update -f local_test_env.yml + conda init conda activate mailorder-testing - name: Run tests - working-directory: ./native-apps-examples/mailorder + working-directory: mailorder run: | pytest \ No newline at end of file From 74533cfb6a3a5b2fb2da3baf144e9696740ea42d Mon Sep 17 00:00:00 2001 From: Oscar Salazar Date: Mon, 17 Jun 2024 10:36:48 -0600 Subject: [PATCH 10/69] Update ci.yml --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 520b782..622ce28 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -29,8 +29,8 @@ jobs: - name: Setup testing environment working-directory: mailorder run: | - conda env update -f local_test_env.yml conda init + conda env update -f local_test_env.yml conda activate mailorder-testing - name: Run tests working-directory: mailorder From ff8b032a770a864f75e5eba355b0cf103e94b96c Mon Sep 17 00:00:00 2001 From: Oscar Salazar Date: Mon, 17 Jun 2024 10:40:27 -0600 Subject: [PATCH 11/69] Update ci.yml --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 622ce28..e3052ab 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -29,7 +29,7 @@ jobs: - name: Setup testing environment working-directory: mailorder run: | - conda init + conda init zsh conda env update -f local_test_env.yml conda activate mailorder-testing - name: Run tests From dd87a03bea7e684a6e065ef417fda631543ae889 Mon Sep 17 00:00:00 2001 From: Oscar Salazar Date: Mon, 17 Jun 2024 10:43:22 -0600 Subject: [PATCH 12/69] Update ci.yml --- .github/workflows/ci.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e3052ab..1e0950f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,6 +18,13 @@ permissions: contents: read jobs: + setup-conda-env: + runs-on: ubuntu-latest + steps: + - name: Setup conda environment + run: | + conda init zsh + audit-mailorder: runs-on: ubuntu-latest steps: From 40bac16393d85bf9890bfcd63d3ce018c209ad66 Mon Sep 17 00:00:00 2001 From: Oscar Salazar Date: Mon, 17 Jun 2024 10:50:57 -0600 Subject: [PATCH 13/69] Update ci.yml --- .github/workflows/ci.yml | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1e0950f..ddaa589 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,14 +17,7 @@ on: permissions: contents: read -jobs: - setup-conda-env: - runs-on: ubuntu-latest - steps: - - name: Setup conda environment - run: | - conda init zsh - +jobs: audit-mailorder: runs-on: ubuntu-latest steps: @@ -33,12 +26,14 @@ jobs: uses: actions/setup-python@v3 with: python-version: "3.10" - - name: Setup testing environment - working-directory: mailorder - run: | - conda init zsh - conda env update -f local_test_env.yml - conda activate mailorder-testing + - uses: conda-incubator/setup-miniconda@v2 + with: + activate-environment: mailorder-testing + environment-file: mailorder/local_test_env.yml + auto-activate-base: true + - run: | + conda info + conda list - name: Run tests working-directory: mailorder run: | From bb247a3679fa1410cf584a4d9296724b581ecf04 Mon Sep 17 00:00:00 2001 From: Oscar Salazar Date: Mon, 17 Jun 2024 10:53:44 -0600 Subject: [PATCH 14/69] Update ci.yml --- .github/workflows/ci.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ddaa589..bfa2efe 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -31,11 +31,8 @@ jobs: activate-environment: mailorder-testing environment-file: mailorder/local_test_env.yml auto-activate-base: true - - run: | - conda info - conda list - name: Run tests working-directory: mailorder run: | - pytest + python -m pytest \ No newline at end of file From b49be4b343b1bb6506cf495e56dbebf2a72a15da Mon Sep 17 00:00:00 2001 From: Oscar Salazar Date: Mon, 17 Jun 2024 10:55:53 -0600 Subject: [PATCH 15/69] Update ci.yml --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bfa2efe..364914b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -30,7 +30,7 @@ jobs: with: activate-environment: mailorder-testing environment-file: mailorder/local_test_env.yml - auto-activate-base: true + auto-activate-base: false - name: Run tests working-directory: mailorder run: | From 931c61936c6636f376a3d9c148368f1e058ee2ff Mon Sep 17 00:00:00 2001 From: Oscar Salazar Date: Mon, 17 Jun 2024 11:03:04 -0600 Subject: [PATCH 16/69] Update ci.yml --- .github/workflows/ci.yml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 364914b..4ae3327 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -26,13 +26,12 @@ jobs: uses: actions/setup-python@v3 with: python-version: "3.10" - - uses: conda-incubator/setup-miniconda@v2 + - name: Run tests + uses: conda-incubator/setup-miniconda@v2 with: activate-environment: mailorder-testing environment-file: mailorder/local_test_env.yml auto-activate-base: false - - name: Run tests - working-directory: mailorder - run: | - python -m pytest + run: | + pytest \ No newline at end of file From ada646ba1536db7a5668468fc23af5476073dbca Mon Sep 17 00:00:00 2001 From: Oscar Salazar Date: Mon, 17 Jun 2024 11:05:17 -0600 Subject: [PATCH 17/69] Update ci.yml --- .github/workflows/ci.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4ae3327..b7a7d85 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -26,12 +26,17 @@ jobs: uses: actions/setup-python@v3 with: python-version: "3.10" - - name: Run tests + - name: Setup test environment uses: conda-incubator/setup-miniconda@v2 with: activate-environment: mailorder-testing environment-file: mailorder/local_test_env.yml auto-activate-base: false run: | - pytest + pip install pytest + - name: Run tests + working-directory: mailorder + run: | + pip install pytest + pytest \ No newline at end of file From 49573ae86f82018b602eee12f4053c643c1542a3 Mon Sep 17 00:00:00 2001 From: Oscar Salazar Date: Mon, 17 Jun 2024 11:14:18 -0600 Subject: [PATCH 18/69] Update ci.yml --- .github/workflows/ci.yml | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b7a7d85..39de695 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,8 +18,16 @@ permissions: contents: read jobs: - audit-mailorder: + build-mailorder: runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + include: + - environment-file: mailorder/local_test_env.yml + defaults: + run: + shell: bash -l {0} steps: - uses: actions/checkout@v4 - name: Set up Python 3.10 @@ -31,12 +39,12 @@ jobs: with: activate-environment: mailorder-testing environment-file: mailorder/local_test_env.yml - auto-activate-base: false - run: | - pip install pytest + - name: Install dependencies + run: | + python -m pip install . + python -m pip install pytest - name: Run tests working-directory: mailorder run: | - pip install pytest pytest \ No newline at end of file From e2cd7f5e077cf5b5655371388b178f0db859e72f Mon Sep 17 00:00:00 2001 From: Oscar Salazar Date: Mon, 17 Jun 2024 11:17:08 -0600 Subject: [PATCH 19/69] Update ci.yml --- .github/workflows/ci.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 39de695..00b7e22 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -41,7 +41,6 @@ jobs: environment-file: mailorder/local_test_env.yml - name: Install dependencies run: | - python -m pip install . python -m pip install pytest - name: Run tests working-directory: mailorder From 68abfa9891b93f6c6d05a94c552c61fcbdf31a4f Mon Sep 17 00:00:00 2001 From: Oscar Salazar Date: Mon, 17 Jun 2024 11:26:09 -0600 Subject: [PATCH 20/69] Update ci.yml --- .github/workflows/ci.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 00b7e22..372e145 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,7 +21,6 @@ jobs: build-mailorder: runs-on: ubuntu-latest strategy: - fail-fast: false matrix: include: - environment-file: mailorder/local_test_env.yml @@ -37,8 +36,7 @@ jobs: - name: Setup test environment uses: conda-incubator/setup-miniconda@v2 with: - activate-environment: mailorder-testing - environment-file: mailorder/local_test_env.yml + environment-file: ${{ matrix.environment-file }} - name: Install dependencies run: | python -m pip install pytest From ef65f6e3c9e079b1155076b222e3f403d86986d0 Mon Sep 17 00:00:00 2001 From: Oscar Salazar Date: Mon, 17 Jun 2024 11:44:32 -0600 Subject: [PATCH 21/69] Update ci.yml --- .github/workflows/ci.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 372e145..8337a67 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,11 +1,6 @@ -# This workflow will install Python dependencies, run tests and lint with a single version of Python -# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python - name: native-app-examples on: - push: - branches: [ GITHUB_REF ] pull_request: types: - opened From b83eb70d7973bd50233e3cd3408f6c2957c54c22 Mon Sep 17 00:00:00 2001 From: Oscar Salazar Date: Mon, 17 Jun 2024 16:28:51 -0600 Subject: [PATCH 22/69] add changed files to the pipeline --- .github/workflows/ci.yml | 16 ++++++++++++++-- local_test_env.yml | 15 +++++++++++++++ mailorder/app/data/customers.sql | 1 + 3 files changed, 30 insertions(+), 2 deletions(-) create mode 100644 local_test_env.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8337a67..cb4027b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,7 +18,7 @@ jobs: strategy: matrix: include: - - environment-file: mailorder/local_test_env.yml + - environment-file: local_test_env.yml defaults: run: shell: bash -l {0} @@ -32,11 +32,23 @@ jobs: uses: conda-incubator/setup-miniconda@v2 with: environment-file: ${{ matrix.environment-file }} + - name: Get changes + id: changed-files + run: | + if ${{ github.event_name == 'pull_request' }}; then + echo "changed_files=$(git diff --name-only -r HEAD^1 HEAD | xargs)" >> $GITHUB_OUTPUT + else + echo "changed_files=$(git diff --name-only ${{ github.event.before }} ${{ github.event.after }} | xargs)" >> $GITHUB_OUTPUT + fi + - name: List changed files + run: | + for file in ${{ steps.changed-files.outputs.changed_files }}; do + echo "$(dirname "${file}")" + done - name: Install dependencies run: | python -m pip install pytest - name: Run tests - working-directory: mailorder run: | pytest \ No newline at end of file diff --git a/local_test_env.yml b/local_test_env.yml new file mode 100644 index 0000000..4de72b7 --- /dev/null +++ b/local_test_env.yml @@ -0,0 +1,15 @@ +# This file is used to install packages for local testing +name: native-apps-examples-testing +channels: + - snowflake +dependencies: + - python=3.8 + - pip + - pip: + - git+https://github.com/snowflakedb/snowflake-telemetry-python.git + - snowflake-native-apps-permission-stub + - snowflake-snowpark-python>=1.15.0 + - snowflake-cli-labs>=2.0.0 + - pytest + - streamlit>=1.26.0 + diff --git a/mailorder/app/data/customers.sql b/mailorder/app/data/customers.sql index ca49207..920c4e5 100644 --- a/mailorder/app/data/customers.sql +++ b/mailorder/app/data/customers.sql @@ -7,3 +7,4 @@ create table if not exists grant select on data.customers to application role app_csr; grant select, insert, update, delete, truncate on data.customers to application role app_admin; + From 5e6872e6b92249056f48f75ae0756492c8adb6c2 Mon Sep 17 00:00:00 2001 From: Oscar Salazar Date: Mon, 17 Jun 2024 16:36:32 -0600 Subject: [PATCH 23/69] Update ci.yml --- .github/workflows/ci.yml | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cb4027b..12d2647 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -34,17 +34,13 @@ jobs: environment-file: ${{ matrix.environment-file }} - name: Get changes id: changed-files - run: | - if ${{ github.event_name == 'pull_request' }}; then - echo "changed_files=$(git diff --name-only -r HEAD^1 HEAD | xargs)" >> $GITHUB_OUTPUT - else - echo "changed_files=$(git diff --name-only ${{ github.event.before }} ${{ github.event.after }} | xargs)" >> $GITHUB_OUTPUT - fi + uses: jitterbit/get-changed-files@v1 - name: List changed files run: | - for file in ${{ steps.changed-files.outputs.changed_files }}; do - echo "$(dirname "${file}")" - done + for changed_file in ${{ steps.changed-files.outputs.all }}; do + DIR="$(dirname "${changed_file}")" + echo "Do something with this ${DIR}." + done - name: Install dependencies run: | python -m pip install pytest From ac8aacca2341cc42c94010d92635efb6aa031cfe Mon Sep 17 00:00:00 2001 From: Oscar Salazar Date: Mon, 17 Jun 2024 16:43:26 -0600 Subject: [PATCH 24/69] Update ci.yml --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 12d2647..8afe925 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -34,10 +34,10 @@ jobs: environment-file: ${{ matrix.environment-file }} - name: Get changes id: changed-files - uses: jitterbit/get-changed-files@v1 + uses: tj-actions/changed-files@v44 - name: List changed files run: | - for changed_file in ${{ steps.changed-files.outputs.all }}; do + for changed_file in ${{ steps.changed-files.outputs.all_changed_files }}; do DIR="$(dirname "${changed_file}")" echo "Do something with this ${DIR}." done From f342d8f5f7f68f974d52c7f795c3bf7ddfa6686f Mon Sep 17 00:00:00 2001 From: Oscar Salazar Date: Mon, 17 Jun 2024 16:51:00 -0600 Subject: [PATCH 25/69] Update ci.yml --- .github/workflows/ci.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8afe925..b42bd4a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -24,6 +24,8 @@ jobs: shell: bash -l {0} steps: - uses: actions/checkout@v4 + with: + fetch-depth: ${{ github.event_name == 'pull_request' && 2 || 0 }} - name: Set up Python 3.10 uses: actions/setup-python@v3 with: @@ -34,7 +36,12 @@ jobs: environment-file: ${{ matrix.environment-file }} - name: Get changes id: changed-files - uses: tj-actions/changed-files@v44 + run: | + if ${{ github.event_name == 'pull_request' }}; then + echo "changed_files=$(git diff --name-only -r HEAD^1 HEAD | xargs)" >> $GITHUB_OUTPUT + else + echo "changed_files=$(git diff --name-only ${{ github.event.before }} ${{ github.event.after }} | xargs)" >> $GITHUB_OUTPUT + fi - name: List changed files run: | for changed_file in ${{ steps.changed-files.outputs.all_changed_files }}; do From ec550f6b6634e2e2806bb1a1aaa21067a5ada03c Mon Sep 17 00:00:00 2001 From: Oscar Salazar Date: Mon, 17 Jun 2024 16:53:50 -0600 Subject: [PATCH 26/69] Update ci.yml --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b42bd4a..9d5499b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -44,7 +44,7 @@ jobs: fi - name: List changed files run: | - for changed_file in ${{ steps.changed-files.outputs.all_changed_files }}; do + for changed_file in ${{ steps.changed-files.outputs.changed_files }}; do DIR="$(dirname "${changed_file}")" echo "Do something with this ${DIR}." done From 09118f5f7533345d5a3ca5e7e7f5b060417aa313 Mon Sep 17 00:00:00 2001 From: Oscar Salazar Date: Mon, 17 Jun 2024 17:04:19 -0600 Subject: [PATCH 27/69] Update ci.yml --- .github/workflows/ci.yml | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9d5499b..3454cb6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -30,24 +30,24 @@ jobs: uses: actions/setup-python@v3 with: python-version: "3.10" - - name: Setup test environment - uses: conda-incubator/setup-miniconda@v2 - with: - environment-file: ${{ matrix.environment-file }} - name: Get changes id: changed-files run: | - if ${{ github.event_name == 'pull_request' }}; then - echo "changed_files=$(git diff --name-only -r HEAD^1 HEAD | xargs)" >> $GITHUB_OUTPUT - else - echo "changed_files=$(git diff --name-only ${{ github.event.before }} ${{ github.event.after }} | xargs)" >> $GITHUB_OUTPUT - fi + if ${{ github.event_name == 'pull_request' }}; then + echo "changed_files=$(git diff --name-only -r HEAD^1 HEAD | xargs)" >> $GITHUB_OUTPUT + else + echo "changed_files=$(git diff --name-only ${{ github.event.before }} ${{ github.event.after }} | xargs)" >> $GITHUB_OUTPUT + fi - name: List changed files run: | - for changed_file in ${{ steps.changed-files.outputs.changed_files }}; do - DIR="$(dirname "${changed_file}")" - echo "Do something with this ${DIR}." - done + for changed_file in ${{ steps.changed-files.outputs.changed_files }}; do + DIR="$(dirname "${changed_file}")" + echo "Do something with this ${DIR}." + done + - name: Setup test environment + uses: conda-incubator/setup-miniconda@v2 + with: + environment-file: ${{ matrix.environment-file }} - name: Install dependencies run: | python -m pip install pytest From 97f9f8501a2e0f090fe221b0e070bbf2febc60a2 Mon Sep 17 00:00:00 2001 From: Oscar Salazar Date: Mon, 17 Jun 2024 17:05:12 -0600 Subject: [PATCH 28/69] Update ci.yml --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3454cb6..bbf5e52 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -42,7 +42,7 @@ jobs: run: | for changed_file in ${{ steps.changed-files.outputs.changed_files }}; do DIR="$(dirname "${changed_file}")" - echo "Do something with this ${DIR}." + echo "{DIR}" done - name: Setup test environment uses: conda-incubator/setup-miniconda@v2 From 52e82832a43ef29241de4c7b0a982df26eec4f8d Mon Sep 17 00:00:00 2001 From: Oscar Salazar Date: Mon, 17 Jun 2024 17:09:23 -0600 Subject: [PATCH 29/69] Update ci.yml --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bbf5e52..ba7ec5e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -42,7 +42,7 @@ jobs: run: | for changed_file in ${{ steps.changed-files.outputs.changed_files }}; do DIR="$(dirname "${changed_file}")" - echo "{DIR}" + echo "${DIR}" done - name: Setup test environment uses: conda-incubator/setup-miniconda@v2 From dcfc4b755ab7348853e2dabbea7c1b055e5add42 Mon Sep 17 00:00:00 2001 From: Oscar Salazar Date: Mon, 17 Jun 2024 17:20:39 -0600 Subject: [PATCH 30/69] Create test.sh --- mailorder/test.sh | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 mailorder/test.sh diff --git a/mailorder/test.sh b/mailorder/test.sh new file mode 100644 index 0000000..2c729fe --- /dev/null +++ b/mailorder/test.sh @@ -0,0 +1,6 @@ +VAR1=".github/workflows" +VAR2="." +VAR3="mailorder/app/data" + +BASE_DIRECTORY=$(echo "$VAR1" | cut -d "/" -f2) +echo "#$BASE_DIRECTORY#"; \ No newline at end of file From 7572218e726d1e602dee85d0cfe16a26a364ddf9 Mon Sep 17 00:00:00 2001 From: Oscar Salazar Date: Tue, 18 Jun 2024 07:58:39 -0600 Subject: [PATCH 31/69] Update ci.yml --- .github/workflows/ci.yml | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ba7ec5e..c211c89 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,7 +13,7 @@ permissions: contents: read jobs: - build-mailorder: + build: runs-on: ubuntu-latest strategy: matrix: @@ -38,12 +38,14 @@ jobs: else echo "changed_files=$(git diff --name-only ${{ github.event.before }} ${{ github.event.after }} | xargs)" >> $GITHUB_OUTPUT fi - - name: List changed files - run: | - for changed_file in ${{ steps.changed-files.outputs.changed_files }}; do - DIR="$(dirname "${changed_file}")" - echo "${DIR}" - done + - name: Determine tests to run + uses: actions/github-script@v7 + env: + CHANGED_FILES: ${{ steps.changed-files.outputs.changed_files }} + with: + script: | + const { CHANGED_FILES } = process.env + console.log(CHANGED_FILES) - name: Setup test environment uses: conda-incubator/setup-miniconda@v2 with: From 622c9f5169da4dddb7b49d445af253653afdae34 Mon Sep 17 00:00:00 2001 From: Oscar Salazar Date: Tue, 18 Jun 2024 08:03:06 -0600 Subject: [PATCH 32/69] Update ci.yml --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c211c89..2298012 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -45,7 +45,7 @@ jobs: with: script: | const { CHANGED_FILES } = process.env - console.log(CHANGED_FILES) + console.log(typeof CHANGED_FILES) - name: Setup test environment uses: conda-incubator/setup-miniconda@v2 with: From 34eae21e1f57898d5119859ec7b0e71fbb405e72 Mon Sep 17 00:00:00 2001 From: Oscar Salazar Date: Tue, 18 Jun 2024 08:05:44 -0600 Subject: [PATCH 33/69] Update ci.yml --- .github/workflows/ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2298012..2a16cfd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -45,7 +45,8 @@ jobs: with: script: | const { CHANGED_FILES } = process.env - console.log(typeof CHANGED_FILES) + const files = CHANGED_FILES.split(" ") + console.log(files) - name: Setup test environment uses: conda-incubator/setup-miniconda@v2 with: From 778417e0ef9e5fd092d31ac7de9602ad9c05fdfa Mon Sep 17 00:00:00 2001 From: Oscar Salazar Date: Tue, 18 Jun 2024 08:19:27 -0600 Subject: [PATCH 34/69] Update ci.yml --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2a16cfd..54d39d7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -46,6 +46,7 @@ jobs: script: | const { CHANGED_FILES } = process.env const files = CHANGED_FILES.split(" ") + .map(x => substring(0, path.indexOf("/")+1)) console.log(files) - name: Setup test environment uses: conda-incubator/setup-miniconda@v2 From 11a221a5443f481091ae3d6ab0954c6bd6fc2268 Mon Sep 17 00:00:00 2001 From: Oscar Salazar Date: Tue, 18 Jun 2024 08:20:30 -0600 Subject: [PATCH 35/69] Update ci.yml --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 54d39d7..dbb2277 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -46,7 +46,7 @@ jobs: script: | const { CHANGED_FILES } = process.env const files = CHANGED_FILES.split(" ") - .map(x => substring(0, path.indexOf("/")+1)) + .map(x => x.substring(0, x.indexOf("/")+1)) console.log(files) - name: Setup test environment uses: conda-incubator/setup-miniconda@v2 From 09af8bb22f49d2c06216cdb096a200c990f29ad9 Mon Sep 17 00:00:00 2001 From: Oscar Salazar Date: Tue, 18 Jun 2024 08:23:55 -0600 Subject: [PATCH 36/69] Update ci.yml --- .github/workflows/ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index dbb2277..e7d7487 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -46,7 +46,8 @@ jobs: script: | const { CHANGED_FILES } = process.env const files = CHANGED_FILES.split(" ") - .map(x => x.substring(0, x.indexOf("/")+1)) + .map(x => x.substring(0, x.indexOf("/") + 1)) + .filter(x => x.length > 0 && !x.startsWith('.')) console.log(files) - name: Setup test environment uses: conda-incubator/setup-miniconda@v2 From e7a4542491039ef54f528fe1fc958f84f35ee0a4 Mon Sep 17 00:00:00 2001 From: Oscar Salazar Date: Tue, 18 Jun 2024 08:25:49 -0600 Subject: [PATCH 37/69] Update ci.yml --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e7d7487..02a3f30 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -45,9 +45,9 @@ jobs: with: script: | const { CHANGED_FILES } = process.env - const files = CHANGED_FILES.split(" ") + const files = new Set(CHANGED_FILES.split(" ") .map(x => x.substring(0, x.indexOf("/") + 1)) - .filter(x => x.length > 0 && !x.startsWith('.')) + .filter(x => x.length > 0 && !x.startsWith('.'))) console.log(files) - name: Setup test environment uses: conda-incubator/setup-miniconda@v2 From 74392555fa1bf79810025d3a955aae662cae5d22 Mon Sep 17 00:00:00 2001 From: Oscar Salazar Date: Tue, 18 Jun 2024 08:50:45 -0600 Subject: [PATCH 38/69] Update ci.yml --- .github/workflows/ci.yml | 35 +++++++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 02a3f30..be8cb84 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -45,10 +45,41 @@ jobs: with: script: | const { CHANGED_FILES } = process.env - const files = new Set(CHANGED_FILES.split(" ") + const fs = require('fs'); + const path = require('path'); + + const getPytestPaths = (directory) => + { + const files = fs.readdirSync(directory, { withFileTypes: true }); + for (const file of files) + { + if (file.isDirectory()) + { + yield* readAllFiles(path.join(directory, file.name)); + } + else + { + extension = path.extname(file.name) + if (extension == '.py') + { + yield directory; + } + } + } + } + + const paths = new Set(CHANGED_FILES.split(" ") .map(x => x.substring(0, x.indexOf("/") + 1)) .filter(x => x.length > 0 && !x.startsWith('.'))) - console.log(files) + + for (const rootPath of paths) + { + for (const path of getPytestPaths(rootPath)) + { + console.log(path) + } + } + - name: Setup test environment uses: conda-incubator/setup-miniconda@v2 with: From 4a38651b2ed8404f3cc7beddf13b4bf439c3833f Mon Sep 17 00:00:00 2001 From: Oscar Salazar Date: Tue, 18 Jun 2024 08:52:23 -0600 Subject: [PATCH 39/69] Update ci.yml --- .github/workflows/ci.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index be8cb84..d9ce433 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -48,21 +48,21 @@ jobs: const fs = require('fs'); const path = require('path'); - const getPytestPaths = (directory) => + const getPytestPaths = (dir) => { - const files = fs.readdirSync(directory, { withFileTypes: true }); + const files = fs.readdirSync(dir, { withFileTypes: true }); for (const file of files) { if (file.isDirectory()) { - yield* readAllFiles(path.join(directory, file.name)); + yield* readAllFiles(path.join(dir, file.name)); } else { extension = path.extname(file.name) if (extension == '.py') { - yield directory; + yield dir; } } } From 480b9ad80c54fcdff669b6198df2287b57d052b0 Mon Sep 17 00:00:00 2001 From: Oscar Salazar Date: Tue, 18 Jun 2024 08:55:47 -0600 Subject: [PATCH 40/69] Update ci.yml --- .github/workflows/ci.yml | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d9ce433..9592052 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -48,24 +48,24 @@ jobs: const fs = require('fs'); const path = require('path'); - const getPytestPaths = (dir) => + function getPytestPaths(dir) { const files = fs.readdirSync(dir, { withFileTypes: true }); - for (const file of files) + for (const file of files) + { + if (file.isDirectory()) { - if (file.isDirectory()) - { - yield* readAllFiles(path.join(dir, file.name)); - } - else + yield* getPytestPaths(path.join(dir, file.name)); + } + else + { + extension = path.extname(file.name) + if (extension == '.py') { - extension = path.extname(file.name) - if (extension == '.py') - { - yield dir; - } + yield dir; } } + } } const paths = new Set(CHANGED_FILES.split(" ") From bb184b9a662f660cb10b0400b7a77f32006ca7ad Mon Sep 17 00:00:00 2001 From: Oscar Salazar Date: Tue, 18 Jun 2024 08:58:31 -0600 Subject: [PATCH 41/69] Update ci.yml --- .github/workflows/ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9592052..b4883cb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -59,7 +59,7 @@ jobs: } else { - extension = path.extname(file.name) + extension = path.extname(file.name); if (extension == '.py') { yield dir; @@ -70,13 +70,13 @@ jobs: const paths = new Set(CHANGED_FILES.split(" ") .map(x => x.substring(0, x.indexOf("/") + 1)) - .filter(x => x.length > 0 && !x.startsWith('.'))) + .filter(x => x.length > 0 && !x.startsWith('.'))); for (const rootPath of paths) { for (const path of getPytestPaths(rootPath)) { - console.log(path) + console.log(path); } } From 7c0b384659a5b3d24d09e4e316d6463027d3078d Mon Sep 17 00:00:00 2001 From: Oscar Salazar Date: Tue, 18 Jun 2024 09:00:08 -0600 Subject: [PATCH 42/69] Update ci.yml --- .github/workflows/ci.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b4883cb..78d72fb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -48,7 +48,7 @@ jobs: const fs = require('fs'); const path = require('path'); - function getPytestPaths(dir) + /*function getPytestPaths(dir) { const files = fs.readdirSync(dir, { withFileTypes: true }); for (const file of files) @@ -66,7 +66,7 @@ jobs: } } } - } + }*/ const paths = new Set(CHANGED_FILES.split(" ") .map(x => x.substring(0, x.indexOf("/") + 1)) @@ -74,10 +74,10 @@ jobs: for (const rootPath of paths) { - for (const path of getPytestPaths(rootPath)) + /*for (const path of getPytestPaths(rootPath)) { console.log(path); - } + }*/ } - name: Setup test environment From a03f9e64fd0a36c26cb2662b959a31a7520a1813 Mon Sep 17 00:00:00 2001 From: Oscar Salazar Date: Tue, 18 Jun 2024 09:02:16 -0600 Subject: [PATCH 43/69] Update ci.yml --- .github/workflows/ci.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 78d72fb..83be423 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -48,25 +48,25 @@ jobs: const fs = require('fs'); const path = require('path'); - /*function getPytestPaths(dir) + function getPytestPaths(dir) { const files = fs.readdirSync(dir, { withFileTypes: true }); for (const file of files) { if (file.isDirectory()) { - yield* getPytestPaths(path.join(dir, file.name)); + //yield* getPytestPaths(path.join(dir, file.name)); } else { extension = path.extname(file.name); if (extension == '.py') { - yield dir; + //yield dir; } } } - }*/ + } const paths = new Set(CHANGED_FILES.split(" ") .map(x => x.substring(0, x.indexOf("/") + 1)) From 4c7edd8b0b33e1f75dca6a22fde00fa29b325177 Mon Sep 17 00:00:00 2001 From: Oscar Salazar Date: Tue, 18 Jun 2024 09:04:10 -0600 Subject: [PATCH 44/69] Update ci.yml --- .github/workflows/ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 83be423..e39f0e7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -48,21 +48,21 @@ jobs: const fs = require('fs'); const path = require('path'); - function getPytestPaths(dir) + function getPytestPaths(dir, callback) { const files = fs.readdirSync(dir, { withFileTypes: true }); for (const file of files) { if (file.isDirectory()) { - //yield* getPytestPaths(path.join(dir, file.name)); + getPytestPaths(path.join(dir, file.name)); } else { extension = path.extname(file.name); if (extension == '.py') { - //yield dir; + callback(dir); } } } From 34075bd18ceb6200812431d8d3b59241e9247d54 Mon Sep 17 00:00:00 2001 From: Oscar Salazar Date: Tue, 18 Jun 2024 09:06:03 -0600 Subject: [PATCH 45/69] Update ci.yml --- .github/workflows/ci.yml | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e39f0e7..045b634 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -69,15 +69,12 @@ jobs: } const paths = new Set(CHANGED_FILES.split(" ") - .map(x => x.substring(0, x.indexOf("/") + 1)) - .filter(x => x.length > 0 && !x.startsWith('.'))); + .map(path => path.substring(0, path.indexOf("/") + 1)) + .filter(x => path.length > 0 && !path.startsWith('.'))); for (const rootPath of paths) { - /*for (const path of getPytestPaths(rootPath)) - { - console.log(path); - }*/ + getPytestPaths(rootPath, path => console.log(path)) } - name: Setup test environment From 875da9b6d99f459db31b7171a936086d46f51436 Mon Sep 17 00:00:00 2001 From: Oscar Salazar Date: Tue, 18 Jun 2024 09:07:07 -0600 Subject: [PATCH 46/69] Update ci.yml --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 045b634..461be68 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -55,7 +55,7 @@ jobs: { if (file.isDirectory()) { - getPytestPaths(path.join(dir, file.name)); + getPytestPaths(path.join(dir, file.name), callback); } else { From 6c8e0686089b4326ea23d93822233b090941d0d3 Mon Sep 17 00:00:00 2001 From: Oscar Salazar Date: Tue, 18 Jun 2024 09:11:08 -0600 Subject: [PATCH 47/69] Update ci.yml --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 461be68..a13e2ec 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -60,6 +60,7 @@ jobs: else { extension = path.extname(file.name); + console.log(file.name) if (extension == '.py') { callback(dir); From f69bfa5e921077f984fd58eeea08a08a49655332 Mon Sep 17 00:00:00 2001 From: Oscar Salazar Date: Tue, 18 Jun 2024 09:11:58 -0600 Subject: [PATCH 48/69] Update ci.yml --- .github/workflows/ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a13e2ec..de2a13e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -53,6 +53,7 @@ jobs: const files = fs.readdirSync(dir, { withFileTypes: true }); for (const file of files) { + console.log(file.name) if (file.isDirectory()) { getPytestPaths(path.join(dir, file.name), callback); @@ -60,7 +61,7 @@ jobs: else { extension = path.extname(file.name); - console.log(file.name) + if (extension == '.py') { callback(dir); From e232c0535cbe448d1eb684771b564f76a50fa6f7 Mon Sep 17 00:00:00 2001 From: Oscar Salazar Date: Tue, 18 Jun 2024 09:12:57 -0600 Subject: [PATCH 49/69] Update ci.yml --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index de2a13e..ef9eeef 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -51,6 +51,7 @@ jobs: function getPytestPaths(dir, callback) { const files = fs.readdirSync(dir, { withFileTypes: true }); + console.log(files) for (const file of files) { console.log(file.name) From 1522cbdc7975f7a520111a38ac95041b5ef15dba Mon Sep 17 00:00:00 2001 From: Oscar Salazar Date: Tue, 18 Jun 2024 09:14:08 -0600 Subject: [PATCH 50/69] Update ci.yml --- .github/workflows/ci.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ef9eeef..a22b009 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -77,7 +77,9 @@ jobs: for (const rootPath of paths) { - getPytestPaths(rootPath, path => console.log(path)) + const files = fs.readdirSync(dir, { withFileTypes: true }); + console.log(files) + //getPytestPaths(rootPath, path => console.log(path)) } - name: Setup test environment From 5c0ea125b91d532233e91cbb8412ef815c5e9c82 Mon Sep 17 00:00:00 2001 From: Oscar Salazar Date: Tue, 18 Jun 2024 09:15:32 -0600 Subject: [PATCH 51/69] Update ci.yml --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a22b009..7651773 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -73,7 +73,7 @@ jobs: const paths = new Set(CHANGED_FILES.split(" ") .map(path => path.substring(0, path.indexOf("/") + 1)) - .filter(x => path.length > 0 && !path.startsWith('.'))); + .filter(path => path.length > 0 && !path.startsWith('.'))); for (const rootPath of paths) { From 9b8fb9340385d8a6f97f5ab738540accab19fcce Mon Sep 17 00:00:00 2001 From: Oscar Salazar Date: Tue, 18 Jun 2024 09:17:05 -0600 Subject: [PATCH 52/69] Update ci.yml --- .github/workflows/ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7651773..5c9eda0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -44,7 +44,7 @@ jobs: CHANGED_FILES: ${{ steps.changed-files.outputs.changed_files }} with: script: | - const { CHANGED_FILES } = process.env + const { CHANGED_FILES } = process.env; const fs = require('fs'); const path = require('path'); @@ -72,8 +72,8 @@ jobs: } const paths = new Set(CHANGED_FILES.split(" ") - .map(path => path.substring(0, path.indexOf("/") + 1)) - .filter(path => path.length > 0 && !path.startsWith('.'))); + .map(x => x.substring(0, x.indexOf("/") + 1)) + .filter(x => x.length > 0 && !x.startsWith('.'))); for (const rootPath of paths) { From c895600d3e680ab1f377657296a86f38af94f421 Mon Sep 17 00:00:00 2001 From: Oscar Salazar Date: Tue, 18 Jun 2024 09:19:12 -0600 Subject: [PATCH 53/69] Update ci.yml --- .github/workflows/ci.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5c9eda0..0360256 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -54,7 +54,6 @@ jobs: console.log(files) for (const file of files) { - console.log(file.name) if (file.isDirectory()) { getPytestPaths(path.join(dir, file.name), callback); @@ -77,8 +76,7 @@ jobs: for (const rootPath of paths) { - const files = fs.readdirSync(dir, { withFileTypes: true }); - console.log(files) + //getPytestPaths(rootPath, path => console.log(path)) } From 72fd1088b222865c8524d74efce588573b6994fc Mon Sep 17 00:00:00 2001 From: Oscar Salazar Date: Tue, 18 Jun 2024 09:20:11 -0600 Subject: [PATCH 54/69] Update ci.yml --- .github/workflows/ci.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0360256..8398761 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -76,8 +76,7 @@ jobs: for (const rootPath of paths) { - - //getPytestPaths(rootPath, path => console.log(path)) + getPytestPaths(rootPath, x => console.log(x)) } - name: Setup test environment From 61bef884c6e80639c53c66c778f6c0460870b21b Mon Sep 17 00:00:00 2001 From: Oscar Salazar Date: Tue, 18 Jun 2024 09:22:04 -0600 Subject: [PATCH 55/69] Update ci.yml --- .github/workflows/ci.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8398761..b2fe0bd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -51,7 +51,6 @@ jobs: function getPytestPaths(dir, callback) { const files = fs.readdirSync(dir, { withFileTypes: true }); - console.log(files) for (const file of files) { if (file.isDirectory()) From daab66d693910e115680783488edb5604504910e Mon Sep 17 00:00:00 2001 From: Oscar Salazar Date: Tue, 18 Jun 2024 09:23:32 -0600 Subject: [PATCH 56/69] Update ci.yml --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b2fe0bd..3f28ffc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -61,7 +61,7 @@ jobs: { extension = path.extname(file.name); - if (extension == '.py') + if (extension == '.py' && !file.name.startsWith('test')) { callback(dir); } From 8223238ef5b648252ebe9bdb3fd737856b7e3706 Mon Sep 17 00:00:00 2001 From: Oscar Salazar Date: Tue, 18 Jun 2024 09:25:38 -0600 Subject: [PATCH 57/69] Update ci.yml --- .github/workflows/ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3f28ffc..c05de8a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -73,9 +73,10 @@ jobs: .map(x => x.substring(0, x.indexOf("/") + 1)) .filter(x => x.length > 0 && !x.startsWith('.'))); + const pytestPaths = new Set() for (const rootPath of paths) { - getPytestPaths(rootPath, x => console.log(x)) + getPytestPaths(rootPath, x => pytestPaths.add(x)) } - name: Setup test environment From 1b32603e272ee1082c71094bc76e890f6117f35c Mon Sep 17 00:00:00 2001 From: Oscar Salazar Date: Tue, 18 Jun 2024 09:26:08 -0600 Subject: [PATCH 58/69] Update ci.yml --- .github/workflows/ci.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c05de8a..2bfd1e0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -78,6 +78,9 @@ jobs: { getPytestPaths(rootPath, x => pytestPaths.add(x)) } + + console.log(pytestPaths) + console.log(paths) - name: Setup test environment uses: conda-incubator/setup-miniconda@v2 From 01d45b30a4d5d9476c2a88718b14d29482dd61ce Mon Sep 17 00:00:00 2001 From: Oscar Salazar Date: Tue, 18 Jun 2024 09:34:42 -0600 Subject: [PATCH 59/69] Update ci.yml --- .github/workflows/ci.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2bfd1e0..daa328f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -40,6 +40,7 @@ jobs: fi - name: Determine tests to run uses: actions/github-script@v7 + id: tests_to_run env: CHANGED_FILES: ${{ steps.changed-files.outputs.changed_files }} with: @@ -47,6 +48,7 @@ jobs: const { CHANGED_FILES } = process.env; const fs = require('fs'); const path = require('path'); + const core = require('@actions/core'); function getPytestPaths(dir, callback) { @@ -79,8 +81,8 @@ jobs: getPytestPaths(rootPath, x => pytestPaths.add(x)) } - console.log(pytestPaths) - console.log(paths) + core.setOutput('pytestPaths', pytestPaths.join(' ')); + core.setOutput('pytestArgs', paths.join(' ')); - name: Setup test environment uses: conda-incubator/setup-miniconda@v2 From 2a4c6886239631e9fbc85438ed15b46a3d3fbfb8 Mon Sep 17 00:00:00 2001 From: Oscar Salazar Date: Tue, 18 Jun 2024 09:35:37 -0600 Subject: [PATCH 60/69] Update ci.yml --- .github/workflows/ci.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index daa328f..d8473ba 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -48,7 +48,6 @@ jobs: const { CHANGED_FILES } = process.env; const fs = require('fs'); const path = require('path'); - const core = require('@actions/core'); function getPytestPaths(dir, callback) { From c0db3f162d3fd90eae7af2b51778867a441acfb2 Mon Sep 17 00:00:00 2001 From: Oscar Salazar Date: Tue, 18 Jun 2024 09:36:48 -0600 Subject: [PATCH 61/69] Update ci.yml --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d8473ba..95cbeb6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -80,8 +80,8 @@ jobs: getPytestPaths(rootPath, x => pytestPaths.add(x)) } - core.setOutput('pytestPaths', pytestPaths.join(' ')); - core.setOutput('pytestArgs', paths.join(' ')); + core.setOutput('pytestPaths', [...pytestPaths].join(' ')); + core.setOutput('pytestArgs', [...paths].join(' ')); - name: Setup test environment uses: conda-incubator/setup-miniconda@v2 From 7130100859a159f96d371685bc6447842709de8b Mon Sep 17 00:00:00 2001 From: Oscar Salazar Date: Tue, 18 Jun 2024 09:57:58 -0600 Subject: [PATCH 62/69] Update ci.yml --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 95cbeb6..51db088 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -89,6 +89,7 @@ jobs: environment-file: ${{ matrix.environment-file }} - name: Install dependencies run: | + printf "[pytest]\npythonpath=${{ steps.tests_to_run.outputs.pytestPaths }}" > pytest.ini python -m pip install pytest - name: Run tests run: | From e065feb1d172947b10f63f36eb2b552101740c18 Mon Sep 17 00:00:00 2001 From: Oscar Salazar Date: Tue, 18 Jun 2024 09:59:52 -0600 Subject: [PATCH 63/69] Update ci.yml --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 51db088..2475628 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -93,5 +93,5 @@ jobs: python -m pip install pytest - name: Run tests run: | - pytest + pytest ${{ steps.tests_to_run.outputs.pytestArgs }} \ No newline at end of file From 82f5a267dcfb267c99f13cdbad4aa69b5040a53a Mon Sep 17 00:00:00 2001 From: Oscar Salazar Date: Tue, 18 Jun 2024 10:03:09 -0600 Subject: [PATCH 64/69] Delete test.sh --- mailorder/test.sh | 6 ------ 1 file changed, 6 deletions(-) delete mode 100644 mailorder/test.sh diff --git a/mailorder/test.sh b/mailorder/test.sh deleted file mode 100644 index 2c729fe..0000000 --- a/mailorder/test.sh +++ /dev/null @@ -1,6 +0,0 @@ -VAR1=".github/workflows" -VAR2="." -VAR3="mailorder/app/data" - -BASE_DIRECTORY=$(echo "$VAR1" | cut -d "/" -f2) -echo "#$BASE_DIRECTORY#"; \ No newline at end of file From 6fb36d9e0d59cdd19397d8fe204f1de5a3f33d4b Mon Sep 17 00:00:00 2001 From: Oscar Salazar Date: Tue, 18 Jun 2024 10:07:56 -0600 Subject: [PATCH 65/69] Update ci.yml --- .github/workflows/ci.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2475628..c3916ad 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -93,5 +93,11 @@ jobs: python -m pip install pytest - name: Run tests run: | - pytest ${{ steps.tests_to_run.outputs.pytestArgs }} + args=${{ steps.tests_to_run.outputs.pytestArgs }} + if [ -z "${args}" ]; then + echo “Nothing to test” + else + pytest $args + fi + \ No newline at end of file From d2727677ff74c5cd0a903d3ca747ca0c7d9bd37e Mon Sep 17 00:00:00 2001 From: Oscar Salazar Date: Tue, 18 Jun 2024 10:10:13 -0600 Subject: [PATCH 66/69] Update customers.sql --- mailorder/app/data/customers.sql | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/mailorder/app/data/customers.sql b/mailorder/app/data/customers.sql index 920c4e5..ecefc62 100644 --- a/mailorder/app/data/customers.sql +++ b/mailorder/app/data/customers.sql @@ -6,5 +6,4 @@ create table if not exists ); grant select on data.customers to application role app_csr; -grant select, insert, update, delete, truncate on data.customers to application role app_admin; - +grant select, insert, update, delete, truncate on data.customers to application role app_admin; \ No newline at end of file From e77d17b9395f4496e84ae5b652db6c3ceb5685f4 Mon Sep 17 00:00:00 2001 From: Oscar Salazar Date: Tue, 18 Jun 2024 10:10:40 -0600 Subject: [PATCH 67/69] Update customers.sql --- mailorder/app/data/customers.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mailorder/app/data/customers.sql b/mailorder/app/data/customers.sql index ecefc62..ca49207 100644 --- a/mailorder/app/data/customers.sql +++ b/mailorder/app/data/customers.sql @@ -6,4 +6,4 @@ create table if not exists ); grant select on data.customers to application role app_csr; -grant select, insert, update, delete, truncate on data.customers to application role app_admin; \ No newline at end of file +grant select, insert, update, delete, truncate on data.customers to application role app_admin; From de51b2e6de9b8a5f86dfa75970b08723c2812fdb Mon Sep 17 00:00:00 2001 From: Oscar Salazar Date: Tue, 18 Jun 2024 10:14:59 -0600 Subject: [PATCH 68/69] Update ci.yml --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c3916ad..f1b97d0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -30,7 +30,7 @@ jobs: uses: actions/setup-python@v3 with: python-version: "3.10" - - name: Get changes + - name: Get changed files id: changed-files run: | if ${{ github.event_name == 'pull_request' }}; then From 6b1c110170ba885176f66be2d077461414bd3282 Mon Sep 17 00:00:00 2001 From: Oscar Salazar Date: Wed, 19 Jun 2024 09:21:21 -0600 Subject: [PATCH 69/69] apply code suggestions --- .github/workflows/ci.yml | 4 ++-- local_test_env.yml => shared_python_ci_env.yml | 0 2 files changed, 2 insertions(+), 2 deletions(-) rename local_test_env.yml => shared_python_ci_env.yml (100%) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f1b97d0..e0198be 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,7 +18,7 @@ jobs: strategy: matrix: include: - - environment-file: local_test_env.yml + - environment-file: shared_python_ci_env.yml defaults: run: shell: bash -l {0} @@ -62,7 +62,7 @@ jobs: { extension = path.extname(file.name); - if (extension == '.py' && !file.name.startsWith('test')) + if (extension == '.py') { callback(dir); } diff --git a/local_test_env.yml b/shared_python_ci_env.yml similarity index 100% rename from local_test_env.yml rename to shared_python_ci_env.yml