Skip to content

Commit

Permalink
Update package and add workflow for testing and deployment
Browse files Browse the repository at this point in the history
- add testing workflow
- add contributing guidelines
- use previous annotation style
  • Loading branch information
awvwgk committed Sep 17, 2022
1 parent 32b2d04 commit ccf3815
Show file tree
Hide file tree
Showing 8 changed files with 442 additions and 36 deletions.
2 changes: 2 additions & 0 deletions .github/dco.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
require:
members: false
153 changes: 153 additions & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
name: CI

on:
push:
pull_request:
release:
types: [published]

jobs:
pip:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
python: ["3.6", "3.7", "3.8", "3.9", "3.10"]

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Select Python
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python }}

- name: Install dependencies
run: >-
pip install
-r requirements.txt
pytest pytest-cov
requests
tomli
- name: Install project
run: pip install . -v --no-deps

- name: Test package
run: pytest tests/ --pyargs pyfpm --doctest-modules --cov=pyfpm -v

- name: Upload coverage report
uses: codecov/codecov-action@v2

sdist:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Select Python
uses: actions/setup-python@v3
with:
python-version: "3.x"

- name: Create source distribution
run: pipx run build . --sdist --outdir .

- uses: actions/upload-artifact@v3
with:
name: pyfpm-sdist
path: ./*.tar.gz
retention-days: 5

wheel:
needs:
- sdist
runs-on: ubuntu-latest
steps:
- name: Download sdist
uses: actions/download-artifact@v2
with:
name: pyfpm-sdist

- name: Select Python
uses: actions/setup-python@v3
with:
python-version: "3.x"

- name: Build wheel
run: |
tar xvf ./*.tar.gz
pipx run build ./*/ --wheel --outdir .
- name: Upload wheel
uses: actions/upload-artifact@v3
with:
name: pyfpm-wheel
path: ./*.whl
retention-days: 5

schema:
needs:
- sdist
runs-on: ubuntu-latest
steps:
- name: Download sdist
uses: actions/download-artifact@v2
with:
name: pyfpm-sdist

- name: Select Python
uses: actions/setup-python@v3
with:
python-version: "3.x"

- name: Export schema
run: |
set -ex
pip install ./*.tar.gz
VERSION=$(pip show pyfpm | awk '/Version/ {print $2}')
python -c "${{ env.script }}" > "pyfpm-${VERSION}.json"
env:
script: |
from pyfpm.models import Manifest
print(Manifest.schema_json(indent=2))
- name: Upload schema
uses: actions/upload-artifact@v3
with:
name: pyfpm-schema
path: ./*.json
retention-days: 5

release:
needs:
- sdist
- wheel
- schema
runs-on: ubuntu-latest
steps:
- name: Download artifacts
uses: actions/download-artifact@v2
with:
path: ${{ github.workspace }} # This will download all files

- name: Create SHA256 checksums
run: |
set -ex
for output in pyfpm*/pyfpm*; do
pushd $(dirname "$output")
sha256sum $(basename "$output") | tee $(basename "$output").sha256
popd
done
- name: Upload assets
uses: svenstaro/upload-release-action@v2
if: ${{ github.event_name == 'release' }}
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: pyfpm*/pyfpm*
file_glob: true
tag: ${{ github.ref }}
overwrite: true
124 changes: 124 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
# Contributing to pyfpm

First off, thank you for considering contributing to pyfpm.
Please take a moment to review this guidelines to make the contribution process
simple and effective for all involved.

Respecting these guidelines helps communicate that you respect the time of
the developers who manage and develop this open source project.
In return, they should return this respect by addressing your problem,
evaluating changes, and helping you handle your pull requests.


## Reporting a Bug

A bug is a _demonstratable problem_ caused by the code in this repository.
Good bug reports are extremely valuable for us - thank you!

Before opening a bug report:

1. Check if the issue has already been reported.
2. Check if it still is an issue or has already been fixed?
Try to reproduce it with the latest version from the default branch.
3. Isolate the problem and create a reduced test case.

A good bug report should not leave others needing to chase you up for more
information. So please try to be as detailed as possible in your report,
answer at least these questions:

1. Which version of pyfpm are you using? The current version is always
a subject to change, so be more specific.
2. What steps will reproduce the issue?
We have to reproduce the issue, so we need all the input files.
3. What would be the expected outcome?
4. What did you see instead?

All these details will help people to fix any potential bugs.


## Suggesting a New Feature

Feature requests are welcome. But take a moment to find out if your idea fits
the scope and goals of the project. It is up to you to provide a strong
argument to convince the project's developers of the benefits of this feature.
Please provide as much detail and context as possible.


## Implementing a New Feature

Contributions are welcome via GitHub pull requests.

- Each pull request should implement _one_ feature or fix _one_ bug.
If you want to add or fix more than one thing, submit more than one
pull request.
- Do not commit changes to files that are irrelevant to your feature or
bugfix (_e.g._ `.gitignore`).
- Be willing to accept criticism and work on improving your code.


