Dev 081 #176
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
| name: Lint Build Test Codecov | |
| on: | |
| push: | |
| branches: [ main ] | |
| pull_request: | |
| branches: [ main, pre-release ] | |
| jobs: | |
| build: | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: true | |
| matrix: | |
| os: [ ubuntu-latest, macos-latest, windows-latest ] | |
| python-version: [ '3.10', '3.11', '3.12', '3.13' ] # Add multiple Python versions for testing | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v5 | |
| with: | |
| enable-cache: true | |
| cache-dependency-glob: "uv.lock" | |
| - name: Verify uv installation | |
| run: | | |
| uv --version || echo "uv installation failed" | |
| - name: "Set up Python" | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} # Use matrix.python-version for multiple versions | |
| # Strip ANSI escape sequences for tests on Windows | |
| - name: Preprocess stdout for Windows | |
| if: matrix.os == 'windows-latest' | |
| run: | | |
| pip install ansi2html # Install a tool to handle ANSI escape sequences | |
| echo "from ansi2html.parser import Ansi2HTMLParser; import sys; sys.stdout.write(Ansi2HTMLParser().parse(input()))" > strip_ansi.py | |
| pytest --capture=sys --tb=short | python strip_ansi.py | |
| - name: Install the project | |
| run: | | |
| uv sync --all-extras --dev || echo "Dependency installation failed" | |
| - name: Lint with flake8 | |
| run: | | |
| uv run flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics | |
| - name: Run tests and generate coverage report | |
| run: | | |
| uv run pytest --verbose --cov --cov-report=xml --cov-report=term-missing || echo "Tests failed" | |
| - name: Upload Coverage to Codecov | |
| uses: codecov/codecov-action@v5 | |
| with: | |
| files: ./coverage.xml | |
| flags: unittests | |
| name: codecov-umbrella | |
| fail_ci_if_error: false # Don't fail CI if Codecov upload fails | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| - name: Run examples | |
| run: | | |
| uv run raman_fitting run examples | |
| build-docker: | |
| runs-on: ubuntu-latest | |
| needs: build | |
| strategy: | |
| fail-fast: true | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: extractions/setup-just@v2 | |
| - name: Build Docker image | |
| run: docker build -t raman-fitting-image . | |
| - name: Run Docker container | |
| run: docker run -it raman-fitting-image |