Skip to content

[cookbook] Make container universal (#86) #274

[cookbook] Make container universal (#86)

[cookbook] Make container universal (#86) #274

Workflow file for this run

name: CI
on:
workflow_dispatch:
push:
branches:
- main
paths-ignore:
- '**/*.md'
- '**/*.png'
- '**/*.jpg'
- '**/*.jpeg'
- '**/*.gif'
- 'LICENSE'
pull_request:
branches:
- main
paths-ignore:
- '**/*.md'
- '**/*.png'
- '**/*.jpg'
- '**/*.jpeg'
- '**/*.gif'
- 'LICENSE'
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
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
with:
fetch-depth: 0
- uses: prefix-dev/setup-pixi@v0.8.8
with:
pixi-version: v0.47.0
cache: false
post-cleanup: false
- name: Run Metadata Validation
shell: bash
run: |
pixi run lint
- name: Get changed directories
id: changed-dirs
run: |
# Fix Git security issue with repository ownership
git config --global --add safe.directory $(pwd)
# Debug: show current directory and git status
echo "Current directory: $(pwd)"
echo "Git status check:"
git status --porcelain || echo "Git status failed"
# Get changed directories based on event type
if [ "${{ github.event_name }}" = "pull_request" ]; then
echo "Processing pull request event"
# For PR, use origin/main as base
CHANGED_DIRS=$(git diff --name-only origin/main..HEAD | grep -v '^\.github/' | cut -d'/' -f1 | sort -u | tr '\n' ' ')
else
echo "Processing push event"
# For push, use the before commit if available, otherwise use HEAD~1
if [ -n "${{ github.event.before }}" ] && git cat-file -e "${{ github.event.before }}" 2>/dev/null; then
CHANGED_DIRS=$(git diff --name-only ${{ github.event.before }} ${{ github.sha }} | grep -v '^\.github/' | cut -d'/' -f1 | sort -u | tr '\n' ' ')
else
CHANGED_DIRS=$(git diff --name-only HEAD~1..HEAD | grep -v '^\.github/' | cut -d'/' -f1 | sort -u | tr '\n' ' ')
fi
fi
echo "Changed directories: $CHANGED_DIRS"
echo "dirs=$CHANGED_DIRS" >> $GITHUB_OUTPUT
- name: Run tests for changed directories
if: steps.changed-dirs.outputs.dirs != ''
run: |
echo "Running tests for directories: ${{ steps.changed-dirs.outputs.dirs }}"
pixi run -e default python scripts/run_tests.py ${{ steps.changed-dirs.outputs.dirs }}