From 57d7e4aa5d5da2faecc46730629a7049b6bf282d Mon Sep 17 00:00:00 2001 From: Mike Henry <11765982+mikemhenry@users.noreply.github.com> Date: Thu, 15 Feb 2024 20:07:45 -0700 Subject: [PATCH 1/9] detect if API breaks on PR --- .github/workflows/change.yaml | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 .github/workflows/change.yaml diff --git a/.github/workflows/change.yaml b/.github/workflows/change.yaml new file mode 100644 index 000000000..7daf19a1a --- /dev/null +++ b/.github/workflows/change.yaml @@ -0,0 +1,27 @@ +name: Check for API breaks + +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + test: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - uses: actions/setup-python@v4 + with: + python-version: '3.12' + + - run: | + pip install griffe + pip install -e . + griffe check "open" --verbose From c5113d38c4145a432d1bdcad6bcfbb3db43e4d5b Mon Sep 17 00:00:00 2001 From: Mike Henry <11765982+mikemhenry@users.noreply.github.com> Date: Thu, 15 Feb 2024 20:08:56 -0700 Subject: [PATCH 2/9] fix silly typo --- .github/workflows/change.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/change.yaml b/.github/workflows/change.yaml index 7daf19a1a..eda0ce2e9 100644 --- a/.github/workflows/change.yaml +++ b/.github/workflows/change.yaml @@ -24,4 +24,4 @@ jobs: - run: | pip install griffe pip install -e . - griffe check "open" --verbose + griffe check "openfe" --verbose From aac0fce15edb8519d562d6659bfd4969b24e2a34 Mon Sep 17 00:00:00 2001 From: Mike Henry <11765982+mikemhenry@users.noreply.github.com> Date: Thu, 15 Feb 2024 20:32:54 -0700 Subject: [PATCH 3/9] keep working, we will need to check the output --- .github/workflows/change.yaml | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/.github/workflows/change.yaml b/.github/workflows/change.yaml index eda0ce2e9..6b87582cd 100644 --- a/.github/workflows/change.yaml +++ b/.github/workflows/change.yaml @@ -9,19 +9,21 @@ on: - main jobs: - test: + check: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 - - uses: actions/setup-python@v4 + - uses: actions/setup-python@v5 with: - python-version: '3.12' + python-version: "3.12" - - run: | + - name: Check for API breaks + continue-on-error: true + run: | pip install griffe pip install -e . griffe check "openfe" --verbose From cce98065751b94c0108edd1ed4806abae9b000f2 Mon Sep 17 00:00:00 2001 From: Mike Henry <11765982+mikemhenry@users.noreply.github.com> Date: Tue, 5 Nov 2024 09:15:06 -0700 Subject: [PATCH 4/9] comment on PR if the API breaks --- .github/workflows/change.yaml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/.github/workflows/change.yaml b/.github/workflows/change.yaml index 6b87582cd..6b5a6fb9b 100644 --- a/.github/workflows/change.yaml +++ b/.github/workflows/change.yaml @@ -11,6 +11,8 @@ on: jobs: check: runs-on: ubuntu-latest + permissions: + pull-requests: write steps: - uses: actions/checkout@v4 @@ -23,7 +25,21 @@ jobs: - name: Check for API breaks continue-on-error: true + id: check run: | pip install griffe pip install -e . griffe check "openfe" --verbose + + - name: Post Comment on Failure + if: steps.check.outcome == 'failure' + uses: actions/github-script@v7 + with: + script: | + const prNumber = context.payload.pull_request.number; + github.rest.issues.createComment({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: prNumber, + body: '🚨 API breaking changes detected!. 🚨' + }); From 192b5e95f7440b59cf955edeff6d22fea718c5d7 Mon Sep 17 00:00:00 2001 From: Mike Henry <11765982+mikemhenry@users.noreply.github.com> Date: Tue, 5 Nov 2024 09:15:47 -0700 Subject: [PATCH 5/9] fix indent --- .github/workflows/change.yaml | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/workflows/change.yaml b/.github/workflows/change.yaml index 6b5a6fb9b..4f2156f70 100644 --- a/.github/workflows/change.yaml +++ b/.github/workflows/change.yaml @@ -31,15 +31,15 @@ jobs: pip install -e . griffe check "openfe" --verbose - - name: Post Comment on Failure - if: steps.check.outcome == 'failure' - uses: actions/github-script@v7 - with: - script: | - const prNumber = context.payload.pull_request.number; - github.rest.issues.createComment({ - owner: context.repo.owner, - repo: context.repo.repo, - issue_number: prNumber, - body: '🚨 API breaking changes detected!. 🚨' - }); + - name: Post Comment on Failure + if: steps.check.outcome == 'failure' + uses: actions/github-script@v7 + with: + script: | + const prNumber = context.payload.pull_request.number; + github.rest.issues.createComment({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: prNumber, + body: '🚨 API breaking changes detected!. 🚨' + }); From 242f82a8abe0bbcd4ea59c8a44551cd639ba41b3 Mon Sep 17 00:00:00 2001 From: Mike Henry <11765982+mikemhenry@users.noreply.github.com> Date: Tue, 5 Nov 2024 09:26:56 -0700 Subject: [PATCH 6/9] change default --- openfe/analysis/plotting.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openfe/analysis/plotting.py b/openfe/analysis/plotting.py index da880dc85..9fe2fc368 100644 --- a/openfe/analysis/plotting.py +++ b/openfe/analysis/plotting.py @@ -33,7 +33,7 @@ def plot_lambda_transition_matrix(matrix: npt.NDArray) -> Axes: Notes ----- Borrowed from `alchemlyb `_ - which itself borrows from `alchemical-analysis `_. + which itself borrows from `alchemical-analysis `_. """ num_states = len(matrix) @@ -260,7 +260,7 @@ def plot_replica_timeseries( def plot_2D_rmsd(data: list[list[float]], - vmax=5.0) -> plt.Figure: + vmax=6.0) -> plt.Figure: """Plots 2D RMSD for many states Parameters From fb1d497428dfea548a7812faa43caa6dc1c69977 Mon Sep 17 00:00:00 2001 From: Mike Henry <11765982+mikemhenry@users.noreply.github.com> Date: Tue, 5 Nov 2024 09:30:29 -0700 Subject: [PATCH 7/9] reset default back to OG value --- openfe/analysis/plotting.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openfe/analysis/plotting.py b/openfe/analysis/plotting.py index 9fe2fc368..c7f3aad8f 100644 --- a/openfe/analysis/plotting.py +++ b/openfe/analysis/plotting.py @@ -260,7 +260,7 @@ def plot_replica_timeseries( def plot_2D_rmsd(data: list[list[float]], - vmax=6.0) -> plt.Figure: + vmax=5.0) -> plt.Figure: """Plots 2D RMSD for many states Parameters From 090b9b1ad0d1b430be578e25817f65b0b9990d2e Mon Sep 17 00:00:00 2001 From: Mike Henry <11765982+mikemhenry@users.noreply.github.com> Date: Tue, 5 Nov 2024 09:30:58 -0700 Subject: [PATCH 8/9] remove extra '.' --- .github/workflows/change.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/change.yaml b/.github/workflows/change.yaml index 4f2156f70..f1e915522 100644 --- a/.github/workflows/change.yaml +++ b/.github/workflows/change.yaml @@ -41,5 +41,5 @@ jobs: owner: context.repo.owner, repo: context.repo.repo, issue_number: prNumber, - body: '🚨 API breaking changes detected!. 🚨' + body: '🚨 API breaking changes detected! 🚨' }); From 174704aa029cd334b3bee945344e40e096313c8e Mon Sep 17 00:00:00 2001 From: Mike Henry <11765982+mikemhenry@users.noreply.github.com> Date: Mon, 18 Nov 2024 13:48:53 -0700 Subject: [PATCH 9/9] use pull_request_target safely --- .github/workflows/change.yaml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.github/workflows/change.yaml b/.github/workflows/change.yaml index f1e915522..acc25733a 100644 --- a/.github/workflows/change.yaml +++ b/.github/workflows/change.yaml @@ -1,10 +1,7 @@ name: Check for API breaks on: - push: - branches: - - main - pull_request: + pull_request_target: branches: - main @@ -28,7 +25,6 @@ jobs: id: check run: | pip install griffe - pip install -e . griffe check "openfe" --verbose - name: Post Comment on Failure