Skip to content

Commit

Permalink
Test CI on github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
bw4sz committed Aug 7, 2024
1 parent ff3cfad commit 7d7197b
Show file tree
Hide file tree
Showing 5 changed files with 126 additions and 2 deletions.
12 changes: 12 additions & 0 deletions .github/workflows/.readthedocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
version: 2

build:
os: ubuntu-22.04
tools:
python: "3.7"

python:
install:
- requirements: requirements.txt
submodules:
include: all
58 changes: 58 additions & 0 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Python package

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]


jobs:
ci:
name: "CI setup"

strategy:
fail-fast: false
matrix:
python-version:
- "3.12"
- "3.11"
- "3.10"

os:
- "ubuntu-latest"

runs-on: "${{ matrix.os }}"

# use bash everywhere
defaults:
run:
shell: "bash -l {0}"

steps:
- name: "Checkout code"
uses: "actions/checkout@v4"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Run pytest
run: pytest -v

- name: Check style
run: yapf -d --recursive milliontrees/ --style=.style.yapf

- name: Check notebook style
run: nbqa yapf --in-place docs/examples/*.ipynb --style=.style.yapf

# - name: Check notebook build
# run: pytest --nbmake docs/*.ipynb

- name: Run docformatter
run: docformatter --check --recursive milliontrees/

- name: Test Docs
run: |
cd docs && make clean && make html SPHINXOPTS="-W"
39 changes: 39 additions & 0 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# This workflow will upload a Python Package using Twine when a release is created
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

name: Upload Python Package

on:
release:
types: [published]

permissions:
contents: read

jobs:
deploy:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build
- name: Build package
run: python -m build
- name: Publish package
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
[![Github Actions](https://github.com/weecology/MillionTrees/actions/workflows/python-package.yml/badge.svg)](https://github.com/weecology/MillionTrees/actions/workflows/python-package.yml)

[![Documentation Status](https://readthedocs.org/projects/MillionTrees/badge/?version=latest)](http://MillionTrees.readthedocs.io/en/latest/?badge=latest)
[![Version](https://img.shields.io/pypi/v/MillionTrees.svg)](https://pypi.python.org/pypi/MillionTrees)
[![PyPI - Downloads](https://img.shields.io/pypi/dm/MillionTrees)](https://pypi.python.org/pypi/MillionTrees)

[![PyPI](https://img.shields.io/pypi/v/wilds)](https://pypi.org/project/wilds/)
[![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/p-lambda/wilds/blob/master/LICENSE)

# Overview

Expand Down
13 changes: 13 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
numpy>=1.19.1
ogb>=1.2.6
outdated>=0.2.0
pandas>=1.1.0
pillow>=7.2.0
pytz>=2020.4
torch>=1.7.0
torchvision>=0.8.2
tqdm>=4.53.0
scikit-learn>=0.20.0
scipy>=1.5.4
albumentations>=0.5.2
pytest>=6.2.1

0 comments on commit 7d7197b

Please sign in to comment.