-
Notifications
You must be signed in to change notification settings - Fork 229
ci: refactor jobs and improve platform coverage #128
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,74 +1,69 @@ | ||
name: CI | ||
|
||
on: [push, pull_request] | ||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
branches: | ||
- '**' | ||
|
||
jobs: | ||
|
||
check-formatting: | ||
runs-on: ubuntu-latest | ||
|
||
name: Consult black on python formatting | ||
|
||
tests: | ||
name: ${{ matrix.os }} / ${{ matrix.python-version }} | ||
runs-on: ${{ matrix.os }}-latest | ||
strategy: | ||
matrix: | ||
os: [Ubuntu, MacOS, Windows] | ||
python-version: [3.6, 3.7, 3.8] | ||
exclude: | ||
- os: Windows | ||
python-version: 3.6 | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.7 | ||
- uses: Gr1N/setup-poetry@v2 | ||
- uses: actions/cache@v2 | ||
|
||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v1 | ||
with: | ||
path: ~/.cache/pypoetry/virtualenvs | ||
key: ${{ runner.os }}-poetry-${{ hashFiles('poetry.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-poetry- | ||
- name: Install dependencies | ||
run: poetry install | ||
- name: Run black | ||
run: poetry run poe check-style | ||
python-version: ${{ matrix.python-version }} | ||
|
||
run-tests: | ||
runs-on: ubuntu-latest | ||
- 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: Run tests with tox | ||
- name: Install poetry | ||
shell: bash | ||
run: | | ||
python -m pip install poetry | ||
echo "::set-env name=PATH::$HOME/.poetry/bin:$PATH" | ||
|
||
strategy: | ||
matrix: | ||
python-version: [ '3.6', '3.7', '3.8'] | ||
- name: Configure poetry | ||
shell: bash | ||
run: poetry config virtualenvs.in-project true | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-python@v2 | ||
- name: Set up cache | ||
uses: actions/cache@v2 | ||
id: cache | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- uses: Gr1N/setup-poetry@v2 | ||
- uses: actions/cache@v2 | ||
with: | ||
path: ~/.cache/pypoetry/virtualenvs | ||
key: ${{ runner.os }}-poetry-${{ hashFiles('poetry.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-poetry- | ||
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: poetry run pip --version >/dev/null 2>&1 || rm -rf .venv | ||
|
||
- name: Install dependencies | ||
shell: bash | ||
run: | | ||
poetry run pip install --upgrade pip | ||
poetry run python -m pip install pip -U | ||
poetry install | ||
- name: Run tests | ||
run: | | ||
poetry run poe generate | ||
poetry run poe test | ||
|
||
build-release: | ||
runs-on: ubuntu-latest | ||
- name: Generate code from proto files | ||
shell: bash | ||
run: poetry run python -m tests.generate -v | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.7 | ||
- uses: Gr1N/setup-poetry@v2 | ||
- name: Build package | ||
run: poetry build | ||
- name: Publish package to PyPI | ||
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags') | ||
run: poetry publish -n | ||
env: | ||
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.pypi }} | ||
- name: Execute test suite | ||
shell: bash | ||
run: poetry run pytest tests/ |
This file contains hidden or 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,20 @@ | ||
name: Code Quality | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
branches: | ||
- '**' | ||
|
||
jobs: | ||
black: | ||
name: Black | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Run Black | ||
uses: lgeiger/black-action@master | ||
with: | ||
args: --check src/ tests/ |
This file contains hidden or 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,31 @@ | ||
name: Release | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
tags: | ||
- '**' | ||
pull_request: | ||
branches: | ||
- '**' | ||
|
||
jobs: | ||
packaging: | ||
name: Distribution | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up Python 3.8 | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.8 | ||
- name: Install poetry | ||
run: python -m pip install poetry | ||
- name: Build package | ||
run: poetry build | ||
- name: Publish package to PyPI | ||
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags') | ||
env: | ||
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.pypi }} | ||
run: poetry publish -n |
This file contains hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.