Add CI #8
Workflow file for this run
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
name: CI | |
on: | |
pull_request: | |
release: | |
types: | |
- released | |
- prereleased | |
jobs: | |
# macos: | |
# runs-on: macos-latest | |
# strategy: | |
# matrix: | |
# python-version: ['3.9'] | |
# steps: | |
# - uses: actions/checkout@v3 | |
# with: | |
# submodules: recursive | |
# - uses: actions/cache@v3 | |
# with: | |
# path: | | |
# ~/.cargo/bin/ | |
# ~/.cargo/registry/index/ | |
# ~/.cargo/registry/cache/ | |
# ~/.cargo/git/db/ | |
# target/ | |
# key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
# - uses: actions/setup-python@v4 | |
# with: | |
# python-version: ${{ matrix.python-version }} | |
# - name: Install Rust toolchain | |
# uses: dtolnay/rust-toolchain@stable | |
# with: | |
# targets: aarch64-apple-darwin | |
# - name: Build | |
# run: cargo build --release | |
# - name: Tests | |
# run: cargo test --no-default-features --release | |
# windows: | |
# runs-on: windows-latest | |
# strategy: | |
# matrix: | |
# python-version: ['3.9'] | |
# target: [x64] | |
# steps: | |
# - uses: actions/checkout@v3 | |
# with: | |
# submodules: recursive | |
# - uses: actions/cache@v3 | |
# with: | |
# path: | | |
# ~/.cargo/bin/ | |
# ~/.cargo/registry/index/ | |
# ~/.cargo/registry/cache/ | |
# ~/.cargo/git/db/ | |
# target/ | |
# key: ${{ runner.os }}-${{ matrix.target }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
# - uses: actions/setup-python@v4 | |
# with: | |
# python-version: ${{ matrix.python-version }} | |
# architecture: ${{ matrix.target }} | |
# - name: Install Rust toolchain | |
# uses: dtolnay/rust-toolchain@stable | |
# - name: Build | |
# if: matrix.target == 'x64' | |
# run: cargo build --release | |
# - name: Tests | |
# if: matrix.target == 'x64' | |
# run: cargo test --no-default-features --release | |
linux: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ['3.9'] | |
target: [x86_64] | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
- uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cargo/bin/ | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
target/ | |
key: ${{ runner.os }}-${{ matrix.target }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
- name: Install Rust toolchain | |
uses: dtolnay/rust-toolchain@stable | |
- name: Build | |
run: cargo build --release | |
- name: Tests | |
run: cargo test --release -- --test-threads 1 # TODO: dbgen not thread-safe | |
- name: Build wheels | |
uses: PyO3/maturin-action@v1 | |
with: | |
target: ${{ matrix.target }} | |
args: -i python --release --out dist | |
- name: Install wheel | |
run: pip install . | |
- name: Python Test | |
run: python -c "import pytpch" # TODO: proper python side tests | |
- name: Upload wheels | |
uses: actions/upload-artifact@v3 | |
with: | |
name: wheels | |
path: dist | |
pypi-publish: | |
name: Upload pytpch release to PyPI | |
runs-on: ubuntu-latest | |
if: "startsWith(github.ref, 'refs/tags/')" | |
needs: [ linux ] | |
environment: | |
name: pypi | |
url: https://pypi.org/p/pytpch | |
permissions: | |
id-token: write | |
steps: | |
- uses: actions/download-artifact@v3 | |
with: | |
name: wheels | |
- name: Publish package distributions to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
skip-existing: true | |
packages-dir: ./ |