### For New Contributors

If you never created a pull request before, welcome :tada:.
You can learn how from
[this great tutorial](https://app.egghead.io/courses/how-to-contribute-to-an-open-source-project-on-github).

Don't know where to start?
You can start by looking through these [issues](https://github.com/awvwgk/pyfpm/issues).


## Sign Your Work

The sign-off is a simple line at the end of the explanation for a commit. All
commits needs to be signed. Your signature certifies that you wrote the patch or
otherwise have the right to contribute the material. The rules are pretty simple,
if you can certify the below (from [developercertificate.org](https://developercertificate.org/)):

```
Developer Certificate of Origin
Version 1.1
Copyright (C) 2004, 2006 The Linux Foundation and its contributors.
1 Letterman Drive
Suite D4700
San Francisco, CA, 94129
Everyone is permitted to copy and distribute verbatim copies of this
license document, but changing it is not allowed.
Developer's Certificate of Origin 1.1
By making a contribution to this project, I certify that:
(a) The contribution was created in whole or in part by me and I
have the right to submit it under the open source license
indicated in the file; or
(b) The contribution is based upon previous work that, to the best
of my knowledge, is covered under an appropriate open source
license and I have the right under that license to submit that
work with modifications, whether created in whole or in part
by me, under the same open source license (unless I am
permitted to submit under a different license), as indicated
in the file; or
(c) The contribution was provided directly to me by some other
person who certified (a), (b) or (c) and I have not modified
it.
(d) I understand and agree that this project and the contribution
are public and that a record of the contribution (including all
personal information I submit with it, including my sign-off) is
maintained indefinitely and may be redistributed consistent with
this project or the open source license(s) involved.
```

Then you just add a line to every git commit message:

```
Signed-off-by: Joe Smith <joe.smith@example.com>
```

Use your real name (sorry, no pseudonyms or anonymous contributions.)

If you set your `user.name` and `user.email` git configs, you can sign your
commit automatically with `git commit -s`.
78 changes: 75 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,8 +1,24 @@
Python model of the Fortran package manager
===========================================

.. image:: https://img.shields.io/github/v/release/awvwgk/pyfpm
:alt: Latest release
:target: https://github.com/awvwgk/pyfpm/releases/latest

.. image:: https://img.shields.io/github/license/awvwgk/pyfpm
:alt: License
:target: LICENSE

.. image:: https://github.com/awvwgk/pyfpm/actions/workflows/CI.yml/badge.svg
:alt: CI status
:target: https://github.com/awvwgk/pyfpm/actions/workflows/CI.yml

.. image:: https://img.shields.io/codecov/c/gh/awvwgk/pyfpm
:alt: Codecov
:target: https://codecov.io/gh/awvwgk/pyfpm

This project provides a pydantic model of the fpm package manifest format used
in the `Fortran package manager <https://github.com/fortran-lang/fpm>`_.
in the `Fortran package manager <https://fpm.fortran-lang.org>`_.


Installation
Expand All @@ -12,7 +28,7 @@ Install this project with pip

.. code:: shell
pip install -e .
pip install .
Usage
Expand All @@ -24,7 +40,7 @@ in Python

.. code:: python
>>> from pyfpm.model import Manifest
>>> from pyfpm.models import Manifest
>>> from tomlkit import loads
>>> with open("fpm.toml") as fh:
... package = Manifest(**loads(fh.read()))
Expand All @@ -35,6 +51,62 @@ in Python
'0.2.0'
Development
-----------

This project is hosted on GitHub at `awvwgk/pyfpm <https://github.com/awvwgk/pyfpm>`__.
Obtain the source by cloning the repository with

.. code::
git clone https://github.com/awvwgk/pyfpm
cd pyfpm
We recommend using a `conda <https://conda.io/>`__ environment to install the package.
You can setup the environment manager using a `mambaforge <https://github.com/conda-forge/miniforge>`__ installer.
Install the required dependencies from the conda-forge channel.

.. code::
mamba env create -n devel -f environment.yml
mamba activate devel
Install this project with pip in the environment

.. code::
pip install .
Add the option ``-e`` for installing in development mode.

The following dependencies are required

- `pydantic <https://pydantic-docs.helpmanual.io/>`__
- `tomli <https://https://github.com/hukkin/tomli>`__ (tests only)
- `requests <https://requests.readthedocs.io>`__ (tests only)
- `pytest <https://docs.pytest.org/>`__ (tests only)

You can check your installation by running the test suite with

.. code::
pytest tests/ --pyargs pyfpm --doctest-modules
For code formatting `black <https://black.readthedocs.io/>`_ is used:

.. code:: shell
black src/ tests/
Contributing
------------

This is a volunteer open source projects and contributions are always welcome.
Please, take a moment to read the `contributing guidelines <CONTRIBUTING.md>`__.


License
-------

Expand Down
Loading

0 comments on commit ccf3815

Please sign in to comment.