diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index dd244b0..04a7d71 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -1,4 +1,4 @@ -name: CI +name: ci on: push: branches: @@ -6,157 +6,54 @@ on: tags: - '*' pull_request: - workflow_dispatch: permissions: contents: read jobs: quality: - name: Quality - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - - uses: actions/setup-python@v4 - with: - python-version: '3.10' - - - name: Setup python environment - run: | - python -m venv .venv - source .venv/bin/activate - python -m pip install pre-commit - python -m pip install -r requirements-dev.txt - - - name: Check quality - run: | - source .venv/bin/activate - make lint - - - name: Check tests - run: | - source .venv/bin/activate - make dev - make test - - linux: - name: Build linux - runs-on: ubuntu-latest - needs: [quality] - strategy: - matrix: - target: [x86_64, x86, aarch64, armv7, s390x, ppc64le] - - steps: - - uses: actions/checkout@v3 - - - uses: actions/setup-python@v4 - with: - python-version: '3.10' - - - name: Build wheels - uses: PyO3/maturin-action@v1 - with: - target: ${{ matrix.target }} - args: --release --out dist --find-interpreter - sccache: 'true' - manylinux: auto - - - name: Upload wheels - uses: actions/upload-artifact@v3 - with: - name: wheels - path: dist - - windows: - name: Build windows - runs-on: windows-latest - needs: [quality] + name: ${{ matrix.os }} / ${{ matrix.python-version }} + runs-on: ${{ matrix.os }}-latest strategy: + fail-fast: false matrix: - target: [x64, x86] - steps: - - uses: actions/checkout@v3 - - - uses: actions/setup-python@v4 - with: - python-version: '3.10' - architecture: ${{ matrix.target }} - - - name: Build wheels - uses: PyO3/maturin-action@v1 - with: - target: ${{ matrix.target }} - args: --release --out dist --find-interpreter - sccache: 'true' - - - name: Upload wheels - uses: actions/upload-artifact@v3 - with: - name: wheels - path: dist + os: ["ubuntu", "macos", "windows"] + python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] + defaults: + run: + shell: bash - macos: - name: Build macos - runs-on: macos-latest - needs: [quality] - strategy: - matrix: - target: [x86_64, aarch64] steps: - uses: actions/checkout@v3 - - uses: actions/setup-python@v4 - with: - python-version: '3.10' - - - name: Build wheels - uses: PyO3/maturin-action@v1 - with: - target: ${{ matrix.target }} - args: --release --out dist --find-interpreter - sccache: 'true' - - - name: Upload wheels - uses: actions/upload-artifact@v3 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 with: - name: wheels - path: dist + python-version: ${{ matrix.python-version }} - sdist: - name: Build sdist - runs-on: ubuntu-latest - needs: [quality] - steps: - - uses: actions/checkout@v3 + - name: Set up python environment + run: | + pip install pipenv + pipenv install -r requirements-dev.txt - - name: Build sdist - uses: PyO3/maturin-action@v1 - with: - command: sdist - args: --out dist + - name: Lint + run: | + pipenv run pre-commit run --all-files - - name: Upload sdist - uses: actions/upload-artifact@v3 - with: - name: wheels - path: dist + - name: Build + run: | + pipenv run maturin develop - release: - name: Release - runs-on: ubuntu-latest - if: "startsWith(github.ref, 'refs/tags/')" - needs: [linux, windows, macos, sdist] - steps: - - uses: actions/download-artifact@v3 - with: - name: wheels + - name: Install cargo-llvm-cov + uses: taiki-e/install-action@cargo-llvm-cov - - name: Publish to PyPI - uses: PyO3/maturin-action@v1 - env: - MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }} - with: - command: upload - args: --non-interactive --skip-existing * + - name: Test with coverage + run: | + cargo llvm-cov --lcov --output-path coverage.lcov + pipenv run pytest --cov=bionic_writer --cov-report xml + + - name: Publish Coverage + uses: codecov/codecov-action@v1 + if: | + matrix.os == 'ubuntu-latest' && + matrix.python-version == '3.10' diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..c77b7a5 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,126 @@ +name: build +on: + push: + tags: + - '*' + +permissions: + contents: read + +jobs: + linux: + name: Build linux + runs-on: ubuntu-latest + strategy: + matrix: + target: [x86_64, x86, aarch64, armv7, s390x, ppc64le] + + steps: + - uses: actions/checkout@v3 + + - uses: actions/setup-python@v4 + with: + python-version: '3.10' + + - name: Build wheels + uses: PyO3/maturin-action@v1 + with: + target: ${{ matrix.target }} + args: --release --out dist --find-interpreter + sccache: 'true' + manylinux: auto + + - name: Upload wheels + uses: actions/upload-artifact@v3 + with: + name: wheels + path: dist + + windows: + name: Build windows + runs-on: windows-latest + strategy: + matrix: + target: [x64, x86] + steps: + - uses: actions/checkout@v3 + + - uses: actions/setup-python@v4 + with: + python-version: '3.10' + architecture: ${{ matrix.target }} + + - name: Build wheels + uses: PyO3/maturin-action@v1 + with: + target: ${{ matrix.target }} + args: --release --out dist --find-interpreter + sccache: 'true' + + - name: Upload wheels + uses: actions/upload-artifact@v3 + with: + name: wheels + path: dist + + macos: + name: Build macos + runs-on: macos-latest + strategy: + matrix: + target: [x86_64, aarch64] + steps: + - uses: actions/checkout@v3 + + - uses: actions/setup-python@v4 + with: + python-version: '3.10' + + - name: Build wheels + uses: PyO3/maturin-action@v1 + with: + target: ${{ matrix.target }} + args: --release --out dist --find-interpreter + sccache: 'true' + + - name: Upload wheels + uses: actions/upload-artifact@v3 + with: + name: wheels + path: dist + + sdist: + name: Build sdist + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Build sdist + uses: PyO3/maturin-action@v1 + with: + command: sdist + args: --out dist + + - name: Upload sdist + uses: actions/upload-artifact@v3 + with: + name: wheels + path: dist + + release: + name: Release + runs-on: ubuntu-latest + if: "startsWith(github.ref, 'refs/tags/')" + needs: [linux, windows, macos, sdist] + steps: + - uses: actions/download-artifact@v3 + with: + name: wheels + + - name: Publish to PyPI + uses: PyO3/maturin-action@v1 + env: + MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }} + with: + command: upload + args: --non-interactive --skip-existing * diff --git a/Pipfile b/Pipfile new file mode 100644 index 0000000..0757494 --- /dev/null +++ b/Pipfile @@ -0,0 +1,11 @@ +[[source]] +url = "https://pypi.org/simple" +verify_ssl = true +name = "pypi" + +[packages] + +[dev-packages] + +[requires] +python_version = "3.11"