Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
gadomski committed Aug 8, 2022
0 parents commit 52c23f9
Show file tree
Hide file tree
Showing 50 changed files with 1,632 additions and 0 deletions.
Empty file added .codespellignore
Empty file.
21 changes: 21 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
.git/
.github/
.gitignore

build/
.mypy_cache/
.pytest_cache/
__pycache__/
*.pyc
*.egg-info/

CHANGELOG.md
CODE_OF_CONDUCT.md
CONTRIBUTING.md
README.md
README-template.md

docker_env

.coverage
coverage.xml
12 changes: 12 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[flake8]
max-line-length = 100

## IGNORES

# E127: flake8 reporting incorrect continuation line indent errors
# on multi-line and multi-level indents

# W503, W504: flake8 reports this as incorrect, but black changes
# code to it, so let black win.

ignore = E127,W503,W504
31 changes: 31 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: bug
assignees: ''

---

**Describe the bug**
A clear and concise description of what the bug is.

**To reproduce**
Steps to reproduce the behavior:

> Ex.
>
> 1. Install stactools-ephemeral
> 2. Run `scripts/test`
> 3. See error
**Expected behavior**
A clear and concise description of what you expected to happen.

**Screenshots and shell session dumps**
If applicable, add session dumps and/or screenshots to help explain your problem.

> ex. `scripts/lint >> lint_errors.txt`
**Additional context**
Add any other context about the problem here.
22 changes: 22 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: enhancement
assignees: ''

---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always
frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen. Ex. I would like to
use stac \<package\> to do [...]

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.
16 changes: 16 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.MD
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
Before you submit a pull request, please fill in the following:

**Related Issue(s):**
Please add links (if any) to related github issues.

**Description:**
Please explain the changes you made here.

**PR checklist:**

- [ ] Code is formatted (run `scripts/format`).
- [ ] Code lints properly (run `scripts/lint`).
- [ ] Tests pass (run `scripts/test`).
- [ ] Documentation has been updated to reflect changes, if applicable.
- [ ] Examples have been updated to reflect changes, if applicable
- [ ] Changes are added to the [CHANGELOG](../CHANGELOG.md).
136 changes: 136 additions & 0 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
name: CI

on:
push:
branches:
- main
pull_request:

env:
DOCKER_REGISTRY: ghcr.io
DOCKER_IMAGE_NAME: ${{ github.repository }}

jobs:
codecov:
name: codecov
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Execute linters and test suites
run: ./docker/cibuild
- name: Upload All coverage to Codecov
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml
fail_ci_if_error: false
python-matrix:
name: python-matrix
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10"]
defaults:
run:
shell: bash -l {0}
steps:
- uses: actions/checkout@v2
- name: Set up conda cache
uses: actions/cache@v2
with:
path: ~/conda_pkgs_dir
key: ${{ runner.os }}-conda-${{ hashFiles('**/environment.yml') }}
restore-keys: ${{ runner.os }}-conda-
- name: Set up pip cache
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.cfg', '**/requirements-dev.txt') }}
restore-keys: ${{ runner.os }}-pip-
- name: Set up Conda with Python ${{ matrix.python-version }}
uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
python-version: ${{ matrix.python-version }}
- name: Update Conda's environemnt
run: conda env update -f environment.yml -n test
- name: Execute linters and test suites
run: ./scripts/cibuild
docker:
name: docker
needs:
- codecov
- python-matrix
permissions:
contents: read
packages: write
runs-on: ubuntu-latest
steps:
- name: Set up Python 3.x
uses: actions/setup-python@v2
with:
python-version: "3.x"
- name: Checkout
uses: actions/checkout@v2
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ${{ env.DOCKER_REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Run rename script if in the template repo
run: |
if [[ "$GITHUB_REPOSITORY" == */template ]]; then
scripts/rename
fi
- name: Source build args
run: |
source ./docker_env
STACTOOLS_VERSION=$(python scripts/stactools-version.py)
echo "stactools_version=$STACTOOLS_VERSION" >> $GITHUB_ENV
echo "docker_workdir=$DOCKER_WORKDIR" >> $GITHUB_ENV
echo "docker_namespace_package_dir=$DOCKER_NAMESPACE_PACKAGE_DIR" >> $GITHUB_ENV
- name: Docker meta main
id: meta-main
uses: docker/metadata-action@v3
with:
images: ${{ env.DOCKER_REGISTRY }}/${{ env.DOCKER_IMAGE_NAME }}
tags: |
type=ref,event=branch
type=ref,event=pr
- name: Build and push main
uses: docker/build-push-action@v2
with:
context: .
file: docker/Dockerfile
build-args: |
STACTOOLS_VERSION=${{ env.stactools_version }}
DOCKER_WORKDIR=${{ env.docker_workdir }}
DOCKER_NAMESPACE_PACKAGE_DIR=${{ env.docker_namespace_package_dir }}
# Don't try to push if the event is a PR from a fork
push: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository }}
tags: ${{ steps.meta-main.outputs.tags }}
labels: ${{ steps.meta-main.outputs.labels }}
- name: Docker meta dev
id: meta-dev
uses: docker/metadata-action@v3
with:
images: ${{ env.DOCKER_REGISTRY }}/${{ env.DOCKER_IMAGE_NAME }}
flavor: |
suffix=-dev
tags: |
type=ref,event=branch
type=ref,event=pr
- name: Build and push dev
uses: docker/build-push-action@v2
with:
context: .
file: docker/Dockerfile-dev
build-args: |
STACTOOLS_VERSION=${{ env.stactools_version }}
DOCKER_WORKDIR=${{ env.docker_workdir }}
DOCKER_NAMESPACE_PACKAGE_DIR=${{ env.docker_namespace_package_dir }}
# Don't try to push if the event is a PR from a fork
push: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository }}
tags: ${{ steps.meta-dev.outputs.tags }}
labels: ${{ steps.meta-dev.outputs.labels }}
114 changes: 114 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
name: Release

