Skip to content

refactor into reusable workflows #1

refactor into reusable workflows

refactor into reusable workflows #1

Workflow file for this run

name: Bundle

Check failure on line 1 in .github/workflows/bundle.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/bundle.yml

Invalid workflow file

`test-tree-shaking-pull-request` is not a valid event name
on:
workflow_call:
inputs:
bundler: {type: string, required: true}
target: {type: string, required: true}
module: {type: string, required: true}
test-tree-shaking-pull-request:
needs:
- build-and-test-pull-request
name: ${{ inputs.bundler }} ${{ inputs.target }} ${{ inputs.module }}
runs-on: ubuntu-22.04
steps:
- name: Setup node v20.x
uses: actions/setup-node@v4
with:
node-version: 20.x
- name: Checkout
uses: actions/checkout@v4
with:
persist-credentials: false
- name: Construct cache keys
run: |
echo node_modules_key='["${{ runner.os }}", "node_modules", "20.x", "${{ hashFiles('package.json', 'yarn.lock') }}"]' >> $GITHUB_ENV;
echo targets_key='["${{ runner.os }}", "targets", "20.x", "${{ inputs.target }}", "${{ inputs.module }}", "${{ hashFiles('package.json', 'yarn.lock', 'tsconfig.json', 'src/**/*', 'tsconfigs/**/*') }}"]' >> $GITHUB_ENV;
- name: Cache targets
uses: actions/cache@v4
with:
key: ${{ join(fromJSON(env.targets_key), '-') }}
path: targets
- name: Cache node_modules
uses: actions/cache@v4
with:
key: ${{ join(fromJSON(env.node_modules_key), '-') }}
path: node_modules
- name: Test ${{ inputs.bundler }} tree-shaking
env:
t: "${{ inputs.target }}"
m: "${{ inputs.module }}"
run: |
integration/make-files-to-bundle.sh
if test "${t}" != ix; then
yarn build ${t:+-t ${t}} ${m:+-m ${m}}
fi
yarn gulp bundle${t:+:${t}}${m:+:${m}}:${{ inputs.bundler }}