Skip to content

Commit

Permalink
Merge branch 'release/v0.11.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
brianschubert committed Dec 30, 2023
2 parents 2586ce4 + 537bd09 commit 2e687f6
Show file tree
Hide file tree
Showing 6 changed files with 69 additions and 17 deletions.
10 changes: 8 additions & 2 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ jobs:
uses: awvwgk/setup-fortran@v1

- name: Install build frontend
# language=sh
run: python -m pip install --upgrade pip build

- name: Retrieve 6S source archives
Expand All @@ -51,6 +52,7 @@ jobs:
# from the sdist. In all other jobs, the wheel is built directly from the source directory.
# This way, we confirm that wheels can be successfully built from the sdist.
- name: Build wheel${{ matrix.sdist && ' and sdist' || '' }}
# language=sh
run: python -I -m build ${{ !matrix.sdist && '--wheel' || '' }}
env:
SIXS_ARCHIVE_DIR: 6s-archives
Expand Down Expand Up @@ -84,6 +86,7 @@ jobs:
python-version: "3.11"

- name: Configure wheel platform compatibility tags
# language=sh
run: |
python -m pip install --upgrade wheel
python -m wheel tags --remove --python-tag=py3 --abi-tag=none ./dist/*.whl
Expand All @@ -102,7 +105,7 @@ jobs:
fail-fast: false
matrix:
os: [ "windows-latest", "ubuntu-latest", "macos-latest" ]
python-version: [ "3.9", "3.10", "3.11" ]
python-version: [ "3.9", "3.10", "3.11", "3.12" ]
steps:
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
Expand All @@ -119,18 +122,21 @@ jobs:
# --only-binary - use a wheel (not sdist)
# --no-deps - only install named distribution (do not try to find other dependencies)
- name: Install candidate wheel without dependencies
# language=sh
run: python -m pip install --no-index --only-binary ':all:' --no-deps --find-links=dist 6s-bin

# Install remaining dependency from PyPI, including those for the 'wrapper' extra.
# The construct `| tee /dev/tty | grep ...` preserves stdout for the log while also producing an error exit
# status if `...` is not found in the output.
- name: Install candidate wheel's dependencies from PyPI
if: ${{ !contains(matrix.os, 'windows') }}
# language=sh
run: |
python -m pip install --find-links=dist '6s-bin[wrapper]' | tee /dev/tty | grep 'Requirement already satisfied: 6s-bin' > /dev/null
- name: Install candidate wheel's dependencies from PyPI (Windows)
if: ${{ contains(matrix.os, 'windows') }}
# language=sh
run: |
$output = python -m pip install --find-links=dist '6s-bin[wrapper]' | Out-String
Write-Host $output
Expand All @@ -141,7 +147,7 @@ jobs:
sparse-checkout: test

- name: Run pytest
# language=sh
run: |
python -m pip install pytest
pytest
63 changes: 52 additions & 11 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,20 @@ name: Release

run-name: Release from ${{ github.ref }}

on: [ workflow_dispatch ]
on:
push:
tags:
# Only trigger on release tags (including "dev" and "release candidates").
- v[0-9]+.[0-9]+.[0-9]+
- v[0-9]+.[0-9]+.[0-9]+dev[0-9]+
- v[0-9]+.[0-9]+.[0-9]+rc[0-9]+

jobs:

build:
uses: ./.github/workflows/build.yaml

# Publish the release to TestPyPI (https://test.pypi.org).
test-publish:
needs: build
# if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
Expand All @@ -22,6 +29,27 @@ jobs:
name: dist-release
path: dist

# Verify that the version tag on all distribution files matches the pushed tag.
- name: Check version consistency
# language=sh
run: |
tag_prefix="refs/tags/v"
pushed_ref="${{ github.ref }}"
expected_version="${pushed_ref#${tag_prefix}}"
echo "::notice:: expected version is ${expected_version} for ref ${pushed_ref}"
for dist_file in ./dist/*; do
dist_version=$(echo ${dist_file%.tar.gz} | cut -d'-' -f2)
echo "::debug:: found version ${dist_version} for file '${dist_file}'"
if [ "${expected_version}" != "${dist_version}" ]; then
echo "::error:: expected ${expected_version}, got ${dist_version} in distribution file '${dist_file}'"
exit 1
fi
done
# # Allow the same distribution version to be test-published multiple times.
# # Useful for prototyping the release process.
# - name: Rename wheels with build number
Expand All @@ -32,7 +60,9 @@ jobs:
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
print-hash: true

# Verify that the release just published to TestPyPI can be installed successfully with pip.
test-install:
needs: test-publish
runs-on: ${{ matrix.os }}
Expand All @@ -41,39 +71,50 @@ jobs:
fail-fast: false
matrix:
os: [ "windows-latest", "ubuntu-latest", "macos-latest" ]
python-version: [ "3.9", "3.10", "3.11" ]
python-version: [ "3.9", "3.10", "3.11", "3.12" ]
steps:
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

# Install ONLY the released distribution from TestPyPI. Allow prereleases.
- name: Install distribution from TestPyPI
# language=sh
run: pip install --pre --no-deps -i https://test.pypi.org/simple/ 6s-bin

# Install all remaining dependencies from PyPI.
# Verify that pip does not attempt to re-install the distribution from the previous step.
- name: Install dependencies from PyPI
if: ${{ !contains(matrix.os, 'windows') }}
# language=sh
run: |
python -m pip install '6s-bin[wrapper]' packaging | tee /dev/tty | grep 'Requirement already satisfied: 6s-bin' > /dev/null
# Windows version of the previous step.
- name: Install dependencies from PyPI (Windows)
if: ${{ contains(matrix.os, 'windows') }}
# language=sh
run: |
$output = python -m pip install '6s-bin[wrapper]' packaging | Out-String
Write-Host $output
exit [int]$($output -notmatch 'Requirement already satisfied: 6s-bin')
- name: Verify that installed distribution version matches tag
# TODO find fix for double-quotes being stripped when the below command is run in PowerShell.
if: ${{ !contains(matrix.os, 'windows') }}
run: >
python -c 'import packaging.version;
import sixs_bin;
installed_version = packaging.version.parse(sixs_bin.__version__);
expected_version = packaging.version.parse("${{ github.ref }}".split("/")[-1].removeprefix("v"));
print(f"{installed_version=} {expected_version=}");
shell: python
# language=python
run: |
import packaging.version
import sixs_bin
installed_version = packaging.version.parse(sixs_bin.__version__)
expected_version = packaging.version.parse("${{ github.ref }}".split("/")[-1].removeprefix("v"))
print(f"::notice::{installed_version=} {expected_version=}")
assert installed_version.release == expected_version.release
'
# Quick final self-check.
- name: Run wrapper test
# language=sh
run: python -m sixs_bin --test-wrapper
9 changes: 7 additions & 2 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
name: Tests

on: [ push ]
on:
push:
branches: [ develop ]
workflow_dispatch:

jobs:
download_archives:
Expand All @@ -21,7 +24,7 @@ jobs:
fail-fast: false
matrix:
os: [ "windows-latest", "ubuntu-latest", "macos-latest" ]
python-version: [ "3.9", "3.10", "3.11" ]
python-version: [ "3.9", "3.10", "3.11", "3.12" ]
steps:
- uses: actions/checkout@v3

Expand All @@ -40,11 +43,13 @@ jobs:
uses: awvwgk/setup-fortran@v1

- name: Install package and test dependencies
# language=sh
run: |
python -m pip install --upgrade pip
python -m pip install '.[wrapper]' pytest
env:
SIXS_ARCHIVE_DIR: 6s-archives

- name: Run pytest
# language=sh
run: python -m pytest -vv
1 change: 1 addition & 0 deletions .github/workflows/web_artifact.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ jobs:
url: ${{ fromJSON(inputs.urls) }}
steps:
- name: Download file
# language=sh
run:
curl --create-dirs --output-dir artifacts -O ${{ matrix.url }}
- uses: actions/upload-artifact@v3
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "6s-bin"
version = "0.10.1"
version = "0.11.0"
description = "Compiled binaries for the 6S Radiative Transfer Model exposed as package resources."
license = "Apache-2.0"
authors = ["Brian Schubert <[email protected]>"]
Expand Down
1 change: 0 additions & 1 deletion src/sixs_bin/_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
# limitations under the License.

import argparse
import os
import pathlib
import subprocess
import sys
Expand Down

0 comments on commit 2e687f6

Please sign in to comment.