Update README.md (#1070) #20
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: "BioNeMo Recipes CI" | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - "pull-request/[0-9]+" | |
| - "dependabot/**" | |
| merge_group: | |
| types: [checks_requested] | |
| schedule: | |
| - cron: "0 7 * * *" # Runs at 7 AM UTC daily (12 AM MST) | |
| defaults: | |
| run: | |
| shell: bash -x -e -u -o pipefail {0} | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| changed-dirs: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| any_changed: ${{ steps.changed-files.outputs.any_changed }} | |
| all_changed_files: ${{ steps.changed-files.outputs.all_changed_files }} | |
| dirs: ${{ steps.set-dirs.outputs.dirs }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Get changed files | |
| id: changed-files | |
| uses: step-security/changed-files@v46 | |
| with: | |
| json: true | |
| matrix: true | |
| base_sha: main | |
| dir_names: true | |
| dir_names_max_depth: 2 | |
| files: | | |
| models/** | |
| recipes/** | |
| .github/workflows/unit-tests-recipes.yml | |
| - id: set-dirs | |
| run: | | |
| # Get all recipe and model directories | |
| ALL_DIRS=$(ls -d recipes/*/ models/*/ 2>/dev/null | jq -R -s -c 'split("\n")[:-1] | map(rtrimstr("/"))') | |
| CHANGED_FILES='${{ steps.changed-files.outputs.all_changed_files }}' | |
| # Filter directories to only those that have changed files. Then assign a Docker image to each. | |
| # Currently, AMPLIFY is the only folder that needs a custom base image, since we have to support both TE and | |
| # xformers-based models for golden value testing. The rest of the models use the default pytorch image. | |
| DIRS=$(echo "$ALL_DIRS" | jq -c --argjson changed "$CHANGED_FILES" ' | |
| map(select(. as $dir | $changed | index($dir) != null)) | | |
| map({ | |
| dir: ., | |
| image: ( | |
| if . == "models/amplify" then | |
| "svcbionemo023/bionemo-framework:amplify-model-devcontainer-082025" | |
| else | |
| "nvcr.io/nvidia/pytorch:25.06-py3" | |
| end | |
| ) | |
| }) | |
| ') | |
| echo "dirs=$DIRS" >> $GITHUB_OUTPUT | |
| - name: Show output | |
| run: | | |
| echo '${{ toJSON(steps.changed-files.outputs) }}' | |
| echo '${{ toJSON(steps.set-dirs.outputs) }}' | |
| shell: | |
| bash | |
| unit-tests: | |
| needs: changed-dirs | |
| runs-on: linux-amd64-gpu-l4-latest-1 | |
| container: | |
| image: ${{ matrix.recipe.image }} | |
| strategy: | |
| matrix: | |
| recipe: ${{ fromJson(needs.changed-dirs.outputs.dirs) }} | |
| fail-fast: false | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| sparse-checkout: '${{ matrix.recipe.dir }}' | |
| sparse-checkout-cone-mode: false | |
| - name: Install dependencies | |
| working-directory: ${{ matrix.recipe.dir }} | |
| # | |
| run: | | |
| if [ -f pyproject.toml ] || [ -f setup.py ]; then | |
| PIP_CONSTRAINT= pip install -e . | |
| echo "Installed ${{ matrix.recipe.dir }} as editable package" | |
| elif [ -f requirements.txt ]; then | |
| PIP_CONSTRAINT= pip install -r requirements.txt | |
| echo "Installed ${{ matrix.recipe.dir }} from requirements.txt" | |
| else | |
| echo "No pyproject.toml, setup.py, or requirements.txt found in ${{ matrix.recipe.dir }}" | |
| exit 1 | |
| fi | |
| - name: Run tests | |
| working-directory: ${{ matrix.recipe.dir }} | |
| run: pytest -v . |