Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/forge py implementation #7

Merged
merged 6 commits into from
Apr 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[flake8]
#ignore = ...
max-line-length=180
1 change: 0 additions & 1 deletion .github/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,6 @@ jobs:
# These are gradle-specific steps for installing the application
- name: Install Software
run: |
pip install setuptools -U
pip install pylint
pip install pytest
poetry install
Expand Down
426 changes: 426 additions & 0 deletions .github/workflows/build.yml

Large diffs are not rendered by default.

63 changes: 63 additions & 0 deletions .github/workflows/release-created.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@

name: Release Branch Created

# Run whenever a ref is created https://docs.github.com/en/actions/reference/events-that-trigger-workflows#create
on:
create

jobs:
# First job in the workflow builds and verifies the software artifacts
bump:
name: Bump minor version on develop
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Only run if ref created was a release branch
if:
${{ startsWith(github.ref, 'refs/heads/release/') }}
steps:
# Checks-out the develop branch
- uses: actions/checkout@v4
with:
ref: 'refs/heads/develop'
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install Poetry
uses: abatilo/actions-poetry@v3
with:
poetry-version: 1.8.1
- name: Bump minor version
env:
COMMIT_VERSION: ${{ github.ref }}
run: |

# only update the develop branch if were making #.#.0 release
# Get the branch name from the GITHUB_REF environment variable
branch_name=${GITHUB_REF#refs/heads/}

# Extract the last number in the branch name using a regular expression
if [[ $branch_name =~ /([0-9]+)\.([0-9]+)\.([0-9]+)$ ]]; then

first_number=${BASH_REMATCH[1]}
middle_number=${BASH_REMATCH[2]}
last_number=${BASH_REMATCH[3]}

# Increment the middle number by 1
incremented_middle_number=$((middle_number + 1))

# Check if the last number is '0'
if [ "$last_number" == "0" ]; then

update_version=$first_number.$incremented_middle_number.$last_number-alpha.1

poetry version $update_version
echo "software_version=$update_version" >> $GITHUB_ENV

git config --global user.name 'podaac-forge-py bot'
git config --global user.email '[email protected]'
git commit -am "/version ${{ env.software_version }}"
git push

fi

fi
34 changes: 34 additions & 0 deletions .github/workflows/wait-for-pypi.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/usr/bin/env python
import sys
import tempfile
import logging
import subprocess

import tenacity

'''
Sometimes the package published to PyPi is not immediately available for download from the index. This script
simply repeatedly tries to download a specific version of a package from PyPI (or test.pypi) until it succeeds or
a limit is exceeded.
'''


@tenacity.retry(
wait=tenacity.wait_exponential(multiplier=1, min=4, max=10),
retry=tenacity.retry_if_exception_type(subprocess.CalledProcessError),
stop=tenacity.stop_after_delay(120),
before_sleep=tenacity.before_sleep_log(logging.getLogger(__name__), logging.DEBUG)
)
def download_package(package):
subprocess.check_call([sys.executable, '-m',
'pip', '--isolated', '--no-cache-dir',
'download', '--no-deps', '-d', tempfile.gettempdir(), '--index-url',
'https://pypi.org/simple/',
'--extra-index-url', 'https://test.pypi.org/simple/', package
])


if __name__ == '__main__':
logging.basicConfig(stream=sys.stderr, level=logging.DEBUG)
package_spec = sys.argv[1]
download_package(package_spec)
Loading
Loading