-
Notifications
You must be signed in to change notification settings - Fork 175
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into advay/add-bazel-cpp
- Loading branch information
Showing
20 changed files
with
881 additions
and
326 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
name: setup | ||
|
||
description: Set up a Python environment for the examples. | ||
|
||
inputs: | ||
version: | ||
description: Which Python version to install | ||
required: false | ||
default: "3.11" | ||
devDependencies: | ||
description: Whether to skip dependencies | ||
required: false | ||
default: "no-skip" | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- name: Install Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ inputs.version }} | ||
|
||
- name: Install base packages | ||
shell: bash | ||
run: | | ||
pip install uv | ||
uv pip install --system setuptools wheel | ||
- name: Install development Python packages | ||
if: ${{ inputs.devDependencies != 'skip' }} | ||
shell: bash | ||
run: uv pip install --system -r internal/requirements.txt | ||
|
||
- name: Install the modal client | ||
shell: bash | ||
run: uv pip install --system modal |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
name: Run | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
paths: | ||
- "**.py" | ||
push: | ||
branches: | ||
- main | ||
paths: | ||
- "**.py" | ||
workflow_dispatch: | ||
|
||
# Cancel previous runs of the same PR but do not cancel previous runs on main | ||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} | ||
|
||
env: | ||
TERM: linux | ||
TERMINFO: /etc/terminfo | ||
MODAL_TOKEN_ID: ${{ secrets.MODAL_MODAL_LABS_TOKEN_ID }} | ||
MODAL_TOKEN_SECRET: ${{ secrets.MODAL_MODAL_LABS_TOKEN_SECRET }} | ||
MODAL_ENVIRONMENT: main | ||
|
||
jobs: | ||
# Output all changed files in a JSON format compatible with GitHub Actions job matrices | ||
diff-matrix: | ||
name: Generate matrix of changed examples | ||
runs-on: ubuntu-20.04 | ||
outputs: | ||
matrix: ${{ steps.diff.outputs.all_changed_files }} | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Find changed examples | ||
id: diff | ||
uses: tj-actions/changed-files@v44 | ||
with: | ||
files: "**.py" | ||
files_ignore: "internal/**,misc/**" | ||
matrix: true | ||
|
||
- name: List all changed examples | ||
run: echo '${{ steps.diff.outputs.all_changed_files }}' | ||
|
||
# Run each changed example, using the output of the previous step as a job matrix | ||
run-changed: | ||
name: Run changed example | ||
needs: [diff-matrix] | ||
if: | ||
${{ needs.diff-matrix.outputs.matrix != '[]' && | ||
needs.diff-matrix.outputs.matrix != '' }} | ||
runs-on: ubuntu-20.04 | ||
strategy: | ||
matrix: | ||
file: ${{ fromJson(needs.diff-matrix.outputs.matrix) }} | ||
fail-fast: false | ||
|
||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 1 | ||
- uses: ./.github/actions/setup | ||
|
||
- name: Run example | ||
run: | | ||
echo "Running ${{ matrix.file }}" | ||
stem=$(basename "${{ matrix.file }}" .py) | ||
python3 -m internal.run_example $stem || exit $? |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,6 @@ | |
|
||
venv | ||
.venv | ||
|
||
# secrets file for act, tool for local GitHub Actions testing | ||
.secrets |
Oops, something went wrong.