-
Notifications
You must be signed in to change notification settings - Fork 192
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
upload to prod pypi from workflow (#697)
- Loading branch information
Showing
3 changed files
with
281 additions
and
256 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 |
---|---|---|
@@ -1,154 +1,9 @@ | ||
name: Python CI | ||
|
||
name: build | ||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
workflow_call: | ||
|
||
jobs: | ||
# Run unittests | ||
test: | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [ubuntu-latest, macos-latest, windows-latest] | ||
python-version: [3.7, 3.8, 3.9, "3.10"] | ||
parser: [pure, native] | ||
steps: | ||
- uses: actions/checkout@v1 | ||
- uses: actions/setup-python@v2 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- uses: actions/cache@v2 | ||
id: cache | ||
with: | ||
path: ${{ env.pythonLocation }} | ||
key: ${{ env.pythonLocation }}-${{ hashFiles('requirements.txt', 'requirements-dev.txt', 'setup.py') }} | ||
- name: Install Dependencies | ||
if: steps.cache.outputs.cache-hit != 'true' | ||
run: | | ||
pip install --upgrade --upgrade-strategy eager build -r requirements.txt -r requirements-dev.txt | ||
- if: ${{ matrix.parser == 'native' }} | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: stable | ||
- if: ${{ matrix.parser == 'native' }} | ||
name: Rust Cache | ||
uses: Swatinem/[email protected] | ||
with: | ||
working-directory: native | ||
- run: >- | ||
echo LIBCST_PARSER_TYPE=${{ matrix.parser }} >> $GITHUB_ENV | ||
- name: Run Tests | ||
run: python setup.py test | ||
|
||
# Run linters | ||
lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v1 | ||
- uses: actions/setup-python@v2 | ||
with: | ||
python-version: "3.10" | ||
- uses: actions/cache@v2 | ||
id: cache | ||
with: | ||
path: ${{ env.pythonLocation }} | ||
key: ${{ env.pythonLocation }}-${{ hashFiles('requirements.txt', 'requirements-dev.txt', 'setup.py') }} | ||
- name: Install Dependencies | ||
if: steps.cache.outputs.cache-hit != 'true' | ||
run: | | ||
pip install --upgrade --upgrade-strategy eager build -r requirements.txt -r requirements-dev.txt | ||
- run: flake8 | ||
- run: ufmt check . | ||
- run: python3 -m fixit.cli.run_rules | ||
- run: python -m slotscheck libcst | ||
- run: ./check_copyright.sh | ||
|
||
# Run pyre typechecker | ||
typecheck: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v1 | ||
- uses: actions/setup-python@v2 | ||
with: | ||
python-version: "3.10" | ||
- uses: actions/cache@v2 | ||
id: cache | ||
with: | ||
path: ${{ env.pythonLocation }} | ||
key: ${{ env.pythonLocation }}-${{ hashFiles('requirements.txt', 'requirements-dev.txt', 'setup.py') }} | ||
- name: Install Dependencies | ||
if: steps.cache.outputs.cache-hit != 'true' | ||
run: | | ||
pip install --upgrade --upgrade-strategy eager build -r requirements.txt -r requirements-dev.txt | ||
- name: Make sure Pyre uses the working copy | ||
run: pip install -e . | ||
- run: pyre --version | ||
- run: pyre -n check | ||
- run: python libcst/tests/test_pyre_integration.py | ||
- run: git diff --exit-code | ||
|
||
# Upload test coverage | ||
coverage: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v1 | ||
- uses: actions/setup-python@v2 | ||
with: | ||
python-version: "3.10" | ||
- uses: actions/cache@v2 | ||
id: cache | ||
with: | ||
path: ${{ env.pythonLocation }} | ||
key: ${{ env.pythonLocation }}-${{ hashFiles('requirements.txt', 'requirements-dev.txt', 'setup.py') }} | ||
- name: Install Dependencies | ||
if: steps.cache.outputs.cache-hit != 'true' | ||
run: | | ||
pip install --upgrade --upgrade-strategy eager build -r requirements.txt -r requirements-dev.txt | ||
- name: Generate Coverage | ||
run: | | ||
coverage run setup.py test | ||
coverage xml -i | ||
- uses: codecov/codecov-action@v2 | ||
with: | ||
files: coverage.xml | ||
fail_ci_if_error: true | ||
verbose: true | ||
- name: Archive Coverage | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: coverage | ||
path: coverage.xml | ||
|
||
# Build the docs | ||
docs: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v1 | ||
- uses: actions/setup-python@v2 | ||
with: | ||
python-version: "3.10" | ||
- uses: actions/cache@v2 | ||
id: cache | ||
with: | ||
path: ${{ env.pythonLocation }} | ||
key: ${{ env.pythonLocation }}-${{ hashFiles('requirements.txt', 'requirements-dev.txt', 'setup.py') }} | ||
- name: Install Dependencies | ||
if: steps.cache.outputs.cache-hit != 'true' | ||
run: | | ||
pip install --upgrade --upgrade-strategy eager build -r requirements.txt -r requirements-dev.txt | ||
- uses: ts-graphviz/setup-graphviz@v1 | ||
- run: sphinx-build docs/source/ docs/build/ | ||
- name: Archive Docs | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: sphinx-docs | ||
path: docs/build | ||
|
||
# Build python wheels | ||
# Build python wheels | ||
build_matrix: | ||
name: Prepare job matrix for build job | ||
runs-on: ubuntu-latest | ||
|
@@ -183,126 +38,30 @@ jobs: | |
CIBW_SKIP: "cp27-* cp34-* cp35-* pp* *-win32 *-win_arm64 *-musllinux_*" | ||
CIBW_ARCHS: ${{ matrix.vers }} | ||
CIBW_BUILD_VERBOSITY: 1 | ||
steps: | ||
- uses: actions/checkout@v1 | ||
- uses: actions/setup-python@v2 | ||
if: ${{ !contains(matrix.os, 'self-hosted') }} | ||
with: | ||
python-version: "3.10" | ||
- uses: actions/cache@v2 | ||
id: cache | ||
if: ${{ !contains(matrix.os, 'self-hosted') }} | ||
with: | ||
path: ${{ env.pythonLocation }} | ||
key: ${{ env.pythonLocation }}-${{ hashFiles('requirements.txt', 'requirements-dev.txt', 'setup.py') }} | ||
- name: Rust Cache | ||
if: ${{ !contains(matrix.os, 'self-hosted') }} | ||
uses: Swatinem/[email protected] | ||
with: | ||
working-directory: native | ||
- name: Disable scmtools local scheme | ||
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} | ||
run: >- | ||
echo LIBCST_NO_LOCAL_SCHEME=1 >> $GITHUB_ENV | ||
- name: Build wheels | ||
uses: pypa/[email protected] | ||
- uses: actions/upload-artifact@v2 | ||
with: | ||
path: wheelhouse/*.whl | ||
name: wheels | ||
|
||
pypi: | ||
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} | ||
name: Upload wheels to pypi | ||
runs-on: ubuntu-latest | ||
needs: build | ||
steps: | ||
- uses: actions/checkout@v1 | ||
- name: Download binary wheels | ||
id: download | ||
uses: actions/download-artifact@v2 | ||
with: | ||
name: wheels | ||
path: wheelhouse | ||
- uses: actions/setup-python@v2 | ||
if: ${{ !contains(matrix.os, 'self-hosted') }} | ||
with: | ||
python-version: "3.10" | ||
- uses: actions/cache@v2 | ||
id: cache | ||
if: ${{ !contains(matrix.os, 'self-hosted') }} | ||
with: | ||
path: ${{ env.pythonLocation }} | ||
key: ${{ env.pythonLocation }}-${{ hashFiles('requirements.txt', 'requirements-dev.txt', 'setup.py') }} | ||
- name: Install Dependencies | ||
if: steps.cache.outputs.cache-hit != 'true' | ||
run: | | ||
pip install --upgrade --upgrade-strategy eager build -r requirements.txt -r requirements-dev.txt | ||
- name: Disable scmtools local scheme | ||
run: >- | ||
echo LIBCST_NO_LOCAL_SCHEME=1 >> $GITHUB_ENV | ||
- name: Build a source tarball | ||
run: >- | ||
python -m | ||
build | ||
--sdist | ||
--outdir ${{ steps.download.outputs.download-path }} | ||
- name: Publish distribution 📦 to Test PyPI | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
user: __token__ | ||
password: ${{ secrets.TEST_PYPI_API_TOKEN }} | ||
repository_url: https://test.pypi.org/legacy/ | ||
packages_dir: ${{ steps.download.outputs.download-path }} | ||
|
||
# Test rust parts | ||
native: | ||
name: Rust unit tests | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [ubuntu-latest, macos-latest, windows-latest] | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: stable | ||
components: rustfmt, clippy | ||
- name: Rust Cache | ||
if: ${{ !contains(matrix.os, 'self-hosted') }} | ||
uses: Swatinem/[email protected] | ||
with: | ||
working-directory: native | ||
- uses: actions/setup-python@v2 | ||
with: | ||
python-version: "3.10" | ||
- name: test | ||
uses: actions-rs/cargo@v1 | ||
with: | ||
command: test | ||
args: --manifest-path=native/Cargo.toml --release | ||
- name: test without python | ||
if: matrix.os == 'ubuntu-latest' | ||
uses: actions-rs/cargo@v1 | ||
with: | ||
command: test | ||
args: --manifest-path=native/Cargo.toml --release --no-default-features | ||
- name: clippy | ||
uses: actions-rs/clippy-check@v1 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
args: --manifest-path=native/Cargo.toml --all-features | ||
|
||
rustfmt: | ||
name: Rustfmt | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions-rs/toolchain@v1 | ||
with: | ||
profile: minimal | ||
toolchain: stable | ||
override: true | ||
- run: rustup component add rustfmt | ||
- uses: actions-rs/cargo@v1 | ||
- name: Disable scmtools local scheme | ||
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} | ||
run: >- | ||
echo LIBCST_NO_LOCAL_SCHEME=1 >> $GITHUB_ENV | ||
- name: Build wheels | ||
uses: pypa/[email protected] | ||
- uses: actions/upload-artifact@v2 | ||
with: | ||
command: fmt | ||
args: --all --manifest-path=native/Cargo.toml -- --check | ||
path: wheelhouse/*.whl | ||
name: wheels |
Oops, something went wrong.