Skip to content
CI/CD Inventory

galaxyproject/galaxy-visualizations (opens in new tab)

1 workflow

Triggers

pull_request

Jobs

Jobs for Test Visualizations
Job Runs on Steps Actions used
discover ubuntu-latest 2
actions/checkout@v6
test ubuntu-latest 8
actions/checkout@v6 actions/setup-node@v6 actions/cache@v5 actions/setup-python@v6
test-playwright ubuntu-latest 14
actions/checkout@v6 actions/setup-node@v6 actions/cache@v5 actions/setup-python@v6 actions/cache@v5 actions/upload-artifact@v4 actions/upload-artifact@v4
Raw YAML
name: Test Visualizations

on:
  pull_request:

concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true

jobs:
  discover:
    runs-on: ubuntu-latest
    outputs:
      packages: ${{ steps.set-packages.outputs.packages }}
      playwright_packages: ${{ steps.set-packages.outputs.playwright_packages }}
    steps:
      - uses: actions/checkout@v6
      
      - name: Discover packages with tests
        id: set-packages
        run: |
          echo "Scanning packages for test scripts..."

          regular_packages=()
          playwright_packages=()
          no_test_script=()
          for dir in packages/*/; do
            pkg=$(basename "$dir")
            if [ -f "$dir/package.json" ]; then
              test_script=$(jq -r ".scripts.test // \"\"" "$dir/package.json")
              if [ -n "$test_script" ]; then
                # Check for Playwright in test script or dependencies
                if [[ "$test_script" == *"playwright"* ]] || \
                   jq -e '.devDependencies | has("@playwright/test") or has("playwright")' "$dir/package.json" > /dev/null 2>&1; then
                  playwright_packages+=("$pkg")
                else
                  regular_packages+=("$pkg")
                fi
              else
                no_test_script+=("$pkg")
              fi
            fi
          done
          packages=$(printf '%s\n' "${regular_packages[@]}" | jq -R -s -c 'split("\n") | map(select(length > 0))')
          echo "packages=$packages" >> $GITHUB_OUTPUT
          
          playwright_packages_json=$(printf '%s\n' "${playwright_packages[@]}" | jq -R -s -c 'split("\n") | map(select(length > 0))')
          echo "playwright_packages=$playwright_packages_json" >> $GITHUB_OUTPUT
          
          echo ""
          echo "✅ Regular packages with test script (${#regular_packages[@]}):"
          printf '  - %s\n' "${regular_packages[@]}"
          echo ""
          echo "✅ Playwright packages with test script (${#playwright_packages[@]}):"
          printf '  - %s\n' "${playwright_packages[@]}"
          echo ""
          echo "❌ Packages without test script (${#no_test_script[@]}):"
          printf '  - %s\n' "${no_test_script[@]}"

  test:
    needs: discover
    if: needs.discover.outputs.packages != '[]'
    runs-on: ubuntu-latest
    strategy:
      fail-fast: false
      matrix:
        package: ${{ fromJson(needs.discover.outputs.packages) }}
    
    steps:
      - uses: actions/checkout@v6

      - name: Setup Node.js
        uses: actions/setup-node@v6
        with:
          node-version: 20

      - name: Cache dependencies
        uses: actions/cache@v5
        with:
          path: packages/${{ matrix.package }}/node_modules
          key: ${{ runner.os }}-node-${{ matrix.package }}-${{ hashFiles(format('packages/{0}/package-lock.json', matrix.package)) }}
          restore-keys: |
            ${{ runner.os }}-node-${{ matrix.package }}-

      - name: Check for requirements.txt
        id: check-python
        working-directory: packages/${{ matrix.package }}
        run: |
          if [ -f requirements.txt ]; then
            echo "has_requirements=true" >> $GITHUB_OUTPUT
          else
            echo "has_requirements=false" >> $GITHUB_OUTPUT
          fi

      - name: Setup Python
        if: steps.check-python.outputs.has_requirements == 'true'
        uses: actions/setup-python@v6
        with:
          python-version: '3.13'
          cache: pip
          cache-dependency-path: packages/${{ matrix.package }}/requirements.txt

      - name: Install Python dependencies
        if: steps.check-python.outputs.has_requirements == 'true'
        working-directory: packages/${{ matrix.package }}
        run: pip install -r requirements.txt

      - name: Install Node dependencies
        working-directory: packages/${{ matrix.package }}
        run: npm install

      - name: Run tests
        working-directory: packages/${{ matrix.package }}
        run: npm test

  test-playwright:
    needs: discover
    if: needs.discover.outputs.playwright_packages != '[]'
    runs-on: ubuntu-latest
    strategy:
      fail-fast: false
      matrix:
        package: ${{ fromJson(needs.discover.outputs.playwright_packages) }}
    
    steps:
      - uses: actions/checkout@v6

      - name: Setup Node.js
        uses: actions/setup-node@v6
        with:
          node-version: 20

      - name: Cache Node dependencies
        uses: actions/cache@v5
        with:
          path: packages/${{ matrix.package }}/node_modules
          key: ${{ runner.os }}-node-${{ matrix.package }}-${{ hashFiles(format('packages/{0}/package-lock.json', matrix.package)) }}
          restore-keys: |
            ${{ runner.os }}-node-${{ matrix.package }}-

      - name: Check for requirements.txt
        id: check-python
        working-directory: packages/${{ matrix.package }}
        run: |
          if [ -f requirements.txt ]; then
            echo "has_requirements=true" >> $GITHUB_OUTPUT
          else
            echo "has_requirements=false" >> $GITHUB_OUTPUT
          fi

      - name: Setup Python
        if: steps.check-python.outputs.has_requirements == 'true'
        uses: actions/setup-python@v6
        with:
          python-version: '3.13'
          cache: pip
          cache-dependency-path: packages/${{ matrix.package }}/requirements.txt

      - name: Install Python dependencies
        if: steps.check-python.outputs.has_requirements == 'true'
        working-directory: packages/${{ matrix.package }}
        run: pip install -r requirements.txt

      - name: Install Node dependencies
        working-directory: packages/${{ matrix.package }}
        run: npm install

      - name: Resolve Playwright version
        id: pw
        working-directory: packages/${{ matrix.package }}
        run: |
          set -eo pipefail
          v=$(npx --no-install playwright --version | awk '{print $2}')
          echo "Playwright version: $v"
          echo "version=$v" >> "$GITHUB_OUTPUT"

      - name: Cache Playwright browsers
        uses: actions/cache@v5
        with:
          path: ~/.cache/ms-playwright
          key: ${{ runner.os }}-playwright-${{ steps.pw.outputs.version }}
          restore-keys: |
            ${{ runner.os }}-playwright-

      - name: Install Playwright browsers
        working-directory: packages/${{ matrix.package }}
        run: npx playwright install --with-deps chromium

      - name: Build
        working-directory: packages/${{ matrix.package }}
        run: npm run build

      - name: Run Playwright Tests
        working-directory: packages/${{ matrix.package }}
        run: npm test

      - name: Upload Playwright Report
        if: failure()
        uses: actions/upload-artifact@v4
        with:
          name: playwright-report-${{ matrix.package }}
          path: packages/${{ matrix.package }}/playwright-report/
          retention-days: 7

      - name: Upload Test Results
        if: failure()
        uses: actions/upload-artifact@v4
        with:
          name: playwright-test-results-${{ matrix.package }}
          path: packages/${{ matrix.package }}/test-results/
          retention-days: 7

Last fetched: