-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #54 from MeteoSwiss/develop
v0.2.0.dev0
- Loading branch information
Showing
67 changed files
with
958 additions
and
423 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
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
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,55 @@ | ||
# This workflow will check that the code version was increased. | ||
# | ||
# It is triggered for any PR to the master branch. | ||
# | ||
# Warning: the code version must *absolutely* follow a semantic approach, i.e.: | ||
# 10.0.1, 10.0.2.dev0 is valid | ||
# 10.0, 10, is NOT valid ! | ||
# | ||
# Copyright (c) 2022 fpavogt; [email protected] | ||
|
||
name: CI_check_version | ||
|
||
on: | ||
pull_request: | ||
branches: [ master ] | ||
|
||
jobs: | ||
version: | ||
|
||
runs-on: ubuntu-latest | ||
steps: | ||
|
||
- name: Checkout current repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: '3.10' | ||
|
||
- name: Install dependancies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install setuptools | ||
shell: bash | ||
|
||
- name: wget/cp the BASE and HEAD version files | ||
# Here, I could get both the BASE and HEAD files with wget, but cp-ing the HEAD is safer, | ||
# since we have cloned the repo anyway. | ||
run: | | ||
export VERSION_LOC=src/ampycloud/version.py | ||
echo $GITHUB_HEAD_REF | ||
echo $GITHUB_BASE_REF | ||
wget -O base_version.tmp https://raw.githubusercontent.com/$GITHUB_REPOSITORY/$GITHUB_BASE_REF/$VERSION_LOC | ||
cp ./$VERSION_LOC head_version.tmp | ||
shell: bash | ||
|
||
- name: Check if the version was increased | ||
run: | | ||
HEAD_VERSION="$(grep VERSION head_version.tmp | grep -o '[[:alnum:]]*\.[[:alnum:]]*\.[[:alnum:]]*\.\?[[:alnum:]]*')" | ||
echo "HEAD_VERSION:" $HEAD_VERSION | ||
BASE_VERSION="$(grep VERSION base_version.tmp | grep -o '[[:alnum:]]*\.[[:alnum:]]*\.[[:alnum:]]*\.\?[[:alnum:]]*')" | ||
echo "BASE_VERSION:" $BASE_VERSION | ||
python ./.github/workflows/check_version.py $HEAD_VERSION $BASE_VERSION | ||
shell: bash |
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
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
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,57 @@ | ||
# This workflow will push the code onto pypi. | ||
# It assumes that TESTPYPI_API_TOKEN and PYPI_API_TOKEN secrets from GITHUB have been defined | ||
# at the repo or organization levels to upload the package via API authentification. | ||
# | ||
# It will trigger the moment a new release or pre-release is being published. | ||
# | ||
# Copyright (c) 2022 fpavogt; [email protected] | ||
|
||
name: CI_pypi | ||
|
||
on: | ||
release: | ||
types: [published] | ||
|
||
jobs: | ||
pypi: | ||
|
||
runs-on: ubuntu-latest | ||
steps: | ||
|
||
- name: Checkout current repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: '3.10' | ||
|
||
- name: Install dependancies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install setuptools | ||
pip install wheel | ||
pip install twine | ||
shell: bash | ||
|
||
- name: Build the wheels | ||
run: | | ||
python setup.py sdist bdist_wheel | ||
shell: bash | ||
|
||
- name: Deploy to testpypi | ||
# Let's make use of Github secrets to avoid spelling out secret stuff | ||
env: | ||
TESTPYPI_TOKEN: ${{ secrets.TESTPYPI_API_TOKEN }} | ||
# We first go to testpypi to make sure nothing blows up. | ||
run: | | ||
twine upload -r testpypi dist/* --verbose --skip-existing -u __token__ -p "$TESTPYPI_TOKEN" | ||
shell: bash | ||
|
||
- name: Deploy to pypi | ||
# Let's make use of Github secrets to avoid spelling out secret stuff | ||
env: | ||
PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }} | ||
run: | | ||
twine upload dist/* --verbose --skip-existing -u __token__ -p "$PYPI_TOKEN" | ||
shell: bash |
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
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,49 @@ | ||
# -*- coding: utf-8 -*- | ||
''' | ||
Copyright (c) 2022 MeteoSwiss, contributors listed in AUTHORS. | ||
Distributed under the terms of the 3-Clause BSD License. | ||
SPDX-License-Identifier: BSD-3-Clause | ||
This script can be used together with a Github Action to check whether a code version has been | ||
properly incremented. | ||
Created January 2022; F.P.A. Vogt; [email protected] | ||
''' | ||
|
||
import argparse | ||
from pkg_resources import parse_version | ||
|
||
def main(): | ||
''' The main function. ''' | ||
|
||
# Use argparse to allow feeding parameters to this script | ||
parser = argparse.ArgumentParser(description='''Compare the versions between the head and base | ||
branches of the PR. Fails is Head <= Base.''', | ||
epilog='Feedback, questions, comments: \ | ||
[email protected] \n', | ||
formatter_class=argparse.RawTextHelpFormatter) | ||
|
||
parser.add_argument('head', action='store', metavar='version', | ||
help='Head version.') | ||
|
||
parser.add_argument('base', action='store', metavar='version', | ||
help='Base version.') | ||
|
||
# What did the user type in ? | ||
args = parser.parse_args() | ||
|
||
# Print the versions fed by the user, for monitoring | ||
print("Head:", args.head) | ||
print("Base:", args.base) | ||
|
||
if parse_version(args.head) > parse_version(args.base): | ||
print("Version was increased. Well done.") | ||
return True | ||
|
||
raise Exception('Ouch ! Version was not increased ?!') | ||
|
||
if __name__ == '__main__': | ||
|
||
main() |
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
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 |
---|---|---|
|
@@ -2,17 +2,18 @@ | |
''' | ||
Copyright (c) 2020-2021 MeteoSwiss, created by F.P.A. Vogt; [email protected] | ||
Distributed under the terms of the GNU General Public License v3.0 or later. | ||
Distributed under the terms of the 3-Clause BSD License. | ||
SPDX-License-Identifier: GPL-3.0-or-later | ||
SPDX-License-Identifier: BSD-3-Clause | ||
This script can be used together with a Github Action to run pylint on all the .py files in a | ||
repository. Command line arguments can be used to search for a specific subset of errors (if any are | ||
found, this script will raise an Exception), or to ignore some errors in a generic search (which | ||
will print all the errors found, but will not raise any Exception). If a score is specified, the | ||
script will raise an Exception if it is not met. | ||
Created May 2020; F.P.A. Vogt; [email protected] | ||
Created May 2020; fpavogt; [email protected] | ||
Adapted Jan 2022; fpavogt; [email protected] | ||
''' | ||
|
||
import argparse | ||
|
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
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
Oops, something went wrong.