-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Start a new workflow and python script that checks version
This workflow is intended to verify that the version in the branch being merged is higher than the main branch. This is definitely not working and I'm not sure I even want to implement this this way.
- Loading branch information
Showing
2 changed files
with
69 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
name: hatch-tests | ||
|
||
on: | ||
pull_request: | ||
branches: [ "master", "main" ] | ||
paths-ignore: [ "docs/**" ] | ||
|
||
push: | ||
branches: [ "master", "main" ] | ||
paths-ignore: [ "docs/**" ] | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
|
||
test: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout current version | ||
uses: actions/checkout@v4 | ||
path: "current" | ||
|
||
- name: Checkout main version | ||
uses: actions/checkout@v4 | ||
ref: "main" | ||
path: "main" | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.11" | ||
|
||
- name: Compare versions |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import argparse | ||
import importlib | ||
import sys | ||
|
||
from packaging import version | ||
|
||
parser = argparse.ArgumentParser( | ||
prog="compare_versions", | ||
description="Check that the version of the updated path is higher than the version of the main path.", | ||
) | ||
parser.add_argument("--main") | ||
parser.add_argument("--updated") | ||
argv = parser.parse_args() | ||
|
||
# Read in main version | ||
sys.path.insert(0, argv.main) | ||
import anvil_consortium_manager # noqa: E402 | ||
|
||
main_version = version.parse(anvil_consortium_manager.__version__) | ||
print("Main version: " + str(main_version)) | ||
|
||
# Read in current version | ||
|
||
sys.path.insert(0, argv.updated) | ||
importlib.reload(anvil_consortium_manager) | ||
|
||
current_version = version.parse(anvil_consortium_manager.__version__) | ||
print("Updated version: " + str(current_version)) | ||
|
||
if current_version <= main_version: | ||
raise Exception("Updated version is less than or equal to the main version.") | ||
|
||
print("Ok!") |