Skip to content

Commit

Permalink
fixed keras 3 parsing, added unittest and github workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
HamzaEzzRa committed Jul 27, 2024
1 parent 0531131 commit 27e640b
Show file tree
Hide file tree
Showing 12 changed files with 649 additions and 46 deletions.
106 changes: 106 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
name: GitHub release of Python dist and PyPI publishing

on:
push:
tags:
- 'v*'

jobs:
run-tests:
name: Test before release
uses: ./.github/workflows/run-tests.yml

build:
name: Build distribution
needs: run-tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install build and dependencies
run: |
python3 -m pip install --upgrade pip
python3 -m pip install build --user
python3 -m pip install .[dev]
- name: Build distribution
run: python3 -m build

- name: Store the distribution packages
uses: actions/upload-artifact@v4
with:
name: rule4ml-package-dist
path: dist/

git-release:
name: Upload the distribution to GitHub
needs: build
runs-on: ubuntu-latest

permissions:
contents: write # mandatory for making GitHub Releases
id-token: write # mandatory for sigstore

steps:
- uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0

- name: Download all the dists
uses: actions/download-artifact@v4
with:
name: rule4ml-package-dist
path: dist/

- name: Sign the dists with Sigstore
uses: sigstore/gh-action-sigstore-python@v3.0.0
with:
inputs: >-
./dist/*.tar.gz
./dist/*.whl
- name: Create GitHub Release
env:
GITHUB_TOKEN: ${{ github.token }}
run: >-
gh release create
'${{ github.ref_name }}'
--repo '${{ github.repository }}'
--notes ""
- name: Upload to GitHub Release
env:
GITHUB_TOKEN: ${{ github.token }}
run: >-
gh release upload
'${{ github.ref_name }}' dist/**
--repo '${{ github.repository }}'
pypi-release:
name: Upload the distribution to PyPI
needs: build
runs-on: ubuntu-latest

environment:
name: release
url: https://pypi.org/p/rule4ml
permissions:
id-token: write # mandatory for trusted publishing

steps:
- name: Download all the dists
uses: actions/download-artifact@v4
with:
name: rule4ml-package-dist
path: dist/
- name: Publish distribution to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
46 changes: 46 additions & 0 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
on:
workflow_dispatch:
workflow_call:
pull_request:
branches: [main]

jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
python-version: ['3.9', '3.10', '3.11', '3.12']

steps:
- uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install .[dev]
- name: Run tests
run: |
python -m pytest > tests/test_results-${{ matrix.python-version }}-${{ matrix.os }}.log
- name: Upload test results
if: always()
uses: actions/upload-artifact@v4
with:
name: test_results-${{ matrix.python-version }}-${{ matrix.os }}
path: tests/test_results-${{ matrix.python-version }}-${{ matrix.os }}.log

- name: Report failed tests
if: failure()
run: |
echo "Some tests failed. Check the test log for more details."
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,13 @@ profile_default/
ipython_config.py

# Custom
.ruff*
.*_cache
*cleanup*.sh
notebooks/**
!notebooks/models
!notebooks/*.ipynb
**/hls4ml_prj*
*.log

format.py

Expand Down
Loading

0 comments on commit 27e640b

Please sign in to comment.