Add recipe: an introduction to custom ops #33
Workflow file for this run
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: CI | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
paths-ignore: | |
- '**/*.md' | |
- '**/*.png' | |
- '**/*.jpg' | |
- '**/*.jpeg' | |
- '**/*.gif' | |
- 'LICENSE' | |
- 'CODE_OF_CONDUCT.md' | |
pull_request: | |
branches: | |
- main | |
paths-ignore: | |
- '**/*.md' | |
- '**/*.png' | |
- '**/*.jpg' | |
- '**/*.jpeg' | |
- '**/*.gif' | |
- 'LICENSE' | |
- 'CODE_OF_CONDUCT.md' | |
jobs: | |
validate-and-test: | |
name: Validate and Test | |
runs-on: ubuntu-latest | |
container: | |
image: amd64/ubuntu:latest | |
steps: | |
- name: Install prerequisites | |
run: | | |
apt-get update | |
apt-get install -y curl git | |
- name: Install Magic CLI | |
shell: bash | |
run: | | |
curl -ssL https://magic.modular.com/ | bash | |
. /root/.bashrc | |
echo "/root/.modular/bin" >> $GITHUB_PATH | |
export PATH="/root/.modular/bin:$PATH" | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Run Metadata Validation | |
shell: bash | |
run: | | |
source /root/.bashrc | |
$HOME/.modular/bin/magic run lint | |
- name: Get changed directories | |
id: changed-dirs | |
run: | | |
if [ "${{ github.event_name }}" == "pull_request" ]; then | |
CHANGED_DIRS=$(git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.sha }} | grep -v '^\.github/' | cut -d'/' -f1 | sort -u | tr '\n' ' ') | |
else | |
CHANGED_DIRS=$(git diff --name-only ${{ github.event.before }} ${{ github.sha }} | grep -v '^\.github/' | cut -d'/' -f1 | sort -u | tr '\n' ' ') | |
fi | |
echo "Changed directories: $CHANGED_DIRS" | |
echo "dirs=$CHANGED_DIRS" >> $GITHUB_OUTPUT | |
- name: Run Tests | |
if: steps.changed-dirs.outputs.dirs != '' | |
shell: bash | |
run: | | |
source /root/.bashrc | |
$HOME/.modular/bin/magic run test ${{ steps.changed-dirs.outputs.dirs }} |