Continuous Integration #140
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: Continuous Integration | |
| on: | |
| schedule: | |
| - cron: "0 9 * * *" # daily at 09Z | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| tests: | |
| name: ${{ matrix.os }}-py${{ matrix.python-version }} | |
| if: github.repository == 'ARM-DOE/Adapt' | |
| runs-on: ${{ matrix.os }}-latest | |
| defaults: | |
| run: | |
| shell: bash -l {0} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: ["3.12", "3.13"] | |
| os: [ubuntu, macOS] | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 # required for setuptools_scm version tag detection | |
| - name: Set up micromamba | |
| uses: mamba-org/setup-micromamba@v3 | |
| with: | |
| environment-file: environment.yml | |
| create-args: python=${{ matrix.python-version }} | |
| init-shell: bash | |
| cache-downloads: true | |
| post-cleanup: "all" | |
| - name: Fetch all history for all tags and branches | |
| run: | | |
| git fetch --prune | |
| - name: Install adapt | |
| run: pip install -e . --no-deps --force-reinstall | |
| - name: Install ruff | |
| run: pip install ruff | |
| - name: Install import-linter | |
| run: pip install import-linter | |
| - name: Show environment info | |
| run: | | |
| python --version | |
| pip list | head -n 30 | |
| - name: Lint with ruff | |
| run: ruff check src tests | |
| - name: Check import architecture | |
| run: lint-imports --no-cache | |
| - name: Run tests | |
| run: | | |
| pytest -m "not integration" \ | |
| --cov=src/adapt \ | |
| --cov-report=term \ | |
| --cov-report=xml | |
| - name: Upload coverage to Codecov | |
| uses: codecov/codecov-action@v6 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| files: coverage.xml | |
| flags: unittests | |
| fail_ci_if_error: false |