-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from nasa/harmony-833
HARMONY-833: Actions for tests, and drafting and publishing releases
- Loading branch information
Showing
8 changed files
with
168 additions
and
1 deletion.
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,3 @@ | ||
[flake8] | ||
max-line-length = 99 | ||
ignore = F401, W503 |
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,15 @@ | ||
version-resolver: | ||
major: | ||
labels: | ||
- 'major' | ||
minor: | ||
labels: | ||
- 'minor' | ||
patch: | ||
labels: | ||
- 'patch' | ||
default: patch | ||
name-template: 'v$RESOLVED_VERSION' | ||
tag-template: 'v$RESOLVED_VERSION' | ||
template: | | ||
$CHANGES |
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,15 @@ | ||
name: Draft Release | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Release Drafter | ||
uses: release-drafter/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
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,38 @@ | ||
name: Publish Release | ||
|
||
on: | ||
release: | ||
types: [published] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: '0' | ||
- uses: actions/setup-python@v2 | ||
with: | ||
python-version: '3.8' | ||
- shell: bash | ||
env: | ||
REPO_PASS: ${{ secrets.PYPI }} | ||
VERSION_TAG: ${{ github.event.release.tag_name }} | ||
BRANCH: ${{ github.event.release.target_commitish }} | ||
run: | | ||
VERSION=$(echo "${VERSION_TAG}" | cut -c2-) make build | ||
make publish | ||
# Setup git | ||
# https://api.github.com/users/github-actions%5Bbot%5D | ||
git config --global user.name "github-actions[bot]" | ||
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" | ||
# Commit and push updated release files | ||
git checkout -b "${BRANCH}" | ||
git add . | ||
git commit -m "Update release version to ${VERSION_TAG}" | ||
git push origin "${BRANCH}" | ||
git tag --force "${VERSION_TAG}" | ||
git push --force origin "${VERSION_TAG}" |
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,39 @@ | ||
name: Tests | ||
|
||
# More conservative about duplicate tests due to tests accessing real files | ||
on: [pull_request] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-20.04 | ||
strategy: | ||
matrix: | ||
python-version: [3.8] | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- uses: extractions/netrc@v1 | ||
with: | ||
machine: uat.urs.earthdata.nasa.gov | ||
username: ${{ secrets.EDL_USER }} | ||
password: ${{ secrets.EDL_PASSWORD }} | ||
|
||
- name: Install dependencies | ||
run: | | ||
make install | ||
- name: Tests | ||
run: | | ||
make ci | ||
- name: Archive code coverage results | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: code-coverage-report | ||
path: htmlcov/* |
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 |
---|---|---|
|
@@ -63,3 +63,5 @@ cover/ | |
profile_default/ | ||
ipython_config.py | ||
|
||
# pyenv | ||
.python-version |
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,54 @@ | ||
.PHONY: venv-setup pyenv-setup install install-examples clean examples lint test test-watch ci docs | ||
.SILENT: virtualenv | ||
|
||
VERSION ?= $(shell git describe --tags | sed 's/-/\+/' | sed 's/-/\./g') | ||
REPO ?= https://upload.pypi.org/legacy/ | ||
REPO_USER ?= __token__ | ||
REPO_PASS ?= unset | ||
|
||
venv-setup: | ||
python -m venv .venv | ||
|
||
pyenv-setup: | ||
if ! type pyenv > /dev/null; \ | ||
then \ | ||
echo "\nUnable to create virtualenv: pyenv not found. Please install pyenv & pyenv-virtualenv."; \ | ||
echo " See:"; \ | ||
echo " https://github.com/pyenv/pyenv"; \ | ||
echo " https://github.com/pyenv/pyenv-virtualenv"; \ | ||
exit; \ | ||
else \ | ||
pyenv install 3.9.1; \ | ||
pyenv virtualenv 3.9.1 zarr-eosdis-store; \ | ||
pyenv activate zarr-eosdis-store; \ | ||
fi | ||
|
||
clean: | ||
coverage erase | ||
rm -rf htmlcov | ||
rm -rf build dist *.egg-info || true | ||
|
||
clean-docs: | ||
cd docs && $(MAKE) clean | ||
|
||
install: | ||
python -m pip install --upgrade pip | ||
pip install -r requirements.txt -r requirements-dev.txt | ||
|
||
lint: | ||
flake8 eosdis_store --show-source --statistics | ||
|
||
test: | ||
coverage run -m pytest | ||
|
||
ci: test | ||
coverage html | ||
|
||
build: clean | ||
sed -i.bak "s/__version__ .*/__version__ = \"$(VERSION)\"/" eosdis_store/VERSION.py && rm eosdis_store/version.py.bak | ||
python -m pip install --upgrade --quiet setuptools wheel twine | ||
python setup.py --quiet sdist bdist_wheel | ||
|
||
publish: build | ||
python -m twine check dist/* | ||
python -m twine upload --username "$(REPO_USER)" --password "$(REPO_PASS)" --repository-url "$(REPO)" dist/* |
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