Skip to content

Commit

Permalink
Merge pull request #4 from kornia/feat/maturin
Browse files Browse the repository at this point in the history
switch to maturin
  • Loading branch information
edgarriba authored Mar 12, 2022
2 parents 6bcd73a + 2423622 commit a5fe268
Show file tree
Hide file tree
Showing 14 changed files with 3,189 additions and 89 deletions.
73 changes: 50 additions & 23 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,61 @@ on:
branches:
- main

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
check:
name: Check
build_docker:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
-
name: Checkout the repository
uses: actions/checkout@v2
-
name: Set up QEMU
uses: docker/setup-qemu-action@v1
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
-
name: Log in to the Container registry
uses: docker/#-action@v1
with:
profile: minimal
toolchain: stable
override: true
- uses: actions-rs/cargo@v1
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
-
name: Build and push Docker image
uses: docker/build-push-action@v2
with:
command: check
context: .
file: ./docker/devel.Dockerfile
platforms: linux/amd64, linux/arm64
push: true
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}/devel:latest

test:
name: Test Suite
needs: [build_docker]
runs-on: ubuntu-latest
steps:
-
name: Checkout the repository
uses: actions/checkout@v2
-
name: Log in to the Container registry
uses: docker/#-action@v1
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
-
name: Compile and Run the tests
run: ./run_tests.sh

check:
name: Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
Expand All @@ -34,20 +72,9 @@ jobs:
profile: minimal
toolchain: stable
override: true
- name: Create docker container
run: cd ./docker && ./build_devel.sh
- name: Enter docker container
run: |
echo "ls1"
ls
echo "ls2"
./devel.sh
echo "ls3"
ls
- name: Compile Rust code
run: pip3 install .[dev] --user
- name: Test
run: pytest test/
- uses: actions-rs/cargo@v1
with:
command: check

fmt:
name: Rustfmt
Expand Down
77 changes: 77 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: Release

on:
push:
pull_request:

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
linux:
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
uses: actions/checkout@v2
- name: Log in to the Container registry
uses: docker/#-action@v1
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: messense/maturin-action@v1
with:
manylinux: auto
command: build
args: --release -o dist
- name: Upload wheels
uses: actions/upload-artifact@v2
with:
name: wheels
path: dist

windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- uses: messense/maturin-action@v1
with:
command: build
args: --release --no-sdist -o dist
- name: Upload wheels
uses: actions/upload-artifact@v2
with:
name: wheels
path: dist

macos:
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
- uses: messense/maturin-action@v1
with:
command: build
args: --release --no-sdist -o dist --universal2
- name: Upload wheels
uses: actions/upload-artifact@v2
with:
name: wheels
path: dist

release:
name: Release
runs-on: ubuntu-latest
if: "startsWith(github.ref, 'refs/tags/')"
needs: [ macos, windows, linux ]
steps:
- uses: actions/download-artifact@v2
with:
name: wheels
- name: Publish to PyPI
uses: messense/maturin-action@v1
env:
MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
with:
command: upload
args: --skip-existing
78 changes: 70 additions & 8 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,72 @@
# Generated by Cargo
# will have compiled files and executables
/target/
/target

# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
Cargo.lock
# Byte-compiled / optimized / DLL files
__pycache__/
.pytest_cache/
*.py[cod]

# These are backup files generated by rustfmt
**/*.rs.bk
# C extensions
*.so

# Distribution / packaging
.Python
.venv/
env/
bin/
build/
develop-eggs/
dist/
eggs/
lib/
lib64/
parts/
sdist/
var/
include/
man/
venv/
*.egg-info/
.installed.cfg
*.egg

# Installer logs
pip-log.txt
pip-delete-this-directory.txt
pip-selfcheck.json

# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.cache
nosetests.xml
coverage.xml

# Translations
*.mo

# Mr Developer
.mr.developer.cfg
.project
.pydevproject

# Rope
.ropeproject

# Django stuff:
*.log
*.pot

.DS_Store

# Sphinx documentation
docs/_build/

# PyCharm
.idea/

# VSCode
.vscode/

# Pyenv
.python-version
Loading

0 comments on commit a5fe268

Please # to comment.