on:
push:
tags:
- "*"

env:
DOCKER_REGISTRY: ghcr.io
DOCKER_IMAGE_NAME: ${{ github.repository }}

jobs:
release:
name: release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Set up Python 3.x
uses: actions/setup-python@v2
with:
python-version: "3.x"

- name: Install release dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Build and publish package
env:
TWINE_USERNAME: ${{ secrets.PYPI_STACUTILS_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_STACUTILS_PASSWORD }}
run: |
scripts/publish
docker:
name: docker
permissions:
contents: read
packages: write
runs-on: ubuntu-latest
steps:
- name: Set up Python 3.x
uses: actions/setup-python@v2
with:
python-version: "3.x"
-
name: Checkout
uses: actions/checkout@v2
-
name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ${{ env.DOCKER_REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Source build args
run: |
source ./docker_env
STACTOOLS_VERSION=$(python scripts/stactools-version.py)
echo "stactools_version=$STACTOOLS_VERSION" >> $GITHUB_ENV
echo "docker_workdir=$DOCKER_WORKDIR" >> $GITHUB_ENV
echo "docker_namespace_package_dir=$DOCKER_NAMESPACE_PACKAGE_DIR" >> $GITHUB_ENV
- name: Run rename script if in the template repo
run: |
if [[ "$GITHUB_REPOSITORY" == */template ]]; then
scripts/rename
fi
-
name: Docker meta main
id: meta-main
uses: docker/metadata-action@v3
with:
images: ${{ env.DOCKER_REGISTRY }}/${{ env.DOCKER_IMAGE_NAME }}
flavor: |
latest=true
tags: |
type=pep440,pattern={{version}}
-
name: Build and push main
uses: docker/build-push-action@v2
with:
context: .
file: docker/Dockerfile
build-args: |
STACTOOLS_VERSION=${{ env.stactools_version }}
DOCKER_WORKDIR=${{ env.docker_workdir }}
DOCKER_NAMESPACE_PACKAGE_DIR=${{ env.docker_namespace_package_dir }}
push: true
tags: ${{ steps.meta-main.outputs.tags }}
labels: ${{ steps.meta-main.outputs.labels }}
-
name: Docker meta dev
id: meta-dev
uses: docker/metadata-action@v3
with:
images: ${{ env.DOCKER_REGISTRY }}/${{ env.DOCKER_IMAGE_NAME }}
flavor: |
latest=true
suffix=-dev,onlatest=true
tags: |
type=pep440,pattern={{version}}
-
name: Build and push dev
uses: docker/build-push-action@v2
with:
context: .
file: docker/Dockerfile-dev
build-args: |
STACTOOLS_VERSION=${{ env.stactools_version }}
DOCKER_WORKDIR=${{ env.docker_workdir }}
DOCKER_NAMESPACE_PACKAGE_DIR=${{ env.docker_namespace_package_dir }}
push: true
tags: ${{ steps.meta-dev.outputs.tags }}
labels: ${{ steps.meta-dev.outputs.labels }}
Loading

0 comments on commit 52c23f9

Please sign in to comment.