-
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 #18 from wayfair-incubator/cantonellis_publish_0.1…
….0rc setup build and deploy action
- Loading branch information
Showing
8 changed files
with
130 additions
and
84 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,8 @@ | ||
set -euo pipefail | ||
|
||
echo "Ensuring pip is up to date" | ||
python -m pip install --upgrade pip | ||
echo "Installing the latest version of pypa/build" | ||
pip install build | ||
|
||
python -m build --sdist --wheel --outdir 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
name: "Build Python package" | ||
description: "Build a wheel and sdist for the package" | ||
runs: | ||
using: "composite" | ||
steps: | ||
- name: "Build wheel" | ||
run: "$GITHUB_ACTION_PATH/action.sh" | ||
shell: "bash" |
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,12 +1,16 @@ | ||
name: "Verify Python Wheel" | ||
description: "Build a wheel for the package and importing the package doesn't cause an error" | ||
description: "Verify importing the package doesn't cause an error" | ||
inputs: | ||
package-import-name: | ||
description: "Name used to import the package from python code" | ||
required: true | ||
packages-dir: | ||
description: The target directory for distribution | ||
required: false | ||
default: dist | ||
runs: | ||
using: "composite" | ||
steps: | ||
- name: "Verify wheel" | ||
run: "$GITHUB_ACTION_PATH/action.sh ${{ inputs.package-import-name }}" | ||
run: "$GITHUB_ACTION_PATH/action.sh ${{ inputs.package-import-name }} ${{ inputs.packages-dir }}" | ||
shell: "bash" |
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 |
---|---|---|
|
@@ -9,138 +9,140 @@ env: | |
|
||
jobs: | ||
bandit: | ||
runs-on: ubuntu-latest | ||
runs-on: "ubuntu-latest" | ||
steps: | ||
- name: Check out code | ||
uses: actions/checkout@v2 | ||
- uses: actions/setup-python@v2 | ||
- name: "Check out code" | ||
uses: "actions/checkout@v2" | ||
- uses: "actions/setup-python@v2" | ||
with: | ||
python-version: ${{ env.PYTHON_VERSION }} | ||
- name: Install dependencies | ||
uses: ./.github/actions/install-dependencies | ||
- name: "Install dependencies" | ||
uses: "./.github/actions/install-dependencies" | ||
with: | ||
test-requirements: "true" | ||
|
||
- name: Run bandit | ||
run: bandit --ini .bandit -r little_cheesemonger | ||
- name: "Run bandit" | ||
run: "bandit --ini .bandit -r little_cheesemonger" | ||
|
||
black: | ||
runs-on: ubuntu-latest | ||
runs-on: "ubuntu-latest" | ||
steps: | ||
- name: Check out code | ||
uses: actions/checkout@v2 | ||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
- name: "Check out code" | ||
uses: "actions/checkout@v2" | ||
- name: "Set up Python" | ||
uses: "actions/setup-python@v2" | ||
with: | ||
python-version: ${{ env.PYTHON_VERSION }} | ||
- name: Install dependencies | ||
uses: ./.github/actions/install-dependencies | ||
- name: "Install dependencies" | ||
uses: "./.github/actions/install-dependencies" | ||
with: | ||
test-requirements: "true" | ||
|
||
- name: Run black | ||
run: black --check little_cheesemonger tests | ||
- name: "Run black" | ||
run: "black --check little_cheesemonger tests" | ||
|
||
flake8: | ||
runs-on: ubuntu-latest | ||
runs-on: "ubuntu-latest" | ||
steps: | ||
- name: Check out code | ||
uses: actions/checkout@v2 | ||
- uses: actions/setup-python@v2 | ||
- name: "Check out code" | ||
uses: "actions/checkout@v2" | ||
- uses: "actions/setup-python@v2" | ||
with: | ||
python-version: ${{ env.PYTHON_VERSION }} | ||
- name: Install dependencies | ||
uses: ./.github/actions/install-dependencies | ||
- name: "Install dependencies" | ||
uses: "./.github/actions/install-dependencies" | ||
with: | ||
test-requirements: "true" | ||
|
||
- name: Run flake8 | ||
run: flake8 little_cheesemonger tests | ||
- name: "Run flake8" | ||
run: "flake8 little_cheesemonger tests" | ||
|
||
isort: | ||
runs-on: ubuntu-latest | ||
runs-on: "ubuntu-latest" | ||
steps: | ||
- name: Check out code | ||
uses: actions/checkout@v2 | ||
- uses: actions/setup-python@v2 | ||
- name: "Check out code" | ||
uses: "actions/checkout@v2" | ||
- uses: "actions/setup-python@v2" | ||
with: | ||
python-version: ${{ env.PYTHON_VERSION }} | ||
- name: Install dependencies | ||
uses: ./.github/actions/install-dependencies | ||
- name: "Install dependencies" | ||
uses: "./.github/actions/install-dependencies" | ||
with: | ||
requirements: "true" | ||
test-requirements: "true" | ||
|
||
- name: Run isort | ||
run: isort --recursive --check-only little_cheesemonger tests | ||
- name: "Run isort" | ||
run: "isort --recursive --check-only little_cheesemonger tests" | ||
|
||
mypy: | ||
runs-on: ubuntu-latest | ||
runs-on: "ubuntu-latest" | ||
steps: | ||
- name: Check out code | ||
uses: actions/checkout@v2 | ||
- uses: actions/setup-python@v2 | ||
- name: "Check out code" | ||
uses: "actions/checkout@v2" | ||
- uses: "actions/setup-python@v2" | ||
with: | ||
python-version: ${{ env.PYTHON_VERSION }} | ||
- name: Install dependencies | ||
uses: ./.github/actions/install-dependencies | ||
- name: "Install dependencies" | ||
uses: "./.github/actions/install-dependencies" | ||
with: | ||
test-requirements: "true" | ||
|
||
- name: Run mypy | ||
run: mypy little_cheesemonger tests | ||
- name: "Run mypy" | ||
run: "mypy little_cheesemonger tests" | ||
|
||
test: | ||
runs-on: ubuntu-latest | ||
runs-on: "ubuntu-latest" | ||
strategy: | ||
matrix: | ||
python-version: [3.6, 3.7, 3.8] | ||
steps: | ||
- name: Check out code | ||
uses: actions/checkout@v2 | ||
- uses: actions/setup-python@v2 | ||
- name: "Check out code" | ||
uses: "actions/checkout@v2" | ||
- uses: "actions/setup-python@v2" | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Install dependencies | ||
uses: ./.github/actions/install-dependencies | ||
- name: "Install dependencies" | ||
uses: "./.github/actions/install-dependencies" | ||
with: | ||
requirements: "true" | ||
test-requirements: "true" | ||
|
||
- name: Run pytest | ||
run: pytest tests/unit --cov-report xml:coverage-${{ matrix.python-version }}.xml --junitxml=test-results-${{ matrix.python-version }}.xml | ||
- name: "Run pytest" | ||
run: "pytest tests/unit --cov-report xml:coverage-${{ matrix.python-version }}.xml --junitxml=test-results-${{ matrix.python-version }}.xml" | ||
|
||
- name: Upload pytest test results artifact | ||
uses: actions/upload-artifact@v2 | ||
- name: "Upload pytest test results artifact" | ||
uses: "actions/upload-artifact@v2" | ||
with: | ||
name: pytest-results-${{ matrix.python-version }} | ||
path: test-results-${{ matrix.python-version }}.xml | ||
name: "pytest-results-${{ matrix.python-version }}" | ||
path: "test-results-${{ matrix.python-version }}.xml" | ||
# Use always() to always run this step to publish test results when there are test failures | ||
if: ${{ always() }} | ||
|
||
- name: Upload coverage results artifact | ||
uses: actions/upload-artifact@v2 | ||
- name: "Upload coverage results artifact" | ||
uses: "actions/upload-artifact@v2" | ||
with: | ||
name: pytest-coverage-${{ matrix.python-version }} | ||
path: coverage-${{ matrix.python-version }}.xml | ||
name: 'pytest-coverage-${{ matrix.python-version }}' | ||
path: 'coverage-${{ matrix.python-version }}.xml' | ||
# Use always() to always run this step to publish test results when there are test failures | ||
if: ${{ always() }} | ||
|
||
- name: Publish coverage results to Codecov | ||
uses: codecov/[email protected] | ||
- name: "Publish coverage results to Codecov" | ||
uses: "codecov/[email protected]" | ||
with: | ||
file: coverage-${{ matrix.python-version }}.xml | ||
fail_ci_if_error: true | ||
file: "coverage-${{ matrix.python-version }}.xml" | ||
fail_ci_if_error: "true" | ||
|
||
verify-wheel: | ||
runs-on: ubuntu-latest | ||
runs-on: "ubuntu-latest" | ||
steps: | ||
- name: Check out code | ||
uses: actions/checkout@v2 | ||
- uses: actions/setup-python@v2 | ||
- name: "Check out code" | ||
uses: "actions/checkout@v2" | ||
- uses: "actions/setup-python@v2" | ||
with: | ||
python-version: ${{ env.PYTHON_VERSION }} | ||
- name: Verify wheel | ||
uses: ./.github/actions/verify-wheel | ||
- name: "Build wheel" | ||
uses: "./.github/actions/build-dist" | ||
- name: "Verify wheel" | ||
uses: "./.github/actions/verify-wheel" | ||
with: | ||
package-import-name: "little_cheesemonger" |
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,27 @@ | ||
name: Publish Release | ||
env: | ||
PYTHON_VERSION: "3.9" | ||
on: | ||
release: | ||
types: [published] | ||
jobs: | ||
build-and-publish-wheel-to-pypi: | ||
runs-on: "ubuntu-latest" | ||
environment: "Publish Release" | ||
steps: | ||
- name: "Check out code" | ||
uses: "actions/checkout@v2" | ||
|
||
- uses: "actions/setup-python@v2" | ||
with: | ||
python-version: ${{ env.PYTHON_VERSION }} | ||
|
||
- name: "Build wheel" | ||
uses: "./.github/actions/build-dist" | ||
|
||
# v1.4.2 release. Using full SHA for security | ||
# https://docs.github.com/en/actions/learn-github-actions/security-hardening-for-github-actions#using-third-party-actions | ||
- name: "Publish distribution 📦 to PyPI" | ||
uses: "pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29" | ||
with: | ||
password: ${{ secrets.PYPI_API_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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
__version__ = "0.1.0" | ||
|
||
from little_cheesemonger._errors import LittleCheesemongerError # noqa | ||
from little_cheesemonger._run import run # noqa | ||
|
||
__version__ = "0.1.0rc0" |
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