Skip to content

Commit

Permalink
chore: add development environment + ci (#9)
Browse files Browse the repository at this point in the history
* ci(py): add maturin workflow

* ci(py): drop windows build, as rff is unix-only

* ci(py): drop windows job dep

* docs: contrib guide

* chore: generic config files

* chore: add nix-based tooling

* chore: migrate tooling tripsu->fuzon

* chore: target crate path in nix flake

* chore: add just recipe for nix dev

* docs(readme): describe python api

* docs(readme): minimal development instructions

* chore: rm unneeded tooling

* refactor(nix): simplify dev image setup

* chore: add maintenance just recipe

* fix(just): image file path

* chore: Nix fixes (#12)

* chore: nix builds now but wont find python

* fix: pass rootSrc to derivation `fuzon`

* fix: correct `python312` dependencies

* docs(readme): update dev instructions

* chore(just): fix docker mount path

---------

Co-authored-by: Gabriel Nützi <[email protected]>
  • Loading branch information
cmdoret and gabyx authored Sep 13, 2024
1 parent 784ca87 commit 29e256f
Show file tree
Hide file tree
Showing 24 changed files with 2,766 additions and 21 deletions.
17 changes: 17 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# EditorConfig is awesome: https://EditorConfig.org

# top-most EditorConfig file
root = true

# Unix-style newlines with a newline ending every file
[*]
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 4

[*.{json,yaml,yml}]
indent_size = 2

[*.nix]
indent_size = 2
1 change: 1 addition & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
use flake ./tools/nix#default
106 changes: 106 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@

# Attribute file for assigning key=value pairs to paths.
# Any edit to this file needs to be reviewed by admins.
# These attributes define among other things
# which files are transferred into Git LFS when
# staging/commiting.
#
# Please read the docs first: https://git-scm.com/docs/gitattributes
#
# Restrictions:
# - No backslashes for paths! (also on Windows)
# - For spaces in paths use `[[:space:]]`.
#

# Overall LF lineendings for the
# following files.
# ===============================
* text=auto eol=lf

# Default attribute patterns for common binary files
# which should be stored in Git LFS.
# ==================================================
# Images
*.[Ii][Cc][Oo] filter=lfs diff=lfs merge=lfs -text
*.[Jj][Pp][Gg] filter=lfs diff=lfs merge=lfs -text
*.[Jj][Pp][Ee][Gg] filter=lfs diff=lfs merge=lfs -text
*.[Pp][Nn][Gg] filter=lfs diff=lfs merge=lfs -text
*.[Gg][Ii][Ff] filter=lfs diff=lfs merge=lfs -text
*.[Tt][Ii][Ff] filter=lfs diff=lfs merge=lfs -text
*.[Tt][Ii][Ff][Ff] filter=lfs diff=lfs merge=lfs -text
*.[Pp][Ss][Dd] filter=lfs diff=lfs merge=lfs -text
*.[Aa][Ii] filter=lfs diff=lfs merge=lfs -text

# Media
*.[Pp][Dd][Ff] filter=lfs diff=lfs merge=lfs -text

# Video/Audio
*.[Mm][Oo][Vv] filter=lfs diff=lfs merge=lfs -text
*.[Mm][Pp]4 filter=lfs diff=lfs merge=lfs -text
*.[Mm][Pp]2 filter=lfs diff=lfs merge=lfs -text
*.[Mm]4[Vv] filter=lfs diff=lfs merge=lfs -text
*.[Ww][Mm][Vv] filter=lfs diff=lfs merge=lfs -text
*.[Ww][Mm][Vv] filter=lfs diff=lfs merge=lfs -text
*.[Mm][Pp][Ee] filter=lfs diff=lfs merge=lfs -text
*.[Mm][Pp][Gg] filter=lfs diff=lfs merge=lfs -text
*.[Mm][Pp][Ee][Gg] filter=lfs diff=lfs merge=lfs -text
*.[Aa][Vv][Ii] filter=lfs diff=lfs merge=lfs -text
*.[Ww][Ee][Bb][Mm] filter=lfs diff=lfs merge=lfs -text
*.[Oo][Gg][Gg] filter=lfs diff=lfs merge=lfs -text
*.[Mm][Pp]3 filter=lfs diff=lfs merge=lfs -text
*.[Ww][Aa][Vv] filter=lfs diff=lfs merge=lfs -text

# MS Office
*.[Dd][Oo][Cc] filter=lfs diff=lfs merge=lfs -text
*.[Dd][Oo][Cc][Xx] filter=lfs diff=lfs merge=lfs -text
*.[Pp][Pp][Tt] filter=lfs diff=lfs merge=lfs -text
*.[Pp][Pp][Tt][Xx] filter=lfs diff=lfs merge=lfs -text
*.[Xx][Ll][Ss] filter=lfs diff=lfs merge=lfs -text
*.[Xx][Ll][Ss][Xx] filter=lfs diff=lfs merge=lfs -text
*.[Dd][Oo][Tt][Xx] filter=lfs diff=lfs merge=lfs -text

# Fonts
*.[Tt][Tt][Ff] filter=lfs diff=lfs merge=lfs -text
*.[Oo][Tt][Ff] filter=lfs diff=lfs merge=lfs -text
*.[Ww][Oo][Ff][Ff] filter=lfs diff=lfs merge=lfs -text
*.[Ww][Oo][Ff][Ff]2 filter=lfs diff=lfs merge=lfs -text

# Data Zips
*.[Zz][Ii][Pp] filter=lfs diff=lfs merge=lfs -text
*.[Zz] filter=lfs diff=lfs merge=lfs -text
*.[Gg][Zz] filter=lfs diff=lfs merge=lfs -text
*.[Tt][Aa][Rr] filter=lfs diff=lfs merge=lfs -text
*.[Tt][Gg][Zz] filter=lfs diff=lfs merge=lfs -text
*.[Zz][Ii][Pp] filter=lfs diff=lfs merge=lfs -text
*.[Bb][Zz]2 filter=lfs diff=lfs merge=lfs -text
*.[Ll][Zz][Mm][Aa] filter=lfs diff=lfs merge=lfs -text
*.[Ll][Zz] filter=lfs diff=lfs merge=lfs -text
*.[Ll][Zz]4 filter=lfs diff=lfs merge=lfs -text
*.7[Zz] filter=lfs diff=lfs merge=lfs -text
*.[Ss]7[Zz] filter=lfs diff=lfs merge=lfs -text
*.[Rr][Aa][Rr] filter=lfs diff=lfs merge=lfs -text
*.[Bb][Zz][Ii][Pp] filter=lfs diff=lfs merge=lfs -text

# Packages
*.[Xx][Pp][Ii] filter=lfs diff=lfs merge=lfs -text
*.[Dd][Mm][Gg] filter=lfs diff=lfs merge=lfs -text
*.[Ii][Mm][Gg] filter=lfs diff=lfs merge=lfs -text
*.[Ii][Ss][Oo] filter=lfs diff=lfs merge=lfs -text
*.[Ww][Ii][Mm] filter=lfs diff=lfs merge=lfs -text
*.[Ss][Ww][Mm] filter=lfs diff=lfs merge=lfs -text
*.[Ee][Ss][Dd] filter=lfs diff=lfs merge=lfs -text
*.[Mm][Ss][Ii] filter=lfs diff=lfs merge=lfs -text
*.[Pp][Kk][Gg] filter=lfs diff=lfs merge=lfs -text
*.[Mm][Pp][Kk][Gg] filter=lfs diff=lfs merge=lfs -text
*.[Dd][Ee][Bb] filter=lfs diff=lfs merge=lfs -text
*.[Rr][Pp][Mm] filter=lfs diff=lfs merge=lfs -text
*.[Jj][Aa][Rr] filter=lfs diff=lfs merge=lfs -text

# Libraries
*.[Pp][Dd][Bb] filter=lfs diff=lfs merge=lfs -text
*.[Dd][Ll][Ll] filter=lfs diff=lfs merge=lfs -text
*.[Ll][Ii][Bb] filter=lfs diff=lfs merge=lfs -text

# General binary
*.[Bb][Ii][Nn] filter=lfs diff=lfs merge=lfs -text
*.[Ee][Xx][Ee] filter=lfs diff=lfs merge=lfs -text
142 changes: 142 additions & 0 deletions .github/workflows/maturin.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
# This file is autogenerated by maturin v1.7.0
# To update, run
#
# maturin generate-ci github -m pyfuzon/Cargo.toml
#
name: CI

on:
push:
branches:
- main
- master
tags:
- '*'
pull_request:
workflow_dispatch:

permissions:
contents: read

jobs:
linux:
runs-on: ${{ matrix.platform.runner }}
strategy:
matrix:
platform:
- runner: ubuntu-latest
target: x86_64
- runner: ubuntu-latest
target: x86
- runner: ubuntu-latest
target: aarch64
- runner: ubuntu-latest
target: armv7
- runner: ubuntu-latest
target: s390x
- runner: ubuntu-latest
target: ppc64le
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.x
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.platform.target }}
args: --release --out dist --manifest-path pyfuzon/Cargo.toml
sccache: 'true'
manylinux: auto
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-linux-${{ matrix.platform.target }}
path: dist

