Simplify our building packages tool (drop Rollup for tsdown) #500
Workflow file for this run
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: App Tests | |
| on: | |
| push: | |
| paths-ignore: | |
| - 'src/*/doc/**' | |
| - 'src/**/*.md' | |
| - 'ux.symfony.com/**' | |
| pull_request: | |
| paths-ignore: | |
| - 'src/*/doc/**' | |
| - 'src/**/*.md' | |
| - 'ux.symfony.com/**' | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | |
| cancel-in-progress: true | |
| jobs: | |
| encore-app: | |
| name: "Encore (${{ matrix.name}})" | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - name: Internal, from "vendor/" | |
| ux-packages-source: php-vendor | |
| - name: External, from "npm add" | |
| ux-packages-source: js-packages | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - run: npm i -g corepack && corepack enable | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version-file: '.nvmrc' | |
| cache: 'pnpm' | |
| cache-dependency-path: | | |
| package.json | |
| src/**/package.json | |
| test_apps/encore-app/pnpm-lock.yaml | |
| test_apps/encore-app/package.json | |
| - uses: shivammathur/setup-php@v2 | |
| - name: Install root dependencies | |
| uses: ramsey/composer-install@v3 | |
| with: | |
| working-directory: ${{ github.workspace }} | |
| - name: Build root packages | |
| run: php .github/build-packages.php | |
| # We always install PHP deps because of the UX Translator, which requires `var/translations` to exists | |
| - name: Install PHP dependencies | |
| uses: ramsey/composer-install@v3 | |
| with: | |
| working-directory: test_apps/encore-app | |
| dependency-versions: highest | |
| - working-directory: test_apps/encore-app | |
| run: pnpm install --ignore-workspace | |
| - if: matrix.ux-packages-source == 'js-packages' | |
| name: Install UX JS packages with a JS package manager | |
| working-directory: test_apps/encore-app | |
| run: | | |
| PACKAGES_TO_INSTALL='' | |
| for PACKAGE in $(cd ../..; pnpm ls -r --json --depth -1 | jq 'map(select(.private != true))' | jq -c '.[]'); do | |
| PACKAGE_ABSOLUTE_PATH=$(echo $PACKAGE | jq -r '.path') | |
| PACKAGE_RELATIVE_PATH=$(realpath --relative-to=. "$PACKAGE_ABSOLUTE_PATH") | |
| PACKAGES_TO_INSTALL="$PACKAGES_TO_INSTALL file:$PACKAGE_RELATIVE_PATH" | |
| done | |
| echo "Installing packages: $PACKAGES_TO_INSTALL" | |
| pnpm add --save-dev $PACKAGES_TO_INSTALL | |
| - name: Ensure UX packages are installed from "${{ env.EXPECTED_PATTERN }}" | |
| working-directory: test_apps/encore-app | |
| run: | | |
| for PACKAGE in $(cat package.json | jq -c '(.dependencies // {}) + (.devDependencies // {}) | to_entries[] | select(.key | startswith("@symfony/ux-")) | {name: .key, version: .value}'); do | |
| PACKAGE_NAME=$(echo $PACKAGE | jq -r '.name') | |
| PACKAGE_VERSION=$(echo $PACKAGE | jq -r '.version') | |
| echo -n "Checking $PACKAGE_NAME@$PACKAGE_VERSION..." | |
| if [[ $PACKAGE_VERSION == $EXPECTED_PATTERN* ]]; then | |
| echo " OK" | |
| else | |
| echo " KO" | |
| echo "The package version of $PACKAGE_NAME must starts with the pattern (e.g.: $EXPECTED_PATTERN), got $PACKAGE_VERSION instead." | |
| exit 1 | |
| fi | |
| done; | |
| env: | |
| EXPECTED_PATTERN: ${{ matrix.ux-packages-source == 'php-vendor' && 'file:vendor/symfony/*' || 'file:../../src/*' }} | |
| - name: Ensure project can be built in dev mode | |
| working-directory: test_apps/encore-app | |
| run: pnpm run dev | |
| - name: Ensure project can be built in prod mode | |
| working-directory: test_apps/encore-app | |
| run: pnpm run build |