forked from python-poetry/poetry
-
Notifications
You must be signed in to change notification settings - Fork 1
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 python-poetry#5 from python-poetry/github-actions
Setup GitHub actions
- Loading branch information
Showing
7 changed files
with
407 additions
and
214 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,19 @@ | ||
name: Code Quality | ||
|
||
on: | ||
pull_request: | ||
paths-ignore: | ||
- 'docs/**' | ||
push: | ||
branches: [main] | ||
paths-ignore: | ||
- 'docs/**' | ||
|
||
jobs: | ||
pre-commit: | ||
name: Linting | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-python@v2 | ||
- uses: pre-commit/[email protected] |
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,51 @@ | ||
name: Release | ||
|
||
on: | ||
push: | ||
tags: | ||
- '*.*.*' | ||
|
||
jobs: | ||
Release: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Get tag | ||
id: tag | ||
run: echo ::set-output name=tag::${GITHUB_REF#refs/tags/} | ||
|
||
- name: Set up Python 3.9 | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: "3.9" | ||
|
||
- name: Install Poetry | ||
run: | | ||
curl -sL https://raw.githubusercontent.com/python-poetry/poetry/master/install-poetry.py \ | ||
| python - -y | ||
- name: Update PATH | ||
run: echo "$HOME/.local/bin" >> $GITHUB_PATH | ||
|
||
- name: Build project for distribution | ||
run: poetry build | ||
|
||
- name: Check Version | ||
id: check-version | ||
run: | | ||
[[ "$(poetry version --short)" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] \ | ||
|| echo ::set-output name=prerelease::true | ||
- name: Create Release | ||
uses: ncipollo/release-action@v1 | ||
with: | ||
artifacts: "dist/*" | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
draft: false | ||
prerelease: steps.check-version.outputs.prerelease == 'true' | ||
|
||
- name: Publish to PyPI | ||
env: | ||
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_TOKEN }} | ||
run: poetry publish |
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,78 @@ | ||
name: Tests | ||
|
||
on: | ||
pull_request: {} | ||
push: | ||
branches: [main] | ||
|
||
jobs: | ||
tests: | ||
name: ${{ matrix.os }} / ${{ matrix.python-version }} | ||
runs-on: "${{ matrix.os }}-latest" | ||
continue-on-error: ${{ matrix.experimental }} | ||
strategy: | ||
matrix: | ||
os: [Ubuntu, MacOS, Windows] | ||
python-version: [3.6, 3.7, 3.8, 3.9] | ||
experimental: [false] | ||
bootstrap-args: [""] | ||
include: | ||
- os: Ubuntu | ||
python-version: pypy3 | ||
experimental: false | ||
- os: Ubuntu | ||
python-version: "3.10.0-alpha - 3.10.0" | ||
experimental: true | ||
bootstrap-args: "--git https://github.com/python-poetry/poetry.git" | ||
fail-fast: false | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Get full Python version | ||
id: full-python-version | ||
shell: bash | ||
run: echo ::set-output name=version::$(python -c "import sys; print('-'.join(str(v) for v in sys.version_info))") | ||
|
||
- name: Bootstrap poetry | ||
shell: bash | ||
run: | | ||
curl -sL https://raw.githubusercontent.com/python-poetry/poetry/master/install-poetry.py \ | ||
| python - -y ${{ matrix.bootstrap-args }} | ||
- name: Update PATH | ||
if: ${{ matrix.os != 'Windows' }} | ||
shell: bash | ||
run: echo "$HOME/.local/bin" >> $GITHUB_PATH | ||
|
||
- name: Update Path for Windows | ||
if: ${{ matrix.os == 'Windows' }} | ||
shell: bash | ||
run: echo "$APPDATA\Python\Scripts" >> $GITHUB_PATH | ||
|
||
- name: Configure poetry | ||
shell: bash | ||
run: poetry config virtualenvs.in-project true | ||
|
||
- name: Set up cache | ||
uses: actions/cache@v2 | ||
id: cache | ||
with: | ||
path: .venv | ||
key: venv-${{ runner.os }}-${{ steps.full-python-version.outputs.version }}-${{ hashFiles('**/poetry.lock') }} | ||
|
||
- name: Ensure cache is healthy | ||
if: steps.cache.outputs.cache-hit == 'true' | ||
shell: bash | ||
run: timeout 10s poetry run pip --version || rm -rf .venv | ||
|
||
- name: Install dependencies | ||
shell: bash | ||
run: poetry install | ||
|
||
- name: Run pytest | ||
shell: bash | ||
run: poetry run python -m pytest -q tests/ |
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
Oops, something went wrong.