added batched sampling #341
This file contains hidden or 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 workflow will install Python dependencies, run tests and lint with a single version of Python | |
| # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python | |
| name: Build | |
| on: | |
| push: | |
| branches: ["main"] | |
| pull_request: | |
| branches: ["main"] | |
| permissions: | |
| contents: write | |
| jobs: | |
| lint: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v7 | |
| - name: Set up Python 3.12 | |
| run: uv python install 3.12 | |
| - name: Install dependencies | |
| run: uv sync --group lint | |
| - name: Lint with flake8 | |
| run: | | |
| # stop the build if there are Python syntax errors or undefined names | |
| uv run flake8 . --exclude=.venv --count --select=E9,F63,F7,F82 --show-source --statistics | |
| # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide | |
| uv run flake8 . --exclude=.venv --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics | |
| test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v7 | |
| - name: Set up Python 3.12 | |
| run: uv python install 3.12 | |
| - name: Install dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y --no-install-recommends pandoc | |
| uv sync --group test | |
| - name: Run fast tests | |
| run: | | |
| uv run pytest -m "not slow and not experimental and not extraslow" -n auto --junitxml=reports/junit/junit-fast.xml --cov=gensbi --cov-report=term-missing | |
| - name: Run slow tests | |
| run: | | |
| uv run pytest -m "slow" -n auto --junitxml=reports/junit/junit-slow.xml --cov=gensbi --cov-append --cov-report=term-missing | |
| - name: Run experimental tests | |
| run: | | |
| uv run pytest -m "experimental" -n auto --junitxml=reports/junit/junit-experimental.xml --cov=gensbi --cov-append --cov-report=xml:reports/coverage/coverage.xml --cov-report=term-missing | |
| - name: Merge Test Reports | |
| run: | | |
| uv run python -m junitparser merge reports/junit/junit-fast.xml reports/junit/junit-slow.xml reports/junit/junit-experimental.xml reports/junit/junit.xml | |
| - name: Generate Badges | |
| run: | | |
| uv run genbadge coverage --input-file reports/coverage/coverage.xml --output-file reports/badges/coverage.svg | |
| uv run genbadge tests --input-file reports/junit/junit.xml --output-file reports/badges/tests.svg | |
| - name: Upload Test Reports | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: test-reports | |
| path: reports/ | |
| docs: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v7 | |
| - name: Set up Python 3.12 | |
| run: uv python install 3.12 | |
| - name: Install dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y --no-install-recommends pandoc | |
| uv sync --group docs | |
| - name: Build documentation | |
| run: | | |
| cd docs | |
| uv run make html | |
| - name: Upload Documentation | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: docs-html | |
| path: docs/_build/html | |
| publish-badges: | |
| needs: test | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Download Test Reports | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: test-reports | |
| path: reports | |
| - name: Prepare Badges | |
| run: | | |
| mkdir -p img/badges | |
| cp -r reports/badges/*.svg img/badges/ | |
| - name: Generate token | |
| id: app-token | |
| uses: actions/create-github-app-token@v2 | |
| with: | |
| app-id: ${{ vars.ICON_DEPLOY_APP_ID }} | |
| private-key: ${{ secrets.ICON_DEPLOY_PRIVATE_KEY }} | |
| - name: Commit and push badges | |
| uses: stefanzweifel/git-auto-commit-action@v6 | |
| with: | |
| commit_message: "Update badges [skip ci]" | |
| branch: main | |
| file_pattern: img/badges/*.svg | |
| token: ${{ steps.app-token.outputs.token }} | |
| deploy-docs: | |
| needs: docs | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Download Documentation | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: docs-html | |
| path: docs/_build/html | |
| - name: Deploy to GitHub Pages | |
| uses: peaceiris/actions-gh-pages@v4 | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| publish_dir: ./docs/_build/html | |
| publish_branch: gh-pages | |
| cname: gensbi.com |