-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #375 from NNPDF/oxidize-ci
Rust/maturin CI
- Loading branch information
Showing
28 changed files
with
337 additions
and
65 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 |
---|---|---|
@@ -0,0 +1,28 @@ | ||
name: Deploy Crates | ||
|
||
on: | ||
push: | ||
tags: | ||
- "*" | ||
workflow_dispatch: | ||
|
||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-python@v5 | ||
- name: Install and configure Poetry | ||
uses: snok/install-poetry@v1 | ||
- name: Install task runner | ||
run: pip install poethepoet | ||
- name: Bump versions | ||
run: | | ||
poetry install --only version | ||
poe bump-version | ||
- name: Publish crates | ||
run: | | ||
jq '.[]' crates/release.json | xargs -I _ cargo publish -p _ --allow-dirty | ||
env: | ||
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} |
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 |
---|---|---|
@@ -0,0 +1,123 @@ | ||
name: Deploy Maturin wheels | ||
|
||
on: | ||
push: | ||
tags: | ||
- "*" | ||
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 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: "3.10" | ||
- name: Build wheels | ||
uses: PyO3/maturin-action@v1 | ||
with: | ||
target: ${{ matrix.platform.target }} | ||
args: --release --out dist --find-interpreter -m crates/eko/Cargo.toml | ||
sccache: "true" | ||
manylinux: auto | ||
- name: Upload wheels | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: wheels-linux-${{ matrix.platform.target }} | ||
path: dist | ||
|
||
windows: | ||
runs-on: ${{ matrix.platform.runner }} | ||
strategy: | ||
matrix: | ||
platform: | ||
- runner: windows-latest | ||
target: x64 | ||
- runner: windows-latest | ||
target: x86 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: "3.10" | ||
architecture: ${{ matrix.platform.target }} | ||
- name: Build wheels | ||
uses: PyO3/maturin-action@v1 | ||
with: | ||
target: ${{ matrix.platform.target }} | ||
args: --release --out dist --find-interpreter -m crates/eko/Cargo.toml | ||
sccache: "true" | ||
- name: Upload wheels | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: wheels-windows-${{ matrix.platform.target }} | ||
path: dist | ||
|
||
macos: | ||
runs-on: ${{ matrix.platform.runner }} | ||
strategy: | ||
matrix: | ||
platform: | ||
- runner: macos-latest | ||
target: x86_64 | ||
- runner: macos-14 | ||
target: aarch64 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: "3.10" | ||
- name: Build wheels | ||
uses: PyO3/maturin-action@v1 | ||
with: | ||
target: ${{ matrix.platform.target }} | ||
args: --release --out dist --find-interpreter -m crates/eko/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 -m crates/eko/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, windows, 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-*/* |
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
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
[workspace] | ||
members = ["crates/*"] | ||
resolver = "2" | ||
|
||
[workspace.package] | ||
authors = [ | ||
"A. Barontini <[email protected]>", | ||
"A. Candido <[email protected]>", | ||
"F. Hekhorn <[email protected]>", | ||
"N. Laurenti <[email protected]>", | ||
"G. Magni <[email protected]>", | ||
"T. Sharma <[email protected]>", | ||
] | ||
description = "Evolution Kernel Operators" | ||
readme = "README.md" | ||
categories = ["science"] | ||
edition = "2021" | ||
keywords = ["physics"] | ||
license = "GPL-3.0-or-later" | ||
repository = "https://github.com/NNPDF/eko" | ||
rust-version = "1.60.0" | ||
version = "0.0.1" |
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Welcome to the rusty side of EKO! | ||
|
||
Here, we develop the Rust components of the EKO library | ||
|
||
## Crates | ||
|
||
- `ekore` contains the underlying collinear anomalous dimensions and the operator matrix elements | ||
- `eko` is the glue between the Python side and the `ekore` crate | ||
|
||
## Files | ||
|
||
- `release.json` defines the releasing order of crates | ||
- only listed crates will be released | ||
- dependent crates should follow those they are depending on | ||
- `katex-header.html` is an HTML snippet to be included in every docs page to inject | ||
KaTeX support | ||
- `bump-versions.py` increases the Rust versions in all crates consistently | ||
- `make_bib.py` generates the Rust function stubs which serve as fake bibliography system |
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 |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import json | ||
import sys | ||
from pathlib import Path | ||
|
||
import tomlkit | ||
|
||
HERE = Path(__file__).parent | ||
CRATES = json.loads((HERE / "release.json").read_text()) | ||
|
||
|
||
def workspace(manifest, version): | ||
manifest["workspace"]["package"]["version"] = version | ||
return manifest | ||
|
||
|
||
def crate(manifest, version): | ||
internals = set(manifest["dependencies"].keys()).intersection(CRATES) | ||
for dep in internals: | ||
manifest["dependencies"][dep]["version"] = version | ||
return manifest | ||
|
||
|
||
def update(path, version, edit): | ||
path = HERE / Path(path) / "Cargo.toml" | ||
manifest = tomlkit.parse(path.read_text()) | ||
manifest = edit(manifest, version) | ||
path.write_text(tomlkit.dumps(manifest)) | ||
|
||
|
||
def main(version): | ||
update("..", version, workspace) | ||
for name in CRATES: | ||
update(name, version, crate) | ||
|
||
|
||
if __name__ == "__main__": | ||
if len(sys.argv) < 2: | ||
raise ValueError(f"Pass a version (e.g. v0.0.0) to {sys.argv[0]}") | ||
# `git describe` starts with a `v` which we need to remove again | ||
main(sys.argv[1][1:]) |
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,15 +1,24 @@ | ||
[package] | ||
name = "eko" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
authors.workspace = true | ||
description.workspace = true | ||
readme.workspace = true | ||
categories.workspace = true | ||
edition.workspace = true | ||
keywords.workspace = true | ||
license.workspace = true | ||
repository.workspace = true | ||
rust-version.workspace = true | ||
version.workspace = true | ||
|
||
[package.metadata.docs.rs] | ||
rustdoc-args = [ "--html-in-header", "../katex-header.html" ] | ||
rustdoc-args = ["--html-in-header", "katex-header.html"] | ||
|
||
[lib] | ||
name = "ekors" | ||
crate-type = ["cdylib"] | ||
|
||
[dependencies] | ||
num = "0.4.1" | ||
ekore = { version = "0.1.0", path = "../ekore" } | ||
ekore = { path = "../ekore", version = "0.0.1" } |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
../katex-header.html |
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
Oops, something went wrong.