Skip to content

Commit

Permalink
👷 Do not skip curator on push events, do not green checkmark it if it…
Browse files Browse the repository at this point in the history
…'s not being run (#2360)
  • Loading branch information
falexwolf authored Jan 17, 2025
1 parent 81fdc42 commit b5debf1
Showing 1 changed file with 38 additions and 22 deletions.
60 changes: 38 additions & 22 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,40 +6,51 @@ on:
pull_request:

jobs:
test:
pre-filter:
runs-on: ubuntu-latest
env:
GITHUB_EVENT_NAME: ${{ github.event_name }}
strategy:
fail-fast: false
matrix:
group:
- "unit-core"
- "unit-storage"
- "tutorial"
- "guide"
- "biology"
- "faq"
- "storage"
- "cli"
- "curator"
timeout-minutes: 15
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0

- uses: dorny/paths-filter@v3
id: changes
if: github.event_name != 'push'
with:
filters: |
curator:
- 'lamindb/curators/**'
- 'tests/curators/test_curator.py'
- id: set-matrix
run: |
if [[ "${{ github.event_name }}" == "push" ]]; then
# On push, run all
echo "matrix={\"group\":[\"unit-core\",\"unit-storage\",\"tutorial\",\"guide\",\"biology\",\"faq\",\"storage\",\"cli\",\"curator\"]}" >> $GITHUB_OUTPUT
elif [[ "${{ steps.changes.outputs.curator }}" == "true" ]]; then
# If curator paths changed, include curator
echo "matrix={\"group\":[\"unit-core\",\"unit-storage\",\"tutorial\",\"guide\",\"biology\",\"faq\",\"storage\",\"cli\",\"curator\"]}" >> $GITHUB_OUTPUT
else
# Otherwise, run all except curator
echo "matrix={\"group\":[\"unit-core\",\"unit-storage\",\"tutorial\",\"guide\",\"biology\",\"faq\",\"storage\",\"cli\"]}" >> $GITHUB_OUTPUT
fi
test:
needs: pre-filter
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix: ${{fromJson(needs.pre-filter.outputs.matrix)}}
timeout-minutes: 15
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0

- uses: actions/setup-python@v5
if: ${{ matrix.group != 'curator' || steps.changes.outputs.curator == 'true' }}
with:
python-version: |
${{ matrix.group == 'storage' && '3.10' ||
Expand All @@ -59,13 +70,17 @@ jobs:
with:
path: ~/postgres.tar
key: cache-postgres-0

- name: cache postgres miss
if: ${{ steps.cache-postgres.outputs.cache-hit != 'true' }}
run: docker pull postgres:latest && docker image save postgres:latest --output ~/postgres.tar

- name: cache postgres use
if: ${{ steps.cache-postgres.outputs.cache-hit == 'true' }}
run: docker image load --input ~/postgres.tar

- run: pip install "laminci@git+https://x-access-token:${{ secrets.LAMIN_BUILD_DOCS }}@github.com/laminlabs/laminci"

- name: install postgres
if: ${{ matrix.group == 'faq' }}
run: sudo apt-get install libpq-dev
Expand All @@ -75,16 +90,17 @@ jobs:
run: sudo apt-get -y install graphviz

- run: nox -s lint
if: ${{ matrix.group == 'tutorial' }} # choose a fast-running a group
if: ${{ matrix.group == 'tutorial' }}

- run: nox -s "install_ci(group='${{ matrix.group }}')"
if: ${{ matrix.group != 'curator' || steps.changes.outputs.curator == 'true' }}

- uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-1

- run: nox -s "build(group='${{ matrix.group }}')"
if: ${{ matrix.group != 'curator' || steps.changes.outputs.curator == 'true' }}

- name: upload coverage
uses: actions/upload-artifact@v4
Expand Down

0 comments on commit b5debf1

Please sign in to comment.