-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Enable code analysis by GitHub's CodeQL (#186) * examples: fix rendering of RST code-blocks in notebooks (#179) (#184) * Fix call to pipwin executable during PyPI installation (#187) * `snlls`: Fix violation of boundaries due to float-point round-off errors (#188) * docs: fix automated example plots in the models reference (#190) * VERSION: bump to v0.13.2 * Implement automated PyPI and Anaconda build and publish workflow (#185) * Update CHANGELOG for v0.13.2
- Loading branch information
Showing
21 changed files
with
329 additions
and
59 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
FROM continuumio/miniconda3:4.7.10 | ||
|
||
LABEL "repository"="https://github.com/m0nhawk/conda-package-publish-action" | ||
LABEL "maintainer"="Andrew Prokhorenkov <andrew.prokhorenkov@gmail.com>" | ||
|
||
RUN conda install -y anaconda-client conda-build | ||
|
||
|
||
COPY entrypoint.sh /entrypoint.sh | ||
RUN chmod +x /entrypoint.sh | ||
ENTRYPOINT ["/entrypoint.sh"] |
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,63 @@ | ||
# Build and Publish Anaconda Package | ||
|
||
A Github Action to publish your software package to an Anaconda repository. | ||
|
||
### Example workflow to publish to conda every time you make a new release | ||
|
||
```yaml | ||
name: publish_conda | ||
|
||
on: | ||
release: | ||
types: [published] | ||
|
||
jobs: | ||
publish: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v1 | ||
- name: publish-to-conda | ||
uses: maxibor/conda-package-publish-action@v1.1 | ||
with: | ||
subDir: 'conda' | ||
AnacondaToken: ${{ secrets.ANACONDA_TOKEN }} | ||
platforms: 'win-64 osx-64 linux-64' | ||
python: '3.6 3.8' | ||
``` | ||
### Example project structure | ||
``` | ||
. | ||
├── LICENSE | ||
├── README.md | ||
├── myproject | ||
│ ├── __init__.py | ||
│ └── myproject.py | ||
├── conda | ||
│ ├── build.sh | ||
│ └── meta.yaml | ||
├── .github | ||
│ └── workflows | ||
│ └── publish_conda.yml | ||
├── .gitignore | ||
``` | ||
### Inputs | ||
|
||
The action takes the following | ||
|
||
- `AnacondaToken` - Anaconda access Token (see below) | ||
|
||
- `subDir` - (Optional) Sub-directory with conda recipe. Default: `.` | ||
|
||
- `platforms` - (Optional) Platforms to build and publish. Default: `win-64 osx-64 linux-64`. | ||
|
||
- `python` - (Optional) Python versions to build and publish. Default: `3.8`. | ||
|
||
### ANACONDA_TOKEN | ||
|
||
1. Get an Anaconda token (with read and write API access) at `anaconda.org/USERNAME/settings/access` | ||
2. Add it to the Secrets of the Github repository as `ANACONDA_TOKEN` | ||
|
||
### Build Channels | ||
By Default, this Github Action will search for conda build dependancies (on top of the standard channels) in `conda-forge` and `bioconda` |
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,21 @@ | ||
name: 'Publish Conda package to Anaconda.org' | ||
description: 'Build and Publish conda package to Anaconda' | ||
author: 'Andrew Prokhorenkov, modified by Maxime Borry, modified by Luis Fabregas' | ||
branding: | ||
icon: 'package' | ||
color: 'purple' | ||
inputs: | ||
subDir: | ||
description: 'Sub-directory with conda recipe' | ||
default: '.' | ||
AnacondaToken: | ||
description: 'Anaconda access Token' | ||
platforms: | ||
description: 'Platforms to build and publish [osx linux win]' | ||
default: 'win-64 osx-64 linux-64' | ||
python: | ||
description: 'Python version to build and publish' | ||
default: '3.8' | ||
runs: | ||
using: 'docker' | ||
image: 'Dockerfile' |
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,50 @@ | ||
#!/bin/bash | ||
|
||
set -ex | ||
set -o pipefail | ||
|
||
go_to_build_dir() { | ||
if [ ! -z $INPUT_SUBDIR ]; then | ||
cd $INPUT_SUBDIR | ||
fi | ||
} | ||
|
||
check_if_meta_yaml_file_exists() { | ||
if [ ! -f meta.yaml ]; then | ||
echo "meta.yaml must exist in the directory that is being packaged and published." | ||
exit 1 | ||
fi | ||
} | ||
|
||
build_package(){ | ||
|
||
IFS=' ' read -ra PYTHON <<< "$INPUT_PYTHON" | ||
IFS=' ' read -ra PLATFORMS <<< "$INPUT_PLATFORMS" | ||
|
||
for python in "${PYTHON[@]}"; do | ||
conda build -c conda-forge -c bioconda --output-folder . --python $python . | ||
done | ||
for platform in "${PLATFORMS[@]}"; do | ||
for filename in /$platform/*.tar.bz2; do | ||
conda convert -p $platform linux-64/*.tar.bz2 | ||
done | ||
done | ||
} | ||
|
||
upload_package(){ | ||
|
||
IFS=' ' read -ra PLATFORMS <<< "$INPUT_PLATFORMS" | ||
|
||
export ANACONDA_API_TOKEN=$INPUT_ANACONDATOKEN | ||
|
||
for platform in "${PLATFORMS[@]}"; do | ||
for filename in ./"$platform"/*.tar.bz2; do | ||
anaconda upload $filename | ||
done | ||
done | ||
} | ||
|
||
go_to_build_dir | ||
check_if_meta_yaml_file_exists | ||
build_package | ||
upload_package |
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 @@ | ||
name: "CodeQL" | ||
|
||
on: | ||
push: | ||
branches: [ main, release/v0.13.0 ] | ||
pull_request: | ||
# The branches below must be a subset of the branches above | ||
branches: [ main ] | ||
schedule: | ||
- cron: '33 11 * * 0' | ||
|
||
jobs: | ||
analyze: | ||
name: Analyze | ||
runs-on: ubuntu-latest | ||
permissions: | ||
actions: read | ||
contents: read | ||
security-events: write | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
language: [ 'python' ] | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
|
||
# Initializes the CodeQL tools for scanning. | ||
- name: Initialize CodeQL | ||
uses: github/codeql-action/init@v1 | ||
with: | ||
languages: ${{ matrix.language }} | ||
# If you wish to specify custom queries, you can do so here or in a config file. | ||
# By default, queries listed here will override any specified in a config file. | ||
# Prefix the list here with "+" to use these queries and those in the config file. | ||
# queries: ./path/to/local/query, your-org/your-repo/queries@main | ||
|
||
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java). | ||
# If this step fails, then you should remove it and run the build manually (see below) | ||
- name: Autobuild | ||
uses: github/codeql-action/autobuild@v1 | ||
|
||
# ℹ️ Command-line programs to run using the OS shell. | ||
# 📚 https://git.io/JvXDl | ||
|
||
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines | ||
# and modify them (or add more) to build your code if your project | ||
# uses a compiled language | ||
|
||
#- run: | | ||
# make bootstrap | ||
# make release | ||
|
||
- name: Perform CodeQL Analysis | ||
uses: github/codeql-action/analyze@v1 |
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 @@ | ||
name: Build & Upload Python Package | ||
|
||
on: | ||
release: | ||
types: [published] | ||
|
||
jobs: | ||
|
||
pypi-build-n-publish: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v1 | ||
- name: Set up Python 3.8 | ||
uses: actions/setup-python@v1 | ||
with: | ||
python-version: 3.8 | ||
- name: Install dependencies | ||
run: | | ||
apt-get install python3-pip -y | ||
python -m pip install setuptools --user | ||
python -m pip install build --user | ||
python -m pip install twine --user | ||
python -m pip install conda --user | ||
- name: PyPI - Build and publish | ||
run: | | ||
python setup.py sdist | ||
python -m twine upload dist/* | ||
- name: Publish distribution to PyPI | ||
uses: pypa/gh-action-pypi-publish@master | ||
with: | ||
password: ${{ secrets.PYPI_API_TOKEN }} | ||
|
||
conda-build-n-publish: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v1 | ||
- name: Set up Python 3.8 | ||
uses: actions/setup-python@v1 | ||
with: | ||
python-version: 3.8 | ||
- name: Get DeerLab version | ||
run: echo "DEERLAB_VERSION=$(cat VERSION)" >> $GITHUB_ENV | ||
- name: Update version in Conda metadata | ||
uses: jacobtomlinson/gha-find-replace@master | ||
with: | ||
find: "VERSION" | ||
replace: ${{env.DEERLAB_VERSION}} | ||
include: "conda.recipe/meta.yaml" | ||
- name: Build & Publish to Anaconda | ||
uses: ./.github/actions/conda_build_publish_package | ||
with: | ||
subdir: 'conda.recipe' | ||
anacondatoken: ${{ secrets.ANACONDA_TOKEN }} | ||
platforms: 'osx-64 linux-32 linux-64 win-32 win-64' | ||
python: '3.6 3.7 3.8 3.9' |
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 |
---|---|---|
@@ -1 +1 @@ | ||
v0.13.1 | ||
v0.13.2 |
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 @@ | ||
$PYTHON setup.py install # Python command to install the script. |
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
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
Oops, something went wrong.