Rebuild with latest dependencies (#106) #545
This file contains hidden or 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: Sample CI | |
| on: [push, pull_request] | |
| permissions: | |
| contents: read | |
| jobs: | |
| check-changes: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| functions-changed: ${{ steps.changes.outputs.functions }} | |
| ui-changed: ${{ steps.changes.outputs.ui }} | |
| steps: | |
| - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 | |
| with: | |
| fetch-depth: 0 | |
| - name: Check for path changes | |
| id: changes | |
| run: | | |
| if [ "${{ github.event_name }}" == "pull_request" ]; then | |
| # For PRs, compare PR head against base | |
| git fetch origin ${{ github.event.pull_request.base.ref }} | |
| CHANGED_FILES=$(git diff --name-only origin/${{ github.event.pull_request.base.ref }}...HEAD) | |
| else | |
| # For push events, compare against default branch | |
| CHANGED_FILES=$(git diff --name-only origin/${{ github.event.repository.default_branch }}...HEAD) | |
| fi | |
| if echo "$CHANGED_FILES" | grep -q '^functions/'; then | |
| echo "functions=true" >> $GITHUB_OUTPUT | |
| else | |
| echo "functions=false" >> $GITHUB_OUTPUT | |
| fi | |
| if echo "$CHANGED_FILES" | grep -q '^ui/'; then | |
| echo "ui=true" >> $GITHUB_OUTPUT | |
| else | |
| echo "ui=false" >> $GITHUB_OUTPUT | |
| fi | |
| test-functions: | |
| needs: check-changes | |
| if: needs.check-changes.outputs.functions-changed == 'true' | |
| strategy: | |
| matrix: | |
| function: | |
| - functions/csv-import | |
| - functions/log-event | |
| - functions/process-events | |
| name: Test Function - ${{ matrix.function }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 | |
| - name: Setup Python | |
| uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0 | |
| with: | |
| python-version: '3.13' | |
| cache: 'pip' | |
| - name: Install Python dependencies | |
| run: pip install -r requirements.txt | |
| working-directory: ${{ matrix.function }} | |
| - name: Run tests if test_main.py exists | |
| run: | | |
| if [ -f "test_main.py" ]; then | |
| echo "Running tests with test_main.py" | |
| pytest | |
| else | |
| echo "No test_main.py found, skipping tests" | |
| fi | |
| working-directory: ${{ matrix.function }} | |
| test-ui: | |
| needs: check-changes | |
| if: needs.check-changes.outputs.ui-changed == 'true' | |
| name: Build and Test UI | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 | |
| - name: Setup Node | |
| uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0 | |
| with: | |
| node-version: 24 | |
| - name: Install dependencies | |
| run: npm ci | |
| working-directory: ui/extensions/user-preferences | |
| - name: Build React app | |
| run: npm run build | |
| working-directory: ui/extensions/user-preferences | |
| - name: Test React app | |
| run: npm run test:ci | |
| working-directory: ui/extensions/user-preferences |