From 3a18da49f3d7e793476c6ffee83e1b99e19d2a87 Mon Sep 17 00:00:00 2001 From: Laurent Cozic Date: Mon, 17 Jan 2022 14:09:02 +0000 Subject: [PATCH] Tools: Fix Windows build and improve CI error handling --- .github/workflows/github-actions-main.yml | 16 +++++++++++++--- packages/app-desktop/tools/compileScripts.js | 5 ++++- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/.github/workflows/github-actions-main.yml b/.github/workflows/github-actions-main.yml index e9dac9352..3334366f4 100644 --- a/.github/workflows/github-actions-main.yml +++ b/.github/workflows/github-actions-main.yml @@ -86,10 +86,20 @@ jobs: GH_TOKEN: ${{ secrets.GH_TOKEN }} IS_CONTINUOUS_INTEGRATION: 1 BUILD_SEQUENCIAL: 1 + # To ensure that the operations stop on failure, all commands + # should be on one line with "&&" in between. run: | - yarn install - cd packages/app-desktop - yarn run dist + yarn install && cd packages/app-desktop && yarn run dist + + # Build and package the Windows app, without publishing it, just to + # verify that the build process hasn't been broken. + - name: Build Windows app (no publishing) + if: runner.os == 'Windows' && !startsWith(github.ref, 'refs/tags/v') + env: + IS_CONTINUOUS_INTEGRATION: 1 + BUILD_SEQUENCIAL: 1 + run: | + yarn install && cd packages/app-desktop && yarn run dist --publish=never ServerDockerImage: runs-on: ${{ matrix.os }} diff --git a/packages/app-desktop/tools/compileScripts.js b/packages/app-desktop/tools/compileScripts.js index fc19e5a6b..080b129e8 100644 --- a/packages/app-desktop/tools/compileScripts.js +++ b/packages/app-desktop/tools/compileScripts.js @@ -30,7 +30,10 @@ function convertJsx(path) { if (fileIsNewerThan(jsxPath, jsPath)) { console.info(`Compiling ${jsxPath}...`); - const result = spawnSync('yarn', ['run', 'babel', '--presets', 'react', '--out-file', jsPath, jsxPath]); + + // { shell: true } is needed to get it working on Windows: + // https://discourse.joplinapp.org/t/attempting-to-build-on-windows/22559/12 + const result = spawnSync('yarn', ['run', 'babel', '--presets', 'react', '--out-file', jsPath, jsxPath], { shell: true }); if (result.status !== 0) { const msg = []; if (result.stdout) msg.push(result.stdout.toString());