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

Add files for building and publishing NPM and PyPi package #350

Merged
merged 43 commits into from
Oct 25, 2021

Conversation

MantisClone
Copy link
Contributor

@MantisClone MantisClone commented Sep 29, 2021

Towards #348

Changes proposed in this PR:

  • Add npm-publish workflow
  • Add python-publish workflow. This workflow edits the artifacts/ directory to contain valid python modules.
    • Fix directory names by replacing . with _
    • Add __init__.py files to every directory
  • Add files for building and publishing python package
    • pyproject.toml is needed for the python -m build command to work
    • setup.cfg defines the PyPi metadata and directories to include in the sdist/wheel
  • Update version format to v1.0.0-alpha.1. See for details: Release an alpha version of the Ocean Contracts to PyPi #348 (comment)
  • Added .bumpversion.cfg and bumpversion.sh script to keep the npm and python package versions in sync

Reusable Workflows

This PR makes the ci workflow "reusable" meaning it can be called from other workflows (even ones in other repositories). Both the npm-publish and python-publish workflows call the ci workflow.

The reference to a workflow must be a valid branch, tag, or commit, so I've selected v4main as the ref. But, the ci workflow on v4main is currently not reusable, and so the npm/python-publish workflows fail with the following error:

handling usage of workflow "oceanprotocol/contracts/.github/workflows/ci.yml@v4main": workflow is not callable as it is missing a `on.workflow_call` trigger

This error will be resolved once this PR is merged to v4main.

Python Package Contents

The sdist and wheel packages contain identical contents, shown below.

├── addresses
│   ├── address.json
│   └── __init__.py
├── artifacts
│   ├── contracts
│   │   ├── communityFee
│   │   │   ├── __init__.py
│   │   │   └── OPFCommunityFeeCollector_sol  <- Notice the `_` instead of `.`
│   │   │       ├── __init__.py
│   │   │       ├── OPFCommunityFeeCollector.dbg.json
│   │   │       └── OPFCommunityFeeCollector.json

... directory contents omitted for brevity, mirror the structure of communityFee seen above
│   ├── @balancer-labs
│   ├── build-info
│   ├── hardhat
│   ├── __init__.py
│   ├── @openzeppelin
│   └── solidity-bytes-utils
...

├── ocean_contracts.egg-info
│   ├── dependency_links.txt
│   ├── PKG-INFO
│   ├── SOURCES.txt
│   └── top_level.txt
├── PKG-INFO
├── pyproject.toml
├── README.md
└── setup.cfg

@MantisClone
Copy link
Contributor Author

MantisClone commented Oct 6, 2021

@alexcos20 requested change: Only execute the python-publish workflow if all the CI tests pass. EDIT: We hacked together a first attempt. I still need to clean it up and test it.

David Hunt-Mateo added 20 commits October 6, 2021 21:59
This reverts commit 75c7f85.
Removing this dependency allows the lint and full_test to run parallel
…st in main"

This reverts commit 71319df.
This commit proved that the workflow file could be successfully parsed.
However, the ref should be the main branch when this gets merged to main
  * Download "coverage" artifact failed to overwrite coverage directory
This reverts commit 894c833.
Attempt didn't fix the CI.coverage workflow
@MantisClone MantisClone changed the title Add files for building and publishing PyPi package Add files for building and publishing NPM and PyPi package Oct 11, 2021
@MantisClone
Copy link
Contributor Author

I believe this PR is complete and ready to be reviewed.

@MantisClone
Copy link
Contributor Author

@alexcos20 requested change: Add bump version script to keep NPM version and PyPi version in sync.

@MantisClone
Copy link
Contributor Author

MantisClone commented Oct 20, 2021

@alexcos20
Per your request, I've added bumpversion files to keep npm and python version numbers in sync.

I also fixed a bug where the sdist package contained the address.json file, but the wheel package did not. Now, both the sdist and the wheel package contain the address.json

And finally, I merged #367 into this branch because the presence of the coverage/ directory was messing up the CI coverage workflow. EDIT: Unfortunately, that means this PR is difficult to review because there are over a hundred files deleted. Once #367 is merged, this PR will be easier to review.

David Hunt-Mateo added 6 commits October 20, 2021 18:31
…ranch)"

This reverts commit b535088.

Workflow printed the following error:

handling usage of workflow "oceanprotocol/contracts/.github/workflows/ci.yml@HEAD": can't obtain workflow file: reference to workflow should be either a valid branch, tag, or commit
@alexcos20 alexcos20 merged commit 23a0a83 into v4main Oct 25, 2021
@alexcos20 alexcos20 deleted the issue348-add-release-workflow branch October 25, 2021 13:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Release an alpha version of the Ocean Contracts to PyPi
2 participants