bundlers.yml 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. name: Test different bundlers with Uppy
  2. on:
  3. push:
  4. branches: [ main ]
  5. pull_request:
  6. # We want all branches so we configure types to be the GH default again
  7. types: [ opened, synchronize, reopened ]
  8. paths-ignore:
  9. - '**.md'
  10. - '**.d.ts'
  11. - 'examples/**'
  12. - 'private/**'
  13. - 'website/**'
  14. - '.github/**'
  15. - '!.github/workflows/bundlers.yml'
  16. jobs:
  17. isolate_uppy:
  18. name: Isolate Uppy package
  19. runs-on: ubuntu-latest
  20. steps:
  21. - name: Checkout sources
  22. uses: actions/checkout@v3
  23. - name: Eject Uppy package from repo
  24. run: corepack yarn workspace uppy pack --install-if-needed -o /tmp/uppy-${{ github.sha }}.tar.gz
  25. - name: Upload artifact
  26. if: success()
  27. uses: actions/upload-artifact@v3
  28. with:
  29. name: uppy-${{ github.sha }}.tar.gz
  30. path: /tmp/uppy-${{ github.sha }}.tar.gz
  31. rollup:
  32. needs: isolate_uppy
  33. name: Rollup
  34. runs-on: ubuntu-latest
  35. strategy:
  36. matrix:
  37. rollup-version: [latest]
  38. steps:
  39. - name: Download uppy tarball
  40. uses: actions/download-artifact@v3
  41. with:
  42. name: uppy-${{ github.sha }}.tar.gz
  43. - name: Extract tarball
  44. run: tar -xzf uppy-${{ github.sha }}.tar.gz --strip-components 1
  45. - name: Add Rollup as a dev dependency
  46. run: >-
  47. npm i --save-dev
  48. @rollup/plugin-commonjs @rollup/plugin-node-resolve
  49. rollup@${{matrix.rollup-version}}
  50. - name: Create Rollup config file
  51. run: >-
  52. echo '
  53. import cjs from "@rollup/plugin-commonjs";
  54. import { nodeResolve } from "@rollup/plugin-node-resolve";
  55. export default {
  56. input: "./index.mjs",
  57. output: {
  58. file: "/dev/null",
  59. },
  60. plugins: [
  61. cjs(),
  62. nodeResolve({ browser: true, exportConditions: ["browser"] }),
  63. ],
  64. };' > rollup.config.mjs
  65. - name: Bundle
  66. run: npx rollup -c
  67. webpack:
  68. needs: isolate_uppy
  69. name: Webpack
  70. runs-on: ubuntu-latest
  71. strategy:
  72. matrix:
  73. webpack-version: [latest]
  74. steps:
  75. - name: Download uppy tarball
  76. uses: actions/download-artifact@v3
  77. with:
  78. name: uppy-${{ github.sha }}.tar.gz
  79. - name: Extract tarball
  80. run: tar -xzf uppy-${{ github.sha }}.tar.gz --strip-components 1
  81. - name: Add Webpack as a dev dependency
  82. run: npm i --save-dev webpack-cli webpack@${{matrix.webpack-version}}
  83. - name: Create Webpack config file
  84. run: echo 'module.exports={mode:"production",target:"web",entry:"./index.mjs"}' > webpack.config.js
  85. - name: Bundle
  86. run: npx webpack
  87. # ESBuild: We are already testing it when generating the actual bundle.
  88. # Browserify: doesn't support ESM.
  89. # Parcel: We are already testing it with our e2e tests.