musllinux:
runs-on: ${{ matrix.platform.runner }}
strategy:
matrix:
platform:
- runner: ubuntu-latest
target: x86_64
- runner: ubuntu-latest
target: x86
- runner: ubuntu-latest
target: aarch64
- runner: ubuntu-latest
target: armv7
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.x
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.platform.target }}
args: --release --out dist --manifest-path pyfuzon/Cargo.toml
sccache: 'true'
manylinux: musllinux_1_2
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-musllinux-${{ matrix.platform.target }}
path: dist

macos:
runs-on: ${{ matrix.platform.runner }}
strategy:
matrix:
platform:
- runner: macos-12
target: x86_64
- runner: macos-14
target: aarch64
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.x
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.platform.target }}
args: --release --out dist --manifest-path pyfuzon/Cargo.toml
sccache: 'true'
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-macos-${{ matrix.platform.target }}
path: dist

sdist:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build sdist
uses: PyO3/maturin-action@v1
with:
command: sdist
args: --out dist --manifest-path pyfuzon/Cargo.toml
- name: Upload sdist
uses: actions/upload-artifact@v4
with:
name: wheels-sdist
path: dist

release:
name: Release
runs-on: ubuntu-latest
if: "startsWith(github.ref, 'refs/tags/')"
needs: [linux, musllinux, macos, sdist]
steps:
- uses: actions/download-artifact@v4
- 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 wheels-*/*
14 changes: 3 additions & 11 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,27 +1,19 @@
.direnv
package

# Generated by Cargo
# will have compiled files and executables
debug/
target/
__pycache__/
*.so

# 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

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

# MSVC Windows builds of rustc generate these, which store debugging information
*.pdb

# RustRover
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/

# Added by cargo

/target
9 changes: 9 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"printWidth": 80,
"tabWidth": 2,
"semi": false,
"singleQuote": false,
"overrides": [
{ "files": "*.md", "options": { "proseWrap": "always", "tabWidth": 2 } }
]
}
37 changes: 37 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Contributing

**Thank you very much for considering contributing to this project!**

We welcome any form of contribution:

- New Issues (feature requests, bug reports, questions, ideas, ...)
- Pull Requests (documentation improvements, code improvements, new features,
...)

**Note**: Before you take the time to open a pull request, please open an issue
first. This will give us the chance to discuss any potential changes first.

## Opening a Pull Request

Pull requests are the best way to propose changes to the codebase. We actively
welcome your pull requests:

1. Fork the repo and create your branch from `main`.
2. If you've added code that should be tested, add tests.
3. If you've changed APIs, update the documentation.
4. Ensure the test suite passes: the CI will help you.
5. Create the pull request.

**Note:** Pull-requests can only be merged if the CI passes.

## License

By contributing, you agree that your contributions will be licensed under this
[license](LICENSE).

## Important Links

- [Open Issues](https://github.com/sdsc-ordes/fuzon/issues)
- [Open Pull Requests](https://github.com/sdsc-ordes/fuzon/pulls)
- [Development Section in the README](https://github.com/sdsc-ordes/fuzon#development)
- [LICENSE](https://github.com/sdsc-ordes/fuzon/blob/main/LICENSE)
Loading

0 comments on commit 29e256f

Please sign in to comment.