-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[*] refactor build, add invoke interface as my makefile
- Loading branch information
1 parent
b30a7bc
commit fd8e724
Showing
11 changed files
with
1,463 additions
and
178 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,165 @@ | ||
# This workflow will install Python dependencies, run tests and lint with a single version of Python | ||
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions | ||
|
||
name: Tests | ||
|
||
on: | ||
push: | ||
tags: '*' | ||
branches: [ master, main ] | ||
pull_request: | ||
branches: [ master, main ] | ||
|
||
jobs: | ||
verify_style: | ||
runs-on: 'ubuntu-latest' | ||
steps: | ||
- | ||
uses: actions/checkout@v4 | ||
- | ||
name: Set up Python 3 | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.x' | ||
architecture: 'x64' | ||
- | ||
name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip invoke typing-extensions | ||
invoke setup --devel --tests | ||
python/bin/python -m pip install black==19.3b0 click==8.0.1 | ||
- | ||
name: Lint with flake8 | ||
run: | | ||
# stop the build if there are Python syntax errors or undefined names | ||
python/bin/python -m flake8 instruct/ --count --select=E9,F63,F7,F82 --show-source --statistics | ||
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide | ||
python/bin/python -m flake8 instruct/ --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics | ||
- | ||
name: Check style with black | ||
run: | | ||
python/bin/python -m black --check | ||
test_matrix: | ||
needs: [verify_style] | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
experimental: [false] | ||
arch: | ||
- 'x64' | ||
python_version: | ||
- '3.7' | ||
- '3.8' | ||
- '3.9' | ||
- '3.10' | ||
- '3.11' | ||
- '3.12' | ||
- 'pypy3.7' | ||
- 'pypy3.8' | ||
- 'pypy3.9' | ||
os: | ||
- 'ubuntu-latest' | ||
include: | ||
- | ||
python_version: 'pypy3.10' | ||
experimental: true | ||
arch: 'x64' | ||
os: ubuntu-latest | ||
|
||
runs-on: ${{ matrix.os }} | ||
continue-on-error: ${{ matrix.experimental }} | ||
steps: | ||
- | ||
uses: actions/checkout@v4 | ||
- | ||
name: Set up Python ${{ matrix.python_version }} | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python_version }} | ||
architecture: ${{ matrix.arch }} | ||
- | ||
name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip invoke typing-extensions | ||
invoke setup --tests | ||
- | ||
name: Test with pytest | ||
run: | | ||
python/bin/python -m pytest | ||
pypi-publish: | ||
needs: [test_matrix, verify_style] | ||
runs-on: 'ubuntu-latest' | ||
environment: | ||
name: pypi | ||
url: https://pypi.org/p/instruct | ||
permissions: | ||
id-token: write | ||
contents: write | ||
steps: | ||
- | ||
uses: actions/checkout@v4 | ||
- | ||
name: Set up Python 3.11 | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.11' | ||
architecture: 'x64' | ||
- | ||
name: Set some variables... | ||
id: version | ||
run: | | ||
echo "CURRENT_VERSION=$(grep -vE '^#' CURRENT_VERSION.txt | head -1)" >> "$GITHUB_OUTPUT" | ||
if [ "x${{ github.ref_type == 'tag' && startsWith(github.ref, 'refs/tags/v') }}" = 'xtrue' ]; then | ||
echo "GIT_VERSION=$(echo '${{ github.ref_name }}' | sed 's/^.//')" >> "$GITHUB_OUTPUT" | ||
fi | ||
- | ||
name: Warn tag version matches the source version | ||
if: ${{ github.ref_type != 'tag' }} | ||
run: | | ||
if [ 'x${{ steps.version.outputs.GIT_VERSION }}' != 'x${{ steps.version.outputs.CURRENT_VERSION }}' ]; then | ||
echo '::warn file=CURRENT_VERSION.txt,line=2,title=Version mismatch::Expected ${{ steps.version.outputs.GIT_VERSION }} but got ${{ steps.version.outputs.CURRENT_VERSION }} instead. | ||
If you make a tag from this, it *will* error out.' | ||
fi | ||
- | ||
name: Assert tag version matches the source version | ||
if: ${{ github.ref_type == 'tag' }} | ||
run: | | ||
if [ 'x${{ steps.version.outputs.GIT_VERSION }}' != 'x${{ steps.version.outputs.CURRENT_VERSION }}' ]; then | ||
echo '::error file=CURRENT_VERSION.txt,line=2,title=Version mismatch::Expected ${{ steps.version.outputs.GIT_VERSION }} but got ${{ steps.version.outputs.CURRENT_VERSION }} instead. | ||
Suggest you fix that and delete the tag.' | ||
exit 254 | ||
fi | ||
- | ||
name: Setup | ||
run: | | ||
python -m pip install --upgrade pip invoke typing-extensions | ||
invoke setup --devel --no-project | ||
- | ||
name: Create artifacts | ||
id: artifacts | ||
run: | | ||
python/bin/python -m build | ||
- | ||
name: Publish package distributions to PyPI | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
if: ${{ github.ref_type == 'tag' && startsWith(github.ref, 'refs/tags/v') }} | ||
with: | ||
skip-existing: false | ||
|
||
- | ||
name: Create Release | ||
if: ${{ github.ref_type == 'tag' && startsWith(github.ref, 'refs/tags/v') }} | ||
id: upload-release-asset | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
body_path: CHANGES.rst | ||
name: Release ${{ steps.version.outputs.CURRENT_VERSION }} | ||
files: | ||
dist/instruct* |
62 changes: 43 additions & 19 deletions
62
.github/workflows/style-check.yml → .github/workflows/development.yml
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,52 +1,76 @@ | ||
# This workflow will install Python dependencies, run tests and lint with a single version of Python | ||
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions | ||
|
||
name: Check style | ||
name: Development | ||
|
||
on: | ||
push: | ||
branches: [ master ] | ||
pull_request: | ||
branches: [ master ] | ||
branches: | ||
- '!main' | ||
- '!master' | ||
- '*' | ||
|
||
jobs: | ||
build: | ||
test-matrix: | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
arch: | ||
- 'x64' | ||
python_version: | ||
- '3.x' | ||
os: | ||
- '3.7' | ||
- '3.8' | ||
- '3.9' | ||
- '3.10' | ||
- '3.11' | ||
- '3.12' | ||
os: | ||
- 'ubuntu-latest' | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- | ||
- | ||
uses: actions/checkout@v4 | ||
- | ||
- | ||
name: Set up Python ${{ matrix.python_version }} | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python_version }} | ||
architecture: ${{ matrix.arch }} | ||
- | ||
- | ||
name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
python -m pip install black==19.3b0 click==8.0.1 | ||
python -m pip install .[devel,test] | ||
- | ||
python -m pip install --upgrade pip invoke typing-extensions | ||
invoke setup --tests | ||
- | ||
name: Test with pytest | ||
run: | | ||
python -m pytest | ||
verify_style: | ||
needs: [test-matrix] | ||
runs-on: 'ubuntu-latest' | ||
steps: | ||
- | ||
uses: actions/checkout@v4 | ||
- | ||
name: Set up Python 3 | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.x' | ||
architecture: 'x64' | ||
- | ||
name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip invoke typing-extensions | ||
invoke setup --no-project --devel --tests | ||
- | ||
name: Lint with flake8 | ||
run: | | ||
# stop the build if there are Python syntax errors or undefined names | ||
python -m flake8 instruct/ --count --select=E9,F63,F7,F82 --show-source --statistics | ||
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide | ||
python -m flake8 instruct/ --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics | ||
- | ||
name: Check style | ||
- | ||
name: Check style with black | ||
run: | | ||
python -m black --check | ||
|
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.