Test the contributed recipes #306
This file contains 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: Test the contributed recipes | |
on: | |
schedule: | |
# Images are rebuilt at 03:00 on Monday UTC | |
# So we're testing recipes one hour in advance | |
# They will also be tested after building images | |
- cron: "0 2 * * 1" | |
pull_request: | |
paths: | |
- ".github/workflows/contributed-recipes.yml" | |
- "docs/using/recipe_code/**" | |
push: | |
branches: | |
- main | |
paths: | |
- ".github/workflows/contributed-recipes.yml" | |
- "docs/using/recipe_code/**" | |
workflow_dispatch: | |
workflow_call: | |
inputs: | |
# There is no good way to detect if the workflow was called using workflow_call | |
# https://github.com/actions/runner/discussions/1884 | |
called-using-workflow-call: | |
description: "Was the workflow called using workflow_call" | |
required: true | |
type: boolean | |
jobs: | |
generate-matrix: | |
runs-on: ubuntu-24.04 | |
timeout-minutes: 1 | |
outputs: | |
matrix: ${{ steps.set-matrix.outputs.matrix }} | |
steps: | |
- name: Checkout Repo ⚡️ | |
uses: actions/checkout@v4 | |
- name: Calculate recipes matrix 🛠 | |
id: set-matrix | |
run: docs/using/recipe_code/generate_matrix.py >> "${GITHUB_OUTPUT}" | |
env: | |
REPOSITORY_OWNER: ${{ github.repository_owner }} | |
test-recipes: | |
runs-on: ${{ matrix.runs-on }} | |
timeout-minutes: 5 | |
needs: generate-matrix | |
if: github.repository_owner == 'jupyter' || github.repository_owner == 'mathbunnyru' | |
steps: | |
- name: Checkout Repo ⚡️ | |
uses: actions/checkout@v4 | |
- name: Load image to Docker 📥 | |
if: ${{ inputs.called-using-workflow-call && matrix.parent-image != '' }} | |
uses: ./.github/actions/load-image | |
with: | |
image: ${{ matrix.parent-image }} | |
platform: ${{ matrix.platform }} | |
variant: default | |
# Not pulling the image, because it might be loaded from previous step or will be downloaded automatically | |
- name: Build recipe 🛠 | |
run: docker build --rm --force-rm --tag my-custom-image -f ./${{ matrix.dockerfile }} ./ | |
env: | |
DOCKER_BUILDKIT: 1 | |
# Full logs for CI build | |
BUILDKIT_PROGRESS: plain | |
working-directory: docs/using/recipe_code | |
shell: bash | |
strategy: | |
matrix: ${{ fromJson(needs.generate-matrix.outputs.matrix) }} |