From 3f924ea8182276283b753f87ab493f2d7811c0b8 Mon Sep 17 00:00:00 2001 From: Sean Perry Date: Thu, 30 May 2024 12:46:16 -0700 Subject: [PATCH 01/12] feat: fix workflow error for dependabot secrets issue --- .github/workflows/check_bot.yml | 12 ++++++++++++ .github/workflows/env_test.yml | 1 + .github/workflows/env_test_bot.yml | 0 3 files changed, 13 insertions(+) create mode 100644 .github/workflows/check_bot.yml create mode 100644 .github/workflows/env_test_bot.yml diff --git a/.github/workflows/check_bot.yml b/.github/workflows/check_bot.yml new file mode 100644 index 00000000..ad182c8f --- /dev/null +++ b/.github/workflows/check_bot.yml @@ -0,0 +1,12 @@ +### .github/workflows/dependabot_pr.yml +### This workflow doesn't have access to secrets and has a read-only token +name: Dependabot PR Check +on: + pull_request + +jobs: + check-dependabot: + runs-on: ubuntu-latest + if: ${{ github.actor == 'dependabot[bot]' }} + steps: + - run: echo "PR created by Dependabot" \ No newline at end of file diff --git a/.github/workflows/env_test.yml b/.github/workflows/env_test.yml index 9f304890..1df02706 100644 --- a/.github/workflows/env_test.yml +++ b/.github/workflows/env_test.yml @@ -9,6 +9,7 @@ on: jobs: build: + if: ${{ github.actor != 'dependabot[bot]' }} # continue-on-error: true strategy: matrix: diff --git a/.github/workflows/env_test_bot.yml b/.github/workflows/env_test_bot.yml new file mode 100644 index 00000000..e69de29b From 0a4899b681f60cc3758851907853db1a9b2c0c90 Mon Sep 17 00:00:00 2001 From: Sean Perry Date: Thu, 30 May 2024 12:48:54 -0700 Subject: [PATCH 02/12] fix: update them so they run on peotry.lock and pyproject.toml --- .github/workflows/check_bot.yml | 16 +++++++++++++--- .github/workflows/env_test.yml | 10 ++-------- .github/workflows/env_test_bot.yml | 21 +++++++++++++++++++++ 3 files changed, 36 insertions(+), 11 deletions(-) diff --git a/.github/workflows/check_bot.yml b/.github/workflows/check_bot.yml index ad182c8f..9bd707ad 100644 --- a/.github/workflows/check_bot.yml +++ b/.github/workflows/check_bot.yml @@ -1,12 +1,22 @@ ### .github/workflows/dependabot_pr.yml ### This workflow doesn't have access to secrets and has a read-only token name: Dependabot PR Check -on: - pull_request +on: + push: + paths: + - poetry.lock + - pyproject.toml + workflow_dispatch: jobs: + manual-run: + if: ${{ github.actor != 'dependabot[bot]' }} + uses: ./.github/workflows/env_test.yml + check-dependabot: runs-on: ubuntu-latest if: ${{ github.actor == 'dependabot[bot]' }} steps: - - run: echo "PR created by Dependabot" \ No newline at end of file + - run: echo "PR created by Dependabot" + + \ No newline at end of file diff --git a/.github/workflows/env_test.yml b/.github/workflows/env_test.yml index 1df02706..c8182678 100644 --- a/.github/workflows/env_test.yml +++ b/.github/workflows/env_test.yml @@ -1,16 +1,10 @@ name: Environment Test -on: - push: - paths: - - poetry.lock - - pyproject.toml - workflow_dispatch: +on: + workflow_call: jobs: build: - if: ${{ github.actor != 'dependabot[bot]' }} - # continue-on-error: true strategy: matrix: os: [ubuntu-latest, windows-latest, macos-latest] diff --git a/.github/workflows/env_test_bot.yml b/.github/workflows/env_test_bot.yml index e69de29b..bd0f1222 100644 --- a/.github/workflows/env_test_bot.yml +++ b/.github/workflows/env_test_bot.yml @@ -0,0 +1,21 @@ +### .github/workflows/dependabot_automerge.yml +### This workflow has access to secrets and a read-write token +name: Dependabot Automerge +on: + workflow_run: + workflows: ["Dependabot PR Check"] + types: + - completed + +permissions: + # down scope as necessary via https://docs.github.com/en/actions/reference/authentication-in-a-workflow#modifying-the-permissions-for-the-github_token + +jobs: + env-test: + #if: ${{ github.event.workflow_run.conclusion == 'success' }} + uses: ./.github/workflows/env_test.yml + + # env-test: + # #if: ${{ github.event.workflow_run.conclusion == 'success' }} + # uses: ./.github/workflows/env_test.yml + \ No newline at end of file From a2e847b49f9934a51aedace1309d8540a13c63c2 Mon Sep 17 00:00:00 2001 From: Sean Perry Date: Thu, 30 May 2024 13:08:29 -0700 Subject: [PATCH 03/12] fix: adjust so human changes can work --- .github/workflows/check_bot.yml | 6 +----- .github/workflows/check_human.yml | 16 ++++++++++++++++ pyproject.toml | 2 +- 3 files changed, 18 insertions(+), 6 deletions(-) create mode 100644 .github/workflows/check_human.yml diff --git a/.github/workflows/check_bot.yml b/.github/workflows/check_bot.yml index 9bd707ad..ebff3cdd 100644 --- a/.github/workflows/check_bot.yml +++ b/.github/workflows/check_bot.yml @@ -1,6 +1,6 @@ ### .github/workflows/dependabot_pr.yml ### This workflow doesn't have access to secrets and has a read-only token -name: Dependabot PR Check +name: Dependabot PR Check (check if human made this) on: push: paths: @@ -9,10 +9,6 @@ on: workflow_dispatch: jobs: - manual-run: - if: ${{ github.actor != 'dependabot[bot]' }} - uses: ./.github/workflows/env_test.yml - check-dependabot: runs-on: ubuntu-latest if: ${{ github.actor == 'dependabot[bot]' }} diff --git a/.github/workflows/check_human.yml b/.github/workflows/check_human.yml new file mode 100644 index 00000000..6384cdf4 --- /dev/null +++ b/.github/workflows/check_human.yml @@ -0,0 +1,16 @@ +### .github/workflows/dependabot_pr.yml +### This workflow doesn't have access to secrets and has a read-only token +name: Dependabot PR Check +on: + push: + paths: + - poetry.lock + - pyproject.toml + workflow_dispatch: + +jobs: + manual-run: + if: ${{ github.actor != 'dependabot[bot]' }} + uses: ./.github/workflows/env_test.yml + + \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 787f532c..0d0ec46d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [tool.poetry] name = "PyHa" version = "0.0.0" -description = "PyHa" +description = "PyHa test" authors = [ "UCSD Engineers for Exploration ", "Jacob Ayers ", From 6d1e1d6f48d38feab7906f22bdb5459ae8e45d3c Mon Sep 17 00:00:00 2001 From: Sean Perry Date: Thu, 30 May 2024 13:23:11 -0700 Subject: [PATCH 04/12] test: secret issues --- pyha_tests/conftest.py | 1 + pyproject.toml | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/pyha_tests/conftest.py b/pyha_tests/conftest.py index aca5651a..992d2ad8 100644 --- a/pyha_tests/conftest.py +++ b/pyha_tests/conftest.py @@ -22,6 +22,7 @@ def create_creds() -> Dict[str, str]: with open('credentials.json', 'r', encoding='ascii') as handle: return json.load(handle) else: + assert len(os.environ['NAS_CREDS']) > 0 return json.loads(os.environ['NAS_CREDS']) # value = os.environ['NAS_CREDS'].splitlines() # assert len(value) == 2 diff --git a/pyproject.toml b/pyproject.toml index 0d0ec46d..5b003d30 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [tool.poetry] name = "PyHa" version = "0.0.0" -description = "PyHa test" +description = "PyHa test test" authors = [ "UCSD Engineers for Exploration ", "Jacob Ayers ", From b0f71ba4d953b497d4260679891f0e5c76d3aeb6 Mon Sep 17 00:00:00 2001 From: Sean Perry Date: Thu, 30 May 2024 13:27:24 -0700 Subject: [PATCH 05/12] Update conftest.py --- pyha_tests/conftest.py | 1 - 1 file changed, 1 deletion(-) diff --git a/pyha_tests/conftest.py b/pyha_tests/conftest.py index 992d2ad8..aca5651a 100644 --- a/pyha_tests/conftest.py +++ b/pyha_tests/conftest.py @@ -22,7 +22,6 @@ def create_creds() -> Dict[str, str]: with open('credentials.json', 'r', encoding='ascii') as handle: return json.load(handle) else: - assert len(os.environ['NAS_CREDS']) > 0 return json.loads(os.environ['NAS_CREDS']) # value = os.environ['NAS_CREDS'].splitlines() # assert len(value) == 2 From 562a69cef329d7ce80843d35a619696d97b31cab Mon Sep 17 00:00:00 2001 From: Sean Perry Date: Thu, 30 May 2024 13:42:13 -0700 Subject: [PATCH 06/12] fix: remove bad chaining --- .github/workflows/check_bot.yml | 18 ------------ .github/workflows/check_human.yml | 16 ----------- .github/workflows/env_test.yml | 45 +++++++++++++++++++----------- .github/workflows/env_test_bot.yml | 25 +++++------------ 4 files changed, 35 insertions(+), 69 deletions(-) delete mode 100644 .github/workflows/check_bot.yml delete mode 100644 .github/workflows/check_human.yml diff --git a/.github/workflows/check_bot.yml b/.github/workflows/check_bot.yml deleted file mode 100644 index ebff3cdd..00000000 --- a/.github/workflows/check_bot.yml +++ /dev/null @@ -1,18 +0,0 @@ -### .github/workflows/dependabot_pr.yml -### This workflow doesn't have access to secrets and has a read-only token -name: Dependabot PR Check (check if human made this) -on: - push: - paths: - - poetry.lock - - pyproject.toml - workflow_dispatch: - -jobs: - check-dependabot: - runs-on: ubuntu-latest - if: ${{ github.actor == 'dependabot[bot]' }} - steps: - - run: echo "PR created by Dependabot" - - \ No newline at end of file diff --git a/.github/workflows/check_human.yml b/.github/workflows/check_human.yml deleted file mode 100644 index 6384cdf4..00000000 --- a/.github/workflows/check_human.yml +++ /dev/null @@ -1,16 +0,0 @@ -### .github/workflows/dependabot_pr.yml -### This workflow doesn't have access to secrets and has a read-only token -name: Dependabot PR Check -on: - push: - paths: - - poetry.lock - - pyproject.toml - workflow_dispatch: - -jobs: - manual-run: - if: ${{ github.actor != 'dependabot[bot]' }} - uses: ./.github/workflows/env_test.yml - - \ No newline at end of file diff --git a/.github/workflows/env_test.yml b/.github/workflows/env_test.yml index c8182678..6d7244bd 100644 --- a/.github/workflows/env_test.yml +++ b/.github/workflows/env_test.yml @@ -1,26 +1,37 @@ -name: Environment Test +name: pytest on: - workflow_call: + workflow_run: + workflows: ["Dependabot PR Check"] + types: + - completed + push: + paths: + - poetry.lock + - pyproject.toml jobs: - build: + dependabot-check: + if: ${{ github.event.workflow_run.conclusion == 'success' || github.actor != 'dependabot[bot]' }} strategy: matrix: os: [ubuntu-latest, windows-latest, macos-latest] - python-version: ["3.9", "3.10"] + python-version: ["3.12"] runs-on: ${{ matrix.os }} steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - name: Install dependencies - run: | - python -m pip install --upgrade pip poetry - poetry install - - name: Run test - env: - NAS_CREDS: ${{ secrets.NAS_CREDS_JSON }} - run: | - poetry run python -m pytest pyha_tests -rP \ No newline at end of file + - uses: actions/checkout@v3 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v3 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install pytest + pip install poetry + poetry install + - name: Test + env: + NAS_CREDS: ${{ secrets.NAS_CREDS }} + run: | + python -m pytest tests/ \ No newline at end of file diff --git a/.github/workflows/env_test_bot.yml b/.github/workflows/env_test_bot.yml index bd0f1222..ea931ad8 100644 --- a/.github/workflows/env_test_bot.yml +++ b/.github/workflows/env_test_bot.yml @@ -1,21 +1,10 @@ -### .github/workflows/dependabot_automerge.yml -### This workflow has access to secrets and a read-write token -name: Dependabot Automerge -on: - workflow_run: - workflows: ["Dependabot PR Check"] - types: - - completed +name: Dependabot PR Check -permissions: - # down scope as necessary via https://docs.github.com/en/actions/reference/authentication-in-a-workflow#modifying-the-permissions-for-the-github_token +on: pull_request_target jobs: - env-test: - #if: ${{ github.event.workflow_run.conclusion == 'success' }} - uses: ./.github/workflows/env_test.yml - - # env-test: - # #if: ${{ github.event.workflow_run.conclusion == 'success' }} - # uses: ./.github/workflows/env_test.yml - \ No newline at end of file + check-dependabot: + runs-on: ubuntu-latest + if: ${{ github.actor == 'dependabot[bot]' }} + steps: + - run: echo "PR created by Dependabot" \ No newline at end of file From 8b81ab25696f1046a261e8b13db6639a12b4e197 Mon Sep 17 00:00:00 2001 From: Sean Perry Date: Thu, 30 May 2024 13:42:15 -0700 Subject: [PATCH 07/12] Update pyproject.toml --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 5b003d30..1ce31e22 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [tool.poetry] name = "PyHa" version = "0.0.0" -description = "PyHa test test" +description = "PyHa test test test" authors = [ "UCSD Engineers for Exploration ", "Jacob Ayers ", From 73154b449acd355fe3250f640546ac72225b2281 Mon Sep 17 00:00:00 2001 From: Sean Perry Date: Thu, 30 May 2024 13:44:10 -0700 Subject: [PATCH 08/12] fix: indent error --- .github/workflows/env_test.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/env_test.yml b/.github/workflows/env_test.yml index 6d7244bd..257d0480 100644 --- a/.github/workflows/env_test.yml +++ b/.github/workflows/env_test.yml @@ -6,9 +6,9 @@ on: types: - completed push: - paths: - - poetry.lock - - pyproject.toml + paths: + - poetry.lock + - pyproject.toml jobs: dependabot-check: From 4db7154c3ca48bad625b7d60162a0f5051a64adf Mon Sep 17 00:00:00 2001 From: Sean Perry Date: Thu, 30 May 2024 13:44:31 -0700 Subject: [PATCH 09/12] Update pyproject.toml --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 1ce31e22..b055b6ca 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [tool.poetry] name = "PyHa" version = "0.0.0" -description = "PyHa test test test" +description = "PyHa test test test test" authors = [ "UCSD Engineers for Exploration ", "Jacob Ayers ", From 42b063936915ad512c841c94b85280b4749f0578 Mon Sep 17 00:00:00 2001 From: Sean Perry Date: Thu, 30 May 2024 13:47:20 -0700 Subject: [PATCH 10/12] Update env_test.yml --- .github/workflows/env_test.yml | 31 ++++++++++++++----------------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/.github/workflows/env_test.yml b/.github/workflows/env_test.yml index 257d0480..42a272ab 100644 --- a/.github/workflows/env_test.yml +++ b/.github/workflows/env_test.yml @@ -16,22 +16,19 @@ jobs: strategy: matrix: os: [ubuntu-latest, windows-latest, macos-latest] - python-version: ["3.12"] + python-version: ["3.9", "3.10"] runs-on: ${{ matrix.os }} steps: - - uses: actions/checkout@v3 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v3 - with: - python-version: ${{ matrix.python-version }} - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install pytest - pip install poetry - poetry install - - name: Test - env: - NAS_CREDS: ${{ secrets.NAS_CREDS }} - run: | - python -m pytest tests/ \ No newline at end of file + - uses: actions/checkout@v4 + - uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip poetry + poetry install + - name: Run test + env: + NAS_CREDS: ${{ secrets.NAS_CREDS_JSON }} + run: | + poetry run python -m pytest pyha_tests -rP \ No newline at end of file From 0ea8e145b5e0c79b11be8b7ce4ad9b6e4ee84a4d Mon Sep 17 00:00:00 2001 From: Sean Perry Date: Thu, 30 May 2024 13:47:28 -0700 Subject: [PATCH 11/12] Update pyproject.toml --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index b055b6ca..8678ba91 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [tool.poetry] name = "PyHa" version = "0.0.0" -description = "PyHa test test test test" +description = "PyHa test test test test test" authors = [ "UCSD Engineers for Exploration ", "Jacob Ayers ", From 659b50beb2e9999b2535640dd931f04f0f28ba58 Mon Sep 17 00:00:00 2001 From: Sean Perry Date: Thu, 30 May 2024 13:56:07 -0700 Subject: [PATCH 12/12] fix: cleanup --- .github/workflows/env_test.yml | 2 +- pyproject.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/env_test.yml b/.github/workflows/env_test.yml index 42a272ab..f2109c4e 100644 --- a/.github/workflows/env_test.yml +++ b/.github/workflows/env_test.yml @@ -11,7 +11,7 @@ on: - pyproject.toml jobs: - dependabot-check: + build: if: ${{ github.event.workflow_run.conclusion == 'success' || github.actor != 'dependabot[bot]' }} strategy: matrix: diff --git a/pyproject.toml b/pyproject.toml index 8678ba91..787f532c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [tool.poetry] name = "PyHa" version = "0.0.0" -description = "PyHa test test test test test" +description = "PyHa" authors = [ "UCSD Engineers for Exploration ", "Jacob Ayers ",