Skip to content

Commit

Permalink
CI: various updates
Browse files Browse the repository at this point in the history
  • Loading branch information
tdegeus committed Oct 23, 2023
1 parent a09d2cf commit e86f318
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 25 deletions.
28 changes: 20 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:

jobs:

default-shell:
standard:

strategy:
fail-fast: false
Expand All @@ -17,25 +17,37 @@ jobs:

defaults:
run:
shell: bash -l {0}
shell: bash -e -l {0}

name: ${{ matrix.runs-on }} • x64 ${{ matrix.args }}
name: ${{ matrix.runs-on }}
runs-on: ${{ matrix.runs-on }}

steps:

- name: Basic GitHub action setup
- name: Clone this library
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Set conda environment
uses: mamba-org/provision-with-micromamba@main
- name: Create conda environment
uses: mamba-org/setup-micromamba@main
with:
environment-file: environment.yaml
environment-name: myenv
cache-env: true
init-shell: bash
cache-downloads: true

- name: Export version of this library
run: |
LATEST_TAG=$(git describe --tags `git rev-list --tags --max-count=1`)
echo "SETUPTOOLS_SCM_PRETEND_VERSION=$LATEST_TAG" >> $GITHUB_ENV
- name: Install library
run: python -m pip install .
run: python -m pip install . -v --no-build-isolation --no-deps

- name: Run tests
run: python -m unittest discover tests -v

- name: Build docs
working-directory: docs
run: make html
5 changes: 3 additions & 2 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: pre-commit

on:
workflow_dispatch:
pull_request:
push:
branches: [main]
Expand All @@ -10,5 +11,5 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v2
- uses: pre-commit/action@v2.0.3
- uses: actions/setup-python@v4
- uses: pre-commit/action@main
46 changes: 31 additions & 15 deletions .github/workflows/pythonpublish.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,42 @@
name: Upload Python Package

on:
workflow_dispatch:
release:
types: [created]

jobs:
deploy:

pypi-publish:

name: Upload release to PyPI

runs-on: ubuntu-latest

environment:
name: pypi
url: https://pypi.org/p/enstat

permissions:
id-token: write

steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v2
- name: Checkout
uses: actions/checkout@v3
with:
python-version: 3.x
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
fetch-depth: 0

- name: Set latest release tag
run: |
python setup.py sdist bdist_wheel
twine upload dist/*
LATEST_TAG=$(git describe --tags `git rev-list --tags --max-count=1`)
git checkout $LATEST_TAG
echo "SETUPTOOLS_SCM_PRETEND_VERSION=$LATEST_TAG" >> $GITHUB_ENV
- name: Install deps
run: python -m pip install -U setuptools build wheel

- name: Build
run: python -m build

- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1

0 comments on commit e86f318

Please sign in to comment.