Skip to content

Commit

Permalink
ci: Migration to GitHub (#1)
Browse files Browse the repository at this point in the history
* ci: Added pipelines and replaced poetry as package handler

* ci: Updated pipelines and version references.

* ci(pyproject.toml): Updated version reference in commitizen field

* ci(poetry.lock): Updated poetry files

* ci(pyproject.toml): Stable toml without matplotlib

* ci(pyproject.toml): Updated toml with matplotlib dependency

* ci(.pre-commit-config.yaml): Added pre-commit hook to git repo

* ci(.github/workflows/docs.yml): Modified docs pipeline to build sphinx docs

* ci(__init__.py): Corrected silly typo

* test(tests/): Fixed some failing tests due to local directories and path handling

* test(tests/): Ignored tests which contain sensible data

* test(tests/test_data): Added test data files

* ci(pyproject.toml): Changed dependency python into 3.7 for win run

* ci(pyproject.tom;poetry.lock): Added poetry2conda dependency to forge correctly

* ci(tests/): Removed duplicated dependency on environment.yml, added shapely forge

* ci(pyproject.toml): Made netcdf4 version fixed

Former-commit-id: 8f384a7
  • Loading branch information
Carsopre authored Nov 29, 2021
1 parent b9f1559 commit bf56fca
Show file tree
Hide file tree
Showing 26 changed files with 2,653 additions and 541 deletions.
66 changes: 66 additions & 0 deletions .github/workflows/bumpversion.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: Bump version

on:
push:
branches:
- master

jobs:
bump-version:
if: "!startsWith(github.event.head_commit.message, 'bump:')"
runs-on: ubuntu-latest
name: "Bump version and create changelog with commitizen"
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: 3.8

- name: Run image
uses: abatilo/[email protected]
with:
poetry-version: 1.1.8
- name: Cache Poetry virtualenv
uses: actions/cache@v1
id: cache
with:
path: ~/.virtualenvs
key: venv-${{ matrix.os }}-${{ matrix.python-version }}-${{ hashFiles('**/poetry.lock') }}
restore-keys: |
venv-${{ matrix.os }}-${{ matrix.python-version }}-
- name: Set Poetry config
run: |
poetry config virtualenvs.in-project false
poetry config virtualenvs.path ~/.virtualenvs
- name: Install Dependencies
run: poetry install
if: steps.cache.outputs.cache-hit != 'true'

- name: Verify github tags
run: |
git config --global user.name '${{ github.actor }}'
git config --global user.email '${{ github.actor }}@users.noreply.github.com'
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY
git checkout $GITHUB_HEAD_REF
git fetch --all --tags
git tag
# - name: Create bump and changelog
# uses: commitizen-tools/commitizen-action@master
# with:
# github_token: ${{ secrets.GITHUB_TOKEN }}

- name: Create bump and changelog
run: |
poetry run cz bump --changelog
- name: Push changelog, version files and new tag
run: |
git config --global user.name '${{ github.actor }}'
git config --global user.email '${{ github.actor }}@users.noreply.github.com'
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY
git checkout $GITHUB_HEAD_REF
git push --force
git push --tags --force
65 changes: 65 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: ci

on: [push]

jobs:

CI:
strategy:
fail-fast: false
matrix:
python-version: [3.7]
os: [ubuntu-18.04, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}

- name: Run image
uses: abatilo/[email protected]
with:
poetry-version: 1.1.8
- name: Cache Poetry virtualenv
uses: actions/cache@v1
id: cache
with:
path: ~/.virtualenvs
key: venv-${{ matrix.os }}-${{ matrix.python-version }}-${{ hashFiles('**/poetry.lock') }}
restore-keys: |
venv-${{ matrix.os }}-${{ matrix.python-version }}-
- name: Set Poetry config
run: |
poetry config virtualenvs.in-project false
poetry config virtualenvs.path ~/.virtualenvs
- name: Install Dependencies
run: poetry install
if: steps.cache.outputs.cache-hit != 'true'

- name: Test with pytest
run: poetry run pytest --cov . --cov-report xml:coverage-reports/coverage-fm2prof-src.xml --junitxml=xunit-reports/xunit-result-fm2prof-src.xml

- name: Autoformat code if the check fails
if: ${{ (matrix.os == 'ubuntu-18.04') && (matrix.python-version == 3.8) }}
run: |
poetry run isort .
poetry run black .
git config --global user.name '${{ github.actor }}'
git config --global user.email '${{ github.actor }}@users.noreply.github.com'
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY
git checkout $GITHUB_HEAD_REF
git commit -am "autoformat: isort & black" && git push || true
- name: SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@master
if: ${{ (matrix.os == 'ubuntu-18.04') && (matrix.python-version == 3.8) }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
40 changes: 40 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: docs
on:
push:
branches:
- master
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: 3.8

- name: Run image
uses: abatilo/[email protected]
with:
poetry-version: 1.1.8
- name: Cache Poetry virtualenv
uses: actions/cache@v1
id: cache
with:
path: ~/.virtualenvs
key: venv-${{ matrix.os }}-${{ matrix.python-version }}-${{ hashFiles('**/poetry.lock') }}
restore-keys: |
venv-${{ matrix.os }}-${{ matrix.python-version }}-
- name: Set Poetry config
run: |
poetry config virtualenvs.in-project false
poetry config virtualenvs.path ~/.virtualenvs
- name: Install Dependencies
run: poetry install
if: steps.cache.outputs.cache-hit != 'true'

- name: Build SPHINX docs
uses: ammaraskar/sphinx-action@master
with:
docs-folder: "docs/"
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.vscode
.pytest_cache
**__pycache__**
6 changes: 6 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
repos:
- repo: https://github.com/commitizen-tools/commitizen
rev: v2.20.0
hooks:
- id: commitizen
stages: [commit-msg]
File renamed without changes.
3 changes: 1 addition & 2 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,14 @@ name: fm2prof
channels:
- defaults
dependencies:
- python=3.6
- python=3.7
- netCDF4
- scipy
- numpy
- pandas
- matplotlib
- shapely
- pylint
- netcdf4
- scikit-learn
- pytest
- jupyter
Expand Down
4 changes: 3 additions & 1 deletion fm2prof/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
__version__ = "1.4.3"

from fm2prof.Fm2ProfRunner import Project
from fm2prof import utils
from fm2prof import utils
Loading

0 comments on commit bf56fca

Please sign in to comment.