From d1e41c84d6785884d7473d1488717e198805d017 Mon Sep 17 00:00:00 2001 From: RheeseyB <1044774+Rheeseyb@users.noreply.github.com> Date: Wed, 31 Jan 2024 21:20:38 +0000 Subject: [PATCH 01/10] feat(all) Build a docker image via nix --- .gitignore | 1 + docker-build.nix | 30 +++++++++++++++ release.nix | 1 + run-server-production.sh | 4 ++ server/package.yaml | 1 + server/utopia-web.cabal | 2 + shell.nix | 79 ++++++++++++++++++++++++++++++---------- vscode-build/shell.nix | 59 ++++++++++++++++++++++++++++++ 8 files changed, 158 insertions(+), 19 deletions(-) create mode 100644 docker-build.nix create mode 100755 run-server-production.sh create mode 100644 vscode-build/shell.nix diff --git a/.gitignore b/.gitignore index 564f5e2a7d9c..d0a27eba0cbf 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,7 @@ node_modules ## Build generated build/ +dist/ DerivedData editor/build editor/node_modules diff --git a/docker-build.nix b/docker-build.nix new file mode 100644 index 000000000000..54556c05ac30 --- /dev/null +++ b/docker-build.nix @@ -0,0 +1,30 @@ +let + release = (import ./release.nix {}); + pkgs = release.pkgs; + stdenv = pkgs.stdenv; + + haskellImage = pkgs.dockerTools.pullImage { + imageName = "haskell"; + imageDigest = "sha256:2351d1ed56b95add00b8820d1aa7bc1a7f1a277989f7f4de41f01b065fbe5ee8"; + sha256 = "sha256-oH1mbIBAF/dRjB0pOj6tFLTvQihnlPzETijxJNCPwok="; + }; + + dockerBuild = pkgs.dockerTools.buildImage { + name = "hello-docker"; + fromImage = haskellImage; + fromImageTag = "9.0.2"; + copyToRoot = [ + ./dist + ]; + config = { + Env = [ + "APP_ENVIRONMENT=PRODUCTION" + "PROXY_WEBPACK=FALSE" + "WEBPACK_DLL_ENV=webpack-dll-dev" + "UTOPIA_SHA=$UTOPIA_SHA" + ]; + Cmd = [ "run-server-production.sh" ]; + }; + }; + +in dockerBuild \ No newline at end of file diff --git a/release.nix b/release.nix index 6702e688100e..a3d196af7c6b 100644 --- a/release.nix +++ b/release.nix @@ -11,6 +11,7 @@ let # Hash obtained using `nix-prefetch-url --unpack ` sha256 = "11w3wn2yjhaa5pv20gbfbirvjq6i3m7pqrq2msf0g7cv44vijwgw"; }) { inherit config; }; + in { pkgs = pkgs; diff --git a/run-server-production.sh b/run-server-production.sh new file mode 100755 index 000000000000..946fb8106a5c --- /dev/null +++ b/run-server-production.sh @@ -0,0 +1,4 @@ +#!/usr/bin/env sh + +cd /server +./utopia-web +RTS -N -c diff --git a/server/package.yaml b/server/package.yaml index e9ab3f807650..9427a2d0e8f8 100644 --- a/server/package.yaml +++ b/server/package.yaml @@ -49,6 +49,7 @@ dependencies: - filepath - free - generic-lens + - generic-lens-core - github ==0.27 - hashable - hoauth2 diff --git a/server/utopia-web.cabal b/server/utopia-web.cabal index 4ecc7c048d83..2c018ac6913b 100644 --- a/server/utopia-web.cabal +++ b/server/utopia-web.cabal @@ -96,6 +96,7 @@ executable utopia-web , filepath , free , generic-lens + , generic-lens-core , github ==0.27 , hashable , hoauth2 @@ -244,6 +245,7 @@ test-suite utopia-web-test , filepath , free , generic-lens + , generic-lens-core , github ==0.27 , hashable , hedgehog diff --git a/shell.nix b/shell.nix index a79f1b36134e..5ad9b831392e 100644 --- a/shell.nix +++ b/shell.nix @@ -3,7 +3,7 @@ includeServerBuildSupport ? true, includeEditorBuildSupport ? true, includeRunLocallySupport ? true, - includeReleaseSupport ? false, + includeReleaseSupport ? true, includeDatabaseSupport ? true }: @@ -11,7 +11,7 @@ let release = (import ./release.nix {}); pkgs = release.pkgs; lib = pkgs.lib; - node = pkgs.nodejs-16_x; + node = pkgs.nodejs-18_x; postgres = pkgs.postgresql_13; stdenv = pkgs.stdenv; pnpm = node.pkgs.pnpm; @@ -27,6 +27,7 @@ let # Slightly kludgy because the zlib Haskell package is a pain in the face. ghc = pkgs.haskell.packages.${compiler}.ghcWithPackages (hpkgs: with hpkgs; [ zlib + magic ]); baseEditorScripts = [ @@ -215,18 +216,14 @@ let (pkgs.writeScriptBin "update-vscode-build-extension" '' #!/usr/bin/env bash set -e - build-utopia-vscode-extension cd $(${pkgs.git}/bin/git rev-parse --show-toplevel)/vscode-build - yarn - yarn run pull-utopia-extension + nix-shell --run update-vscode-build-extension-inner '') (pkgs.writeScriptBin "build-vscode" '' #!/usr/bin/env bash set -e cd $(${pkgs.git}/bin/git rev-parse --show-toplevel)/vscode-build - rm -rf ./dist ./node_modules - yarn - yarn run build + nix-shell --run build-vscode-inner '') (pkgs.writeScriptBin "build-vscode-with-extension" '' #!/usr/bin/env bash @@ -456,8 +453,7 @@ let #!/usr/bin/env bash set -e cd $(${pkgs.git}/bin/git rev-parse --show-toplevel)/vscode-build - ${yarn}/bin/yarn - ${yarn}/bin/yarn run make-patch + nix-shell --run update-vscode-patch-inner '') (pkgs.writeScriptBin "watch-utopia-vscode-common" '' #!/usr/bin/env bash @@ -477,7 +473,7 @@ let #!/usr/bin/env bash set -e cd $(${pkgs.git}/bin/git rev-parse --show-toplevel)/vscode-build - ${yarn}/bin/yarn run pull-utopia-extension + nix-shell --run pull-extension-inner '') (pkgs.writeScriptBin "watch-vscode-build-extension-only" '' #!/usr/bin/env bash @@ -620,15 +616,21 @@ let withCustomDevScripts = withServerRunScripts ++ (lib.optionals includeRunLocallySupport customDevScripts); - # TODO Come back to these when trying to use nix to build a docker container - https://stackoverflow.com/questions/58421505/how-do-i-apply-a-nix-shell-config-in-a-docker-image releaseScripts = [ - (pkgs.writeScriptBin "build-editor" '' + (pkgs.writeScriptBin "build-editor-production" '' #!/usr/bin/env bash set -e cd $(${pkgs.git}/bin/git rev-parse --show-toplevel)/editor ${pnpm}/bin/pnpm install --unsafe-perm ${pnpm}/bin/pnpm run production '') + (pkgs.writeScriptBin "build-editor-staging" '' + #!/usr/bin/env bash + set -e + cd $(${pkgs.git}/bin/git rev-parse --show-toplevel)/editor + ${pnpm}/bin/pnpm install --unsafe-perm + ${pnpm}/bin/pnpm run staging + '') # CRA for whatever reason will automatically fail on CI for any warnings, so we need to prefix with `CI=false`. Urgh. https://github.com/facebook/create-react-app/issues/3657 (pkgs.writeScriptBin "build-website" '' #!/usr/bin/env bash @@ -640,20 +642,58 @@ let (pkgs.writeScriptBin "build-server" '' #!/usr/bin/env bash set -e + cabal-update + rebuild-cabal cd $(${pkgs.git}/bin/git rev-parse --show-toplevel)/server ${cabal}/bin/cabal new-build utopia-web cp --verbose $(${pkgs.haskellPackages.cabal-plan}/bin/cabal-plan list-bin exe:utopia-web) . '') - (pkgs.writeScriptBin "build-all" '' + (pkgs.writeScriptBin "copy-all-to-dist-folder" '' + #!/usr/bin/env bash + set -e + cd $(${pkgs.git}/bin/git rev-parse --show-toplevel)/ + rm -rf dist + mkdir dist + mkdir dist/server + mkdir dist/server/editor + mkdir dist/server/migrations + mkdir dist/server/public + mkdir dist/server/vscode + cp -r vscode-build/dist/. dist/server/vscode + cp -r website-next/out/. dist/server/public + cp -r editor/resources/editor/. dist/server/editor + cp -r editor/lib/. dist/server/editor + # cp server/utopia-web dist/server + cp -r server/migrations/. dist/server/migrations + cp run-server-production.sh dist/server + '') + (pkgs.writeScriptBin "build-all-staging" '' + #!/usr/bin/env bash + set -e + if [ -z $GITHUB_TOKEN ] + then + echo "A GITHUB_TOKEN is required when running the full Utopia build. Please see the readme for instructions." + exit 1 + else + check-tool-versions + build-vscode-with-extension + install-editor + build-website + build-editor-staging + build-server + copy-all-to-dist-folder + fi + '') + (pkgs.writeScriptBin "build-docker" '' #!/usr/bin/env bash set -e - build-editor - build-website - build-server + docker load < $(nix-build docker-build.nix) '') ]; - scripts = withCustomDevScripts; # ++ (if needsRelease then releaseScripts else []); + withReleaseScripts = withCustomDevScripts ++ (lib.optionals includeReleaseSupport releaseScripts); + + scripts = withReleaseScripts; linuxOnlyPackages = lib.optionals stdenv.isLinux [ pkgs.xvfb_run pkgs.xlibsWrapper pkgs.xorg.libxkbfile ]; macOSOnlyPackages = lib.optionals stdenv.isDarwin (with pkgs.darwin.apple_sdk.frameworks; [ @@ -675,11 +715,12 @@ let releasePackages = [ pkgs.heroku + pkgs.docker ]; pythonAndPackages = pkgs.python3.withPackages(ps: with ps; [ pyusb tkinter pkgconfig ]); - basePackages = [ node pkgs.libsecret pythonAndPackages pkgs.pkg-config pkgs.tmux pkgs.git pkgs.wget ] ++ nodePackages ++ linuxOnlyPackages ++ macOSOnlyPackages; + basePackages = [ pkgs.docker node pkgs.libsecret pythonAndPackages pkgs.pkg-config pkgs.tmux pkgs.git pkgs.wget ] ++ nodePackages ++ linuxOnlyPackages ++ macOSOnlyPackages; withServerBasePackages = basePackages ++ (lib.optionals includeServerBuildSupport baseServerPackages); withServerRunPackages = withServerBasePackages ++ (lib.optionals includeRunLocallySupport serverRunPackages); withReleasePackages = withServerRunPackages ++ (lib.optionals includeReleaseSupport releasePackages); diff --git a/vscode-build/shell.nix b/vscode-build/shell.nix new file mode 100644 index 000000000000..30aa953c0e08 --- /dev/null +++ b/vscode-build/shell.nix @@ -0,0 +1,59 @@ +let + release = (import ../release.nix {}); + pkgs = release.pkgs; + node = pkgs.nodejs-16_x; + stdenv = pkgs.stdenv; + pnpm = node.pkgs.pnpm; + yarn = pkgs.yarn; + + nodePackages = [ + node + pnpm + (yarn.override { nodejs = node; }) + ]; + + scripts = [ + (pkgs.writeScriptBin "update-vscode-patch-inner" '' + #!/usr/bin/env bash + set -e + cd $(${pkgs.git}/bin/git rev-parse --show-toplevel)/vscode-build + ${yarn}/bin/yarn + ${yarn}/bin/yarn run make-patch + '') + (pkgs.writeScriptBin "pull-extension-inner" '' + #!/usr/bin/env bash + set -e + cd $(${pkgs.git}/bin/git rev-parse --show-toplevel)/vscode-build + ${yarn}/bin/yarn run pull-utopia-extension + '') + (pkgs.writeScriptBin "update-vscode-build-extension-inner" '' + #!/usr/bin/env bash + set -e + build-utopia-vscode-extension + cd $(${pkgs.git}/bin/git rev-parse --show-toplevel)/vscode-build + yarn + yarn run pull-utopia-extension + '') + (pkgs.writeScriptBin "build-vscode-inner" '' + #!/usr/bin/env bash + set -e + cd $(${pkgs.git}/bin/git rev-parse --show-toplevel)/vscode-build + rm -rf ./dist ./node_modules + yarn + yarn run build + '') + ]; + +in pkgs.mkShell { + buildInputs = [ + (pkgs.stdenv.mkDerivation { + name = "scripts"; + phases = "installPhase"; + installPhase = '' + mkdir -p $out/bin + '' + (builtins.concatStringsSep "" (builtins.map (script: '' + for f in $(ls -d ${script}/bin/*); do ln -s $f $out/bin; done + '') scripts)); + }) + ] ++ nodePackages; +} From 91bb7930644841003ec086f08c7b29554923df04 Mon Sep 17 00:00:00 2001 From: RheeseyB <1044774+Rheeseyb@users.noreply.github.com> Date: Thu, 1 Feb 2024 10:37:16 +0000 Subject: [PATCH 02/10] chore(workflows) Trying to build all on CI --- .github/workflows/pull-requests.yml | 465 +--------------------------- 1 file changed, 5 insertions(+), 460 deletions(-) diff --git a/.github/workflows/pull-requests.yml b/.github/workflows/pull-requests.yml index 9c636ba10acc..3b2e63cbb8bf 100644 --- a/.github/workflows/pull-requests.yml +++ b/.github/workflows/pull-requests.yml @@ -7,9 +7,9 @@ jobs: secrets: inherit uses: ./.github/workflows/cache-pnpm-install.yml - test-editor-code: - name: Test Editor PR – TypeScript, ESLint, dependency-cruiser - timeout-minutes: 15 + build-everything: + name: Build Everything + timeout-minutes: 60 runs-on: ubuntu-latest needs: [cache-pnpm-store] env: @@ -21,464 +21,9 @@ jobs: githubToken: ${{ secrets.GITHUB_TOKEN }} - name: Check out the repo uses: actions/checkout@v2 - - name: Cache editor test result - id: cache-editor-tests - uses: actions/cache@v2 - with: - # For the tests it doesn't really matter what we cache - path: editor/lib - key: ${{ runner.os }}-editor-code-tests-PR-${{ hashFiles('editor/src/**') }}-${{ hashFiles('utopia-api/src/**') }}-${{ hashFiles('editor/package.json') }}-${{ hashFiles('utopia-api/package.json') }} - - name: Cache pnpm store - uses: actions/cache@v2 - with: - path: ${{ needs.cache-pnpm-store.outputs.pnpm-store-path }} - key: ${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}-captured-location - - name: Install nix - uses: cachix/install-nix-action@v12 - with: - nix_path: nixpkgs=https://github.com/NixOS/nixpkgs/archive/6120ac5cd201f6cb593d1b80e861be0342495be9.tar.gz - - name: Capture pnpm store location - run: nix-shell --arg includeServerBuildSupport false --arg includeRunLocallySupport false --run 'echo "pnpm-store-path=$(pnpm store path)" >> "$GITHUB_ENV"' - - name: Run tsc, eslint, depdendency-cruiser and the website tests - if: steps.cache-editor-tests.outputs.cache-hit != 'true' - run: nix-shell --arg includeServerBuildSupport false --arg includeRunLocallySupport false --run check-editor-code-ci - - test-editor-jest: - name: Test Editor PR – Jest tests - timeout-minutes: 15 - runs-on: ubuntu-latest - needs: [cache-pnpm-store] - env: - UTOPIA_SHA: ${{ github.sha }} - steps: - - name: Cancel existing runs on this branch - uses: fauguste/auto-cancellation-running-action@0.1.4 - with: - githubToken: ${{ secrets.GITHUB_TOKEN }} - - name: Check out the repo - uses: actions/checkout@v2 - - name: Cache editor test result - id: cache-editor-tests - uses: actions/cache@v2 - with: - # For the tests it doesn't really matter what we cache - path: editor/lib - key: ${{ runner.os }}-editor-jest-tests-PR-${{ hashFiles('editor/src/**') }}-${{ hashFiles('utopia-api/src/**') }}-${{ hashFiles('editor/package.json') }}-${{ hashFiles('utopia-api/package.json') }} - - name: Cache .pnpm-store - uses: actions/cache@v2 - with: - path: ${{ needs.cache-pnpm-store.outputs.pnpm-store-path }} - key: ${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}-captured-location - - name: Install nix - uses: cachix/install-nix-action@v12 - with: - nix_path: nixpkgs=https://github.com/NixOS/nixpkgs/archive/6120ac5cd201f6cb593d1b80e861be0342495be9.tar.gz - - name: Run the Jest tests - if: steps.cache-editor-tests.outputs.cache-hit != 'true' - run: nix-shell --arg includeServerBuildSupport false --arg includeRunLocallySupport false --run check-editor-jest-ci - - call-test-editor-karma-shard-1: - name: Test Editor Shard 1 - needs: [cache-pnpm-store] - uses: ./.github/workflows/editor-sharded-tests.yml - secrets: inherit - with: - shard_number: 1 - branch: PR - pnpm-store-path: ${{ needs.cache-pnpm-store.outputs.pnpm-store-path }} - - call-test-editor-karma-shard-2: - name: Test Editor Shard 2 - needs: [cache-pnpm-store] - uses: ./.github/workflows/editor-sharded-tests.yml - secrets: inherit - with: - shard_number: 2 - branch: PR - pnpm-store-path: ${{ needs.cache-pnpm-store.outputs.pnpm-store-path }} - - test-server: - name: Test Server - timeout-minutes: 25 - runs-on: ubuntu-latest - env: - UTOPIA_SHA: ${{ github.sha }} - steps: - - name: Check out the repo - uses: actions/checkout@v2 - - name: Cache .cabal/packages - uses: actions/cache@v2 - with: - path: .cabal/packages - key: ${{ runner.os }}-${{ matrix.ghc }}-cabal-packages-2 - - name: Cache .cabal/store - uses: actions/cache@v2 - with: - path: .cabal/store - key: ${{ runner.os }}-${{ matrix.ghc }}-cabal-store-2 - - name: Cache dist-newstyle - uses: actions/cache@v2 - with: - path: server/dist-newstyle - key: ${{ runner.os }}-${{ matrix.ghc }}-server-dist-newstyle-2 - - name: Cache server test result - id: cache-server-tests - uses: actions/cache@v2 - with: - # For the tests it doesn't really matter what we cache - path: server/src - key: ${{ runner.os }}-server-tests-master-${{ hashFiles('server/src/**') }}-${{ hashFiles('server/test/**') }}-${{ hashFiles('server/cabal.project.freeze') }} - name: Install nix uses: cachix/install-nix-action@v12 with: nix_path: nixpkgs=https://github.com/NixOS/nixpkgs/archive/6120ac5cd201f6cb593d1b80e861be0342495be9.tar.gz - - name: Start PostgreSQL - if: steps.cache-server-tests.outputs.cache-hit != 'true' - run: nix-shell --arg includeEditorBuildSupport false --arg includeRunLocallySupport false --arg includeDatabaseSupport true --run start-postgres-background - - name: Run the tests - if: steps.cache-server-tests.outputs.cache-hit != 'true' - run: nix-shell --arg includeEditorBuildSupport false --arg includeRunLocallySupport false --run test-server-ci - - deploy-branch: - name: Deploy Branch Editor - timeout-minutes: 15 - runs-on: ubuntu-latest - needs: [cache-pnpm-store] - env: - UTOPIA_SHA: ${{ github.sha }} - AUTH0_CLIENT_ID: KB7euFO46rVYeOaWmrEdktdhAFxEO266 - AUTH0_ENDPOINT: enter.utopia.app - AUTH0_REDIRECT_URI: https://utopia.fish/authenticate - steps: - # Create a comment immediately so that the first comment can be used as a "Try me" link - - name: Find Comment - uses: peter-evans/find-comment@v1 - id: fc-initial - with: - issue-number: ${{ github.event.pull_request.number }} - comment-author: 'github-actions[bot]' - body-includes: Try me - - name: Create or update comment - uses: peter-evans/create-or-update-comment@v1 - if: ${{ success() || failure() }} - with: - comment-id: ${{ steps.fc-initial.outputs.comment-id }} - issue-number: ${{ github.event.pull_request.number }} - edit-mode: replace - body: | - ## Try me - (building...) - # Gets the branch that this PR is targeting and replaces forward slashes in the name with hyphens. - # So that later steps can produce a bundle incorporating that into the name and upload it. - - name: Extract branch name - shell: bash - run: | - FIXED_REF="${GITHUB_HEAD_REF////-}" - echo "##[set-output name=branch;]$FIXED_REF" - id: extract_branch - - name: Check out the repo - uses: actions/checkout@v2 - - name: Cache .pnpm-store - uses: actions/cache@v2 - with: - path: ${{ needs.cache-pnpm-store.outputs.pnpm-store-path }} - key: ${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}-captured-location - - name: Install nix - uses: cachix/install-nix-action@v12 - with: - nix_path: nixpkgs=https://github.com/NixOS/nixpkgs/archive/6120ac5cd201f6cb593d1b80e861be0342495be9.tar.gz - - name: Build Editor - if: steps.cache-editor-tests.outputs.cache-hit != 'true' - run: | - nix-shell --arg includeServerBuildSupport false --arg includeRunLocallySupport false --run build-editor-staging-ci - - name: Send webpack stats to RelativeCI - uses: relative-ci/agent-action@v1.1.0 - with: - webpackStatsFile: editor/lib/staging-stats.json - key: ${{ secrets.RELATIVE_CI_KEY }} - debug: false - - name: Delete node_modules - working-directory: editor/ - run: | - rm -rf ./node_modules - cd ../utopia-api - rm -rf ./node_modules - cd ../website-next - rm -rf ./node_modules - cd ../utopia-vscode-extension - rm -rf ./node_modules - cd ../utopia-vscode-common - rm -rf ./node_modules - - name: Create Editor Bundle - working-directory: editor/lib/ - run: | - tar -czvf ../${{ steps.extract_branch.outputs.branch }}.tar.gz * - # Update the "Try me" comment with the new status. We have to find it again because it - # might not have existed during the previous search - - name: Find Comment - uses: peter-evans/find-comment@v1 - id: fc - with: - issue-number: ${{ github.event.pull_request.number }} - comment-author: 'github-actions[bot]' - body-includes: Try me - - name: Create or update comment - uses: peter-evans/create-or-update-comment@v1 - if: ${{ success() || failure() }} - with: - comment-id: ${{ steps.fc.outputs.comment-id }} - issue-number: ${{ github.event.pull_request.number }} - edit-mode: replace - body: | - ## Try me - (deploying...) - - name: Upload Editor Bundle - uses: jakejarvis/s3-sync-action@v0.5.1 - with: - args: --acl private --exclude '*' --include 'editor/${{ steps.extract_branch.outputs.branch }}.tar.gz' - env: - AWS_S3_BUCKET: ${{ secrets.STAGING_BUNDLE_S3_BUCKET }} - AWS_ACCESS_KEY_ID: ${{ secrets.STAGING_BUNDLE_ACCESS_KEY }} - AWS_SECRET_ACCESS_KEY: ${{ secrets.STAGING_BUNDLE_SECRET_ACCESS_KEY }} - AWS_REGION: ${{ secrets.STAGING_BUNDLE_REGION }} - - name: Flush Staging Branch Editor Bundle - shell: bash - run: | - curl -s -o /dev/null -w "FLUSH STAGING HTTP RESPONSE CODE: %{http_code}" -X DELETE 'https://${{ secrets.STAGING_SERVER }}/internal/branch?branch_name=${{ steps.extract_branch.outputs.branch }}' - # Update the "Try me" comment with the actual link - - name: Create or update comment - uses: peter-evans/create-or-update-comment@v1 - if: ${{ success() || failure() }} - with: - comment-id: ${{ steps.fc.outputs.comment-id }} - issue-number: ${{ github.event.pull_request.number }} - edit-mode: replace - body: | - ## [Try me](https://${{ secrets.STAGING_SERVER }}/p/?branch_name=${{ steps.extract_branch.outputs.branch }}) - - performance-test: - name: Run Performance Tests - timeout-minutes: 15 - runs-on: self-hosted - needs: [deploy-branch, cache-pnpm-store] - env: - UTOPIA_SHA: ${{ github.sha }} - AUTH0_CLIENT_ID: KB7euFO46rVYeOaWmrEdktdhAFxEO266 - AUTH0_ENDPOINT: enter.utopia.app - AUTH0_REDIRECT_URI: https://utopia.fish/authenticate - steps: - # Gets the branch that this PR is targeting and replaces forward slashes in the name with hyphens. - # So that later steps can produce a bundle incorporating that into the name and upload it. - - name: Extract branch name - shell: bash - run: | - FIXED_REF="${GITHUB_HEAD_REF////-}" - echo "##[set-output name=branch;]$FIXED_REF" - id: extract_branch - - name: Check out the repo - uses: actions/checkout@v2 - - name: Cache .pnpm-store - uses: actions/cache@v2 - with: - path: ${{ needs.cache-pnpm-store.outputs.pnpm-store-path }} - key: ${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}-captured-location - - name: Build Performance Tests - run: | - nix-shell --arg includeServerBuildSupport false --arg includeRunLocallySupport false --run "build-puppeteer-tests" - - name: Run Performance Test - id: run-performance-test - env: - BRANCH_NAME: ${{ steps.extract_branch.outputs.branch }} - AWS_S3_BUCKET: ${{secrets.PERFORMANCE_GRAPHS_BUCKET}} - AWS_ACCESS_KEY_ID: ${{ secrets.PERFORMANCE_GRAPHS_ACCESS_KEY}} - AWS_SECRET_ACCESS_KEY: ${{ secrets.PERFORMANCE_GRAPHS_SECRET_KEY }} - AWS_REGION: ${{ secrets.STAGING_BUNDLE_REGION }} - PERFORMANCE_GRAPHS_PLOTLY_USERNAME: ${{ secrets.PERFORMANCE_GRAPHS_PLOTLY_USERNAME}} - PERFORMANCE_GRAPHS_PLOTLY_API_KEY: ${{secrets.PERFORMANCE_GRAPHS_PLOTLY_API_KEY}} - run: | - nix-shell --arg includeServerBuildSupport false --arg includeRunLocallySupport false --run "xvfb-run --server-args='-screen 0 1920x1080x24 -ac -nolisten tcp -dpi 96 +extension RANDR' run-puppeteer-test" - - name: Find Comment - uses: peter-evans/find-comment@v1 - id: fc - with: - issue-number: ${{ github.event.pull_request.number }} - comment-author: 'github-actions[bot]' - body-includes: Performance test results - - name: Create or update comment - uses: peter-evans/create-or-update-comment@v1 - if: ${{ success() || failure() }} - with: - comment-id: ${{ steps.fc.outputs.comment-id }} - issue-number: ${{ github.event.pull_request.number }} - edit-mode: replace - body: | - Performance test results: - ${{ steps.run-performance-test.outputs.perf-result }} - - name: Build Discord Message - if: ${{ steps.run-performance-test.outputs.perf-serious-regression-found == 'true' }} - env: - TEMPLATE: >- - [ - { - "title": $title, - "url": $html_url, - "color": 2369839, - "description": $description, - "footer": { - "text": $repo_full_name - } - }, - { - "title": "Frame Tests:", - "color": 2369839, - "image": { - "url": $result_frames_chart - } - }, - { - "title": "Interaction Tests:", - "color": 14540253, - "image": { - "url": $result_interactions_chart - } - } - ] - TITLE: 'Performance Results for #${{ github.event.pull_request.number }} ${{ github.event.pull_request.title }}' - HTML_URL: ${{ github.event.pull_request.html_url }} - DESCRIPTION: 'Link to test editor: https://${{ secrets.STAGING_SERVER }}/p/?branch_name=${{ steps.extract_branch.outputs.branch }} \n \n Results: \n ${{ steps.run-performance-test.outputs.perf-discord-message }}' - REPO_FULL_NAME: ${{ github.event.repository.full_name }} - RESULT_FRAMES_CHART: ${{ steps.run-performance-test.outputs.perf-frames-chart }} - RESULT_INTERACTIONS_CHART: ${{ steps.run-performance-test.outputs.perf-interactions-chart }} - run: | - echo "DISCORD_EMBEDS=$(jq -nc --arg title "$TITLE" --arg html_url "$HTML_URL" --arg description "$DESCRIPTION" --arg repo_full_name "$REPO_FULL_NAME" --arg result_frames_chart "$RESULT_FRAMES_CHART" --arg result_interactions_chart "$RESULT_INTERACTIONS_CHART" "$TEMPLATE")" | sed 's/\\\\n/\\n/g' >> $GITHUB_ENV - - name: Send Discord Notification - uses: Ilshidur/action-discord@0.3.2 - if: ${{ steps.run-performance-test.outputs.perf-serious-regression-found == 'true' }} - env: - DISCORD_WEBHOOK: ${{ secrets.DISCORD_PRS_WEBHOOK }} - DISCORD_USERNAME: 'Puppeteer' - DISCORD_AVATAR: https://octodex.github.com/images/puppeteer.png - MESSAGE: 'Performance results for #${{ github.event.pull_request.number }}' - with: - args: ${{ env.MESSAGE }} - - system-test: - name: Run System Tests - timeout-minutes: 15 - runs-on: ubuntu-latest - needs: [deploy-branch, cache-pnpm-store] - env: - UTOPIA_SHA: ${{ github.sha }} - steps: - # Gets the branch that this PR is targeting and replaces forward slashes in the name with hyphens. - # So that later steps can produce a bundle incorporating that into the name and upload it. - - name: Extract branch name - shell: bash - run: | - FIXED_REF="${GITHUB_HEAD_REF////-}" - echo "##[set-output name=branch;]$FIXED_REF" - id: extract_branch - - name: Check out the repo - uses: actions/checkout@v2 - - name: Cache .pnpm-store - uses: actions/cache@v2 - with: - path: ${{ needs.cache-pnpm-store.outputs.pnpm-store-path }} - key: ${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}-captured-location - - name: Install Puppeteer Libraries - run: | - sudo apt-get update - sudo apt-get install -y ca-certificates fonts-liberation libappindicator3-1 libasound2 libatk-bridge2.0-0 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgbm1 libgcc1 libglib2.0-0 libgtk-3-0 libnspr4 libnss3 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 lsb-release wget xdg-utils - - name: Install nix - uses: cachix/install-nix-action@v12 - with: - nix_path: nixpkgs=https://github.com/NixOS/nixpkgs/archive/6120ac5cd201f6cb593d1b80e861be0342495be9.tar.gz - - name: Run System Test - id: run-system-test - env: - BRANCH_NAME: ${{ steps.extract_branch.outputs.branch }} - HEADLESS: 'true' - run: | - nix-shell --arg includeServerBuildSupport false --arg includeRunLocallySupport false --run "cd puppeteer-tests; pnpm install --unsafe-perm; pnpm run system-test" - - comments-test: - name: Run Comments Tests - timeout-minutes: 12 - runs-on: ubuntu-latest - needs: [deploy-branch, cache-pnpm-store] - env: - UTOPIA_SHA: ${{ github.sha }} - AUTH0_CLIENT_ID: KB7euFO46rVYeOaWmrEdktdhAFxEO266 - AUTH0_ENDPOINT: enter.utopia.app - AUTH0_REDIRECT_URI: https://utopia.fish/authenticate - steps: - # Gets the branch that this PR is targeting and replaces forward slashes in the name with hyphens. - # So that later steps can produce a bundle incorporating that into the name and upload it. - - name: Extract branch name - shell: bash - run: | - FIXED_REF="${GITHUB_HEAD_REF////-}" - echo "##[set-output name=branch;]$FIXED_REF" - id: extract_branch - - name: Install nix - uses: cachix/install-nix-action@v12 - with: - nix_path: nixpkgs=https://github.com/NixOS/nixpkgs/archive/6120ac5cd201f6cb593d1b80e861be0342495be9.tar.gz - - name: Check out the repo - uses: actions/checkout@v2 - - name: Cache .pnpm-store - uses: actions/cache@v2 - with: - path: ${{ needs.cache-pnpm-store.outputs.pnpm-store-path }} - key: ${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}-captured-location - - name: Build Comments Tests - run: | - nix-shell --arg includeServerBuildSupport false --arg includeRunLocallySupport false --run "build-puppeteer-tests" - - name: Run Comments Test - id: run-comments-test - env: - BRANCH_NAME: ${{ steps.extract_branch.outputs.branch }} - BASE_URL: 'https://utopia.fish' - run: | - nix-shell --arg includeServerBuildSupport false --arg includeRunLocallySupport false --run "xvfb-run --server-args='-screen 0 1920x1080x24 -ac -nolisten tcp -dpi 96 +extension RANDR' run-comments-test" - - collaboration-test: - name: Run Collaboration Tests - timeout-minutes: 12 - runs-on: ubuntu-latest - needs: [deploy-branch, cache-pnpm-store] - env: - UTOPIA_SHA: ${{ github.sha }} - AUTH0_CLIENT_ID: KB7euFO46rVYeOaWmrEdktdhAFxEO266 - AUTH0_ENDPOINT: enter.utopia.app - AUTH0_REDIRECT_URI: https://utopia.fish/authenticate - steps: - # Gets the branch that this PR is targeting and replaces forward slashes in the name with hyphens. - # So that later steps can produce a bundle incorporating that into the name and upload it. - - name: Extract branch name - shell: bash - run: | - FIXED_REF="${GITHUB_HEAD_REF////-}" - echo "##[set-output name=branch;]$FIXED_REF" - id: extract_branch - - name: Install nix - uses: cachix/install-nix-action@v12 - with: - nix_path: nixpkgs=https://github.com/NixOS/nixpkgs/archive/6120ac5cd201f6cb593d1b80e861be0342495be9.tar.gz - - name: Check out the repo - uses: actions/checkout@v2 - - name: Cache .pnpm-store - uses: actions/cache@v2 - with: - path: ${{ needs.cache-pnpm-store.outputs.pnpm-store-path }} - key: ${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}-captured-location - - name: Build Comments Tests - run: | - nix-shell --arg includeServerBuildSupport false --arg includeRunLocallySupport false --run "build-puppeteer-tests" - - name: Run Comments Test - id: run-comments-test - env: - BRANCH_NAME: ${{ steps.extract_branch.outputs.branch }} - BASE_URL: 'https://utopia.fish' - run: | - nix-shell --arg includeServerBuildSupport false --arg includeRunLocallySupport false --run "xvfb-run --server-args='-screen 0 1920x1080x24 -ac -nolisten tcp -dpi 96 +extension RANDR' run-collaboration-test" + - name: Build it + run: nix-shell --arg includeServerBuildSupport true --arg includeEditorBuildSupport true --arg includeReleaseSupport true --arg includeDatabaseSupport true --arg includeRunLocallySupport false --run build-all-staging From a0566562e7e9723f3751c56175637a6fd395c1eb Mon Sep 17 00:00:00 2001 From: RheeseyB <1044774+Rheeseyb@users.noreply.github.com> Date: Thu, 1 Feb 2024 13:13:12 +0000 Subject: [PATCH 03/10] fix(workflow) Include GITHUB_TOKEN for vscode build --- .github/workflows/pull-requests.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/pull-requests.yml b/.github/workflows/pull-requests.yml index 3b2e63cbb8bf..59b220a68812 100644 --- a/.github/workflows/pull-requests.yml +++ b/.github/workflows/pull-requests.yml @@ -26,4 +26,6 @@ jobs: with: nix_path: nixpkgs=https://github.com/NixOS/nixpkgs/archive/6120ac5cd201f6cb593d1b80e861be0342495be9.tar.gz - name: Build it + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: nix-shell --arg includeServerBuildSupport true --arg includeEditorBuildSupport true --arg includeReleaseSupport true --arg includeDatabaseSupport true --arg includeRunLocallySupport false --run build-all-staging From 797a082808221e20036f41cb64ea77506202cf76 Mon Sep 17 00:00:00 2001 From: RheeseyB <1044774+Rheeseyb@users.noreply.github.com> Date: Thu, 1 Feb 2024 13:24:37 +0000 Subject: [PATCH 04/10] fix(shell.nix) move check-tool-versions into baseEditorScripts --- shell.nix | 82 +++++++++++++++++++++++++++---------------------------- 1 file changed, 41 insertions(+), 41 deletions(-) diff --git a/shell.nix b/shell.nix index 1aa43663a806..22daa7f9ff08 100644 --- a/shell.nix +++ b/shell.nix @@ -240,6 +240,47 @@ let build-utopia-vscode-extension build-vscode '') + (pkgs.writeScriptBin "check-tool-versions" '' + #! /usr/bin/env nix-shell + #! nix-shell -p "haskellPackages.ghcWithPackages (pkgs: with pkgs; [async process])" -i runhaskell + + import Control.Concurrent.Async + import Control.Monad + import Data.Foldable + import Data.List + import Data.Monoid + import System.Exit + import System.Process + + expectedToolVersions :: [(String, [String], [String])] + expectedToolVersions = + [ ("pnpm", ["--version"], ["7.14.2"]) + , ("yarn", ["--version"], ["1.22.19"]) + , ("ghc", ["--version"], ["The Glorious Glasgow Haskell Compilation System, version 9.0.2"]) + , ("cabal", ["--version"], ["cabal-install version 3.8.1.0", "compiled using version 3.8.1.0 of the Cabal library "]) + ] + + checkVersion :: (String, [String], [String]) -> IO All + checkVersion (executable, arguments, expectedOutput) = do + let commandToRun = unwords (executable : arguments) + output <- readProcess "nix-shell" ["--run", commandToRun] "" + let actualOutput = lines output + let correctVersion = actualOutput == expectedOutput + unless correctVersion $ do + putStrLn ("Error when checking the version of " <> executable) + putStrLn "Expected:" + traverse_ putStrLn expectedOutput + putStrLn "Received:" + traverse_ putStrLn actualOutput + pure $ All correctVersion + + main :: IO () + main = do + results <- mapConcurrently checkVersion expectedToolVersions + let result = getAll $ mconcat results + when result $ putStrLn "All tools are the correct version." + if result then exitSuccess else exitFailure + '') ]; withBaseEditorScripts = lib.optionals includeEditorBuildSupport baseEditorScripts; @@ -494,47 +535,6 @@ let # For the useful scripts in our dev environments customDevScripts = [ - (pkgs.writeScriptBin "check-tool-versions" '' - #! /usr/bin/env nix-shell - #! nix-shell -p "haskellPackages.ghcWithPackages (pkgs: with pkgs; [async process])" -i runhaskell - - import Control.Concurrent.Async - import Control.Monad - import Data.Foldable - import Data.List - import Data.Monoid - import System.Exit - import System.Process - - expectedToolVersions :: [(String, [String], [String])] - expectedToolVersions = - [ ("pnpm", ["--version"], ["7.14.2"]) - , ("yarn", ["--version"], ["1.22.19"]) - , ("ghc", ["--version"], ["The Glorious Glasgow Haskell Compilation System, version 9.0.2"]) - , ("cabal", ["--version"], ["cabal-install version 3.8.1.0", "compiled using version 3.8.1.0 of the Cabal library "]) - ] - - checkVersion :: (String, [String], [String]) -> IO All - checkVersion (executable, arguments, expectedOutput) = do - let commandToRun = unwords (executable : arguments) - output <- readProcess "nix-shell" ["--run", commandToRun] "" - let actualOutput = lines output - let correctVersion = actualOutput == expectedOutput - unless correctVersion $ do - putStrLn ("Error when checking the version of " <> executable) - putStrLn "Expected:" - traverse_ putStrLn expectedOutput - putStrLn "Received:" - traverse_ putStrLn actualOutput - pure $ All correctVersion - - main :: IO () - main = do - results <- mapConcurrently checkVersion expectedToolVersions - let result = getAll $ mconcat results - when result $ putStrLn "All tools are the correct version." - if result then exitSuccess else exitFailure - '') (pkgs.writeScriptBin "stop-dev" '' #!/usr/bin/env bash # Kill nodemon because it just seems to keep running. From 265d7a76311b512057c2db2c3e1b03532ecd8259 Mon Sep 17 00:00:00 2001 From: RheeseyB <1044774+Rheeseyb@users.noreply.github.com> Date: Fri, 2 Feb 2024 11:34:06 +0000 Subject: [PATCH 05/10] chore(shell.nix) Some tidying up --- docker-build.nix | 30 ------------------------------ shell.nix | 9 ++------- vscode-build/shell.nix | 9 +++++---- 3 files changed, 7 insertions(+), 41 deletions(-) delete mode 100644 docker-build.nix diff --git a/docker-build.nix b/docker-build.nix deleted file mode 100644 index 54556c05ac30..000000000000 --- a/docker-build.nix +++ /dev/null @@ -1,30 +0,0 @@ -let - release = (import ./release.nix {}); - pkgs = release.pkgs; - stdenv = pkgs.stdenv; - - haskellImage = pkgs.dockerTools.pullImage { - imageName = "haskell"; - imageDigest = "sha256:2351d1ed56b95add00b8820d1aa7bc1a7f1a277989f7f4de41f01b065fbe5ee8"; - sha256 = "sha256-oH1mbIBAF/dRjB0pOj6tFLTvQihnlPzETijxJNCPwok="; - }; - - dockerBuild = pkgs.dockerTools.buildImage { - name = "hello-docker"; - fromImage = haskellImage; - fromImageTag = "9.0.2"; - copyToRoot = [ - ./dist - ]; - config = { - Env = [ - "APP_ENVIRONMENT=PRODUCTION" - "PROXY_WEBPACK=FALSE" - "WEBPACK_DLL_ENV=webpack-dll-dev" - "UTOPIA_SHA=$UTOPIA_SHA" - ]; - Cmd = [ "run-server-production.sh" ]; - }; - }; - -in dockerBuild \ No newline at end of file diff --git a/shell.nix b/shell.nix index 22daa7f9ff08..e9169e6326a2 100644 --- a/shell.nix +++ b/shell.nix @@ -3,7 +3,7 @@ includeServerBuildSupport ? true, includeEditorBuildSupport ? true, includeRunLocallySupport ? true, - includeReleaseSupport ? true, + includeReleaseSupport ? false, includeDatabaseSupport ? true }: @@ -672,7 +672,7 @@ let cp -r website-next/out/. dist/server/public cp -r editor/resources/editor/. dist/server/editor cp -r editor/lib/. dist/server/editor - # cp server/utopia-web dist/server + cp server/utopia-web dist/server cp -r server/migrations/. dist/server/migrations cp run-server-production.sh dist/server '') @@ -693,11 +693,6 @@ let copy-all-to-dist-folder fi '') - (pkgs.writeScriptBin "build-docker" '' - #!/usr/bin/env bash - set -e - docker load < $(nix-build docker-build.nix) - '') ]; withReleaseScripts = withCustomDevScripts ++ (lib.optionals includeReleaseSupport releaseScripts); diff --git a/vscode-build/shell.nix b/vscode-build/shell.nix index 30aa953c0e08..0ea6695dbf3e 100644 --- a/vscode-build/shell.nix +++ b/vscode-build/shell.nix @@ -24,6 +24,7 @@ let #!/usr/bin/env bash set -e cd $(${pkgs.git}/bin/git rev-parse --show-toplevel)/vscode-build + ${yarn}/bin/yarn ${yarn}/bin/yarn run pull-utopia-extension '') (pkgs.writeScriptBin "update-vscode-build-extension-inner" '' @@ -31,16 +32,16 @@ let set -e build-utopia-vscode-extension cd $(${pkgs.git}/bin/git rev-parse --show-toplevel)/vscode-build - yarn - yarn run pull-utopia-extension + ${yarn}/bin/yarn + ${yarn}/bin/yarn run pull-utopia-extension '') (pkgs.writeScriptBin "build-vscode-inner" '' #!/usr/bin/env bash set -e cd $(${pkgs.git}/bin/git rev-parse --show-toplevel)/vscode-build rm -rf ./dist ./node_modules - yarn - yarn run build + ${yarn}/bin/yarn + ${yarn}/bin/yarn run build '') ]; From 3cff0512ee002e520b5482de0642698c3b49a8eb Mon Sep 17 00:00:00 2001 From: RheeseyB <1044774+Rheeseyb@users.noreply.github.com> Date: Fri, 2 Feb 2024 11:39:51 +0000 Subject: [PATCH 06/10] chore(workflows) Revert pull-requests.yml --- .github/workflows/pull-requests.yml | 461 +++++++++++++++++++++++++++- 1 file changed, 455 insertions(+), 6 deletions(-) diff --git a/.github/workflows/pull-requests.yml b/.github/workflows/pull-requests.yml index 59b220a68812..9cca4776808a 100644 --- a/.github/workflows/pull-requests.yml +++ b/.github/workflows/pull-requests.yml @@ -7,9 +7,9 @@ jobs: secrets: inherit uses: ./.github/workflows/cache-pnpm-install.yml - build-everything: - name: Build Everything - timeout-minutes: 60 + test-editor-code: + name: Test Editor PR – TypeScript, ESLint, dependency-cruiser + timeout-minutes: 15 runs-on: ubuntu-latest needs: [cache-pnpm-store] env: @@ -21,11 +21,460 @@ jobs: githubToken: ${{ secrets.GITHUB_TOKEN }} - name: Check out the repo uses: actions/checkout@v2 + - name: Cache editor test result + id: cache-editor-tests + uses: actions/cache@v2 + with: + # For the tests it doesn't really matter what we cache + path: editor/lib + key: ${{ runner.os }}-editor-code-tests-PR-${{ hashFiles('editor/src/**') }}-${{ hashFiles('utopia-api/src/**') }}-${{ hashFiles('editor/package.json') }}-${{ hashFiles('utopia-api/package.json') }} + - name: Cache pnpm store + uses: actions/cache@v2 + with: + path: ${{ needs.cache-pnpm-store.outputs.pnpm-store-path }} + key: ${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}-captured-location - name: Install nix uses: cachix/install-nix-action@v12 with: nix_path: nixpkgs=https://github.com/NixOS/nixpkgs/archive/6120ac5cd201f6cb593d1b80e861be0342495be9.tar.gz - - name: Build it + - name: Capture pnpm store location + run: nix-shell --arg includeServerBuildSupport false --arg includeRunLocallySupport false --run 'echo "pnpm-store-path=$(pnpm store path)" >> "$GITHUB_ENV"' + - name: Run tsc, eslint, depdendency-cruiser and the website tests + if: steps.cache-editor-tests.outputs.cache-hit != 'true' + run: nix-shell --arg includeServerBuildSupport false --arg includeRunLocallySupport false --run check-editor-code-ci + + test-editor-jest: + name: Test Editor PR – Jest tests + timeout-minutes: 15 + runs-on: ubuntu-latest + needs: [cache-pnpm-store] + env: + UTOPIA_SHA: ${{ github.sha }} + steps: + - name: Cancel existing runs on this branch + uses: fauguste/auto-cancellation-running-action@0.1.4 + with: + githubToken: ${{ secrets.GITHUB_TOKEN }} + - name: Check out the repo + uses: actions/checkout@v2 + - name: Cache editor test result + id: cache-editor-tests + uses: actions/cache@v2 + with: + # For the tests it doesn't really matter what we cache + path: editor/lib + key: ${{ runner.os }}-editor-jest-tests-PR-${{ hashFiles('editor/src/**') }}-${{ hashFiles('utopia-api/src/**') }}-${{ hashFiles('editor/package.json') }}-${{ hashFiles('utopia-api/package.json') }} + - name: Cache .pnpm-store + uses: actions/cache@v2 + with: + path: ${{ needs.cache-pnpm-store.outputs.pnpm-store-path }} + key: ${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}-captured-location + - name: Install nix + uses: cachix/install-nix-action@v12 + with: + nix_path: nixpkgs=https://github.com/NixOS/nixpkgs/archive/6120ac5cd201f6cb593d1b80e861be0342495be9.tar.gz + - name: Run the Jest tests + if: steps.cache-editor-tests.outputs.cache-hit != 'true' + run: nix-shell --arg includeServerBuildSupport false --arg includeRunLocallySupport false --run check-editor-jest-ci + + call-test-editor-karma-shard-1: + name: Test Editor Shard 1 + needs: [cache-pnpm-store] + uses: ./.github/workflows/editor-sharded-tests.yml + secrets: inherit + with: + shard_number: 1 + branch: PR + pnpm-store-path: ${{ needs.cache-pnpm-store.outputs.pnpm-store-path }} + + call-test-editor-karma-shard-2: + name: Test Editor Shard 2 + needs: [cache-pnpm-store] + uses: ./.github/workflows/editor-sharded-tests.yml + secrets: inherit + with: + shard_number: 2 + branch: PR + pnpm-store-path: ${{ needs.cache-pnpm-store.outputs.pnpm-store-path }} + + test-server: + name: Test Server + timeout-minutes: 25 + runs-on: ubuntu-latest + env: + UTOPIA_SHA: ${{ github.sha }} + steps: + - name: Check out the repo + uses: actions/checkout@v2 + - name: Cache .cabal/packages + uses: actions/cache@v2 + with: + path: .cabal/packages + key: ${{ runner.os }}-${{ matrix.ghc }}-cabal-packages-2 + - name: Cache .cabal/store + uses: actions/cache@v2 + with: + path: .cabal/store + key: ${{ runner.os }}-${{ matrix.ghc }}-cabal-store-2 + - name: Cache dist-newstyle + uses: actions/cache@v2 + with: + path: server/dist-newstyle + key: ${{ runner.os }}-${{ matrix.ghc }}-server-dist-newstyle-2 + - name: Cache server test result + id: cache-server-tests + uses: actions/cache@v2 + with: + # For the tests it doesn't really matter what we cache + path: server/src + key: ${{ runner.os }}-server-tests-master-${{ hashFiles('server/src/**') }}-${{ hashFiles('server/test/**') }}-${{ hashFiles('server/cabal.project.freeze') }} + - name: Install nix + uses: cachix/install-nix-action@v12 + with: + nix_path: nixpkgs=https://github.com/NixOS/nixpkgs/archive/6120ac5cd201f6cb593d1b80e861be0342495be9.tar.gz + - name: Start PostgreSQL + if: steps.cache-server-tests.outputs.cache-hit != 'true' + run: nix-shell --arg includeEditorBuildSupport false --arg includeRunLocallySupport false --arg includeDatabaseSupport true --run start-postgres-background + - name: Run the tests + if: steps.cache-server-tests.outputs.cache-hit != 'true' + run: nix-shell --arg includeEditorBuildSupport false --arg includeRunLocallySupport false --run test-server-ci + + deploy-branch: + name: Deploy Branch Editor + timeout-minutes: 15 + runs-on: ubuntu-latest + needs: [cache-pnpm-store] + env: + UTOPIA_SHA: ${{ github.sha }} + AUTH0_CLIENT_ID: A9v9iuucCnFzkb1OzGkbAvi3cSF8kQtu + AUTH0_ENDPOINT: utopia-staging.us.auth0.com + steps: + # Create a comment immediately so that the first comment can be used as a "Try me" link + - name: Find Comment + uses: peter-evans/find-comment@v1 + id: fc-initial + with: + issue-number: ${{ github.event.pull_request.number }} + comment-author: 'github-actions[bot]' + body-includes: Try me + - name: Create or update comment + uses: peter-evans/create-or-update-comment@v1 + if: ${{ success() || failure() }} + with: + comment-id: ${{ steps.fc-initial.outputs.comment-id }} + issue-number: ${{ github.event.pull_request.number }} + edit-mode: replace + body: | + ## Try me + (building...) + # Gets the branch that this PR is targeting and replaces forward slashes in the name with hyphens. + # So that later steps can produce a bundle incorporating that into the name and upload it. + - name: Extract branch name + shell: bash + run: | + FIXED_REF="${GITHUB_HEAD_REF////-}" + echo "##[set-output name=branch;]$FIXED_REF" + id: extract_branch + - name: Check out the repo + uses: actions/checkout@v2 + - name: Cache .pnpm-store + uses: actions/cache@v2 + with: + path: ${{ needs.cache-pnpm-store.outputs.pnpm-store-path }} + key: ${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}-captured-location + - name: Install nix + uses: cachix/install-nix-action@v12 + with: + nix_path: nixpkgs=https://github.com/NixOS/nixpkgs/archive/6120ac5cd201f6cb593d1b80e861be0342495be9.tar.gz + - name: Build Editor + if: steps.cache-editor-tests.outputs.cache-hit != 'true' + run: | + nix-shell --arg includeServerBuildSupport false --arg includeRunLocallySupport false --run build-editor-branches-ci + - name: Send webpack stats to RelativeCI + uses: relative-ci/agent-action@v1.1.0 + with: + webpackStatsFile: editor/lib/branches-stats.json + key: ${{ secrets.RELATIVE_CI_KEY }} + debug: false + - name: Delete node_modules + working-directory: editor/ + run: | + rm -rf ./node_modules + cd ../utopia-api + rm -rf ./node_modules + cd ../website-next + rm -rf ./node_modules + cd ../utopia-vscode-extension + rm -rf ./node_modules + cd ../utopia-vscode-common + rm -rf ./node_modules + - name: Create Editor Bundle + working-directory: editor/lib/ + run: | + tar -czvf ../${{ steps.extract_branch.outputs.branch }}.tar.gz * + # Update the "Try me" comment with the new status. We have to find it again because it + # might not have existed during the previous search + - name: Find Comment + uses: peter-evans/find-comment@v1 + id: fc + with: + issue-number: ${{ github.event.pull_request.number }} + comment-author: 'github-actions[bot]' + body-includes: Try me + - name: Create or update comment + uses: peter-evans/create-or-update-comment@v1 + if: ${{ success() || failure() }} + with: + comment-id: ${{ steps.fc.outputs.comment-id }} + issue-number: ${{ github.event.pull_request.number }} + edit-mode: replace + body: | + ## Try me + (deploying...) + - name: Upload Editor Bundle + uses: jakejarvis/s3-sync-action@v0.5.1 + with: + args: --acl private --exclude '*' --include 'editor/${{ steps.extract_branch.outputs.branch }}.tar.gz' + env: + AWS_S3_BUCKET: ${{ secrets.STAGING_BUNDLE_S3_BUCKET }} + AWS_ACCESS_KEY_ID: ${{ secrets.STAGING_BUNDLE_ACCESS_KEY }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.STAGING_BUNDLE_SECRET_ACCESS_KEY }} + AWS_REGION: ${{ secrets.STAGING_BUNDLE_REGION }} + - name: Flush Staging Branch Editor Bundle + shell: bash + run: | + curl -s -o /dev/null -w "FLUSH STAGING HTTP RESPONSE CODE: %{http_code}" -X DELETE 'https://${{ secrets.STAGING_SERVER }}/internal/branch?branch_name=${{ steps.extract_branch.outputs.branch }}' + # Update the "Try me" comment with the actual link + - name: Create or update comment + uses: peter-evans/create-or-update-comment@v1 + if: ${{ success() || failure() }} + with: + comment-id: ${{ steps.fc.outputs.comment-id }} + issue-number: ${{ github.event.pull_request.number }} + edit-mode: replace + body: | + ## [Try me](https://${{ secrets.STAGING_SERVER }}/p/?branch_name=${{ steps.extract_branch.outputs.branch }}) + + performance-test: + name: Run Performance Tests + timeout-minutes: 15 + runs-on: self-hosted + needs: [deploy-branch, cache-pnpm-store] + env: + UTOPIA_SHA: ${{ github.sha }} + AUTH0_CLIENT_ID: A9v9iuucCnFzkb1OzGkbAvi3cSF8kQtu + AUTH0_ENDPOINT: utopia-staging.us.auth0.com + steps: + # Gets the branch that this PR is targeting and replaces forward slashes in the name with hyphens. + # So that later steps can produce a bundle incorporating that into the name and upload it. + - name: Extract branch name + shell: bash + run: | + FIXED_REF="${GITHUB_HEAD_REF////-}" + echo "##[set-output name=branch;]$FIXED_REF" + id: extract_branch + - name: Check out the repo + uses: actions/checkout@v2 + - name: Cache .pnpm-store + uses: actions/cache@v2 + with: + path: ${{ needs.cache-pnpm-store.outputs.pnpm-store-path }} + key: ${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}-captured-location + - name: Build Performance Tests + run: | + nix-shell --arg includeServerBuildSupport false --arg includeRunLocallySupport false --run "build-puppeteer-tests" + - name: Run Performance Test + id: run-performance-test + env: + BRANCH_NAME: ${{ steps.extract_branch.outputs.branch }} + AWS_S3_BUCKET: ${{secrets.PERFORMANCE_GRAPHS_BUCKET}} + AWS_ACCESS_KEY_ID: ${{ secrets.PERFORMANCE_GRAPHS_ACCESS_KEY}} + AWS_SECRET_ACCESS_KEY: ${{ secrets.PERFORMANCE_GRAPHS_SECRET_KEY }} + AWS_REGION: ${{ secrets.STAGING_BUNDLE_REGION }} + PERFORMANCE_GRAPHS_PLOTLY_USERNAME: ${{ secrets.PERFORMANCE_GRAPHS_PLOTLY_USERNAME}} + PERFORMANCE_GRAPHS_PLOTLY_API_KEY: ${{secrets.PERFORMANCE_GRAPHS_PLOTLY_API_KEY}} + run: | + nix-shell --arg includeServerBuildSupport false --arg includeRunLocallySupport false --run "xvfb-run --server-args='-screen 0 1920x1080x24 -ac -nolisten tcp -dpi 96 +extension RANDR' run-puppeteer-test" + - name: Find Comment + uses: peter-evans/find-comment@v1 + id: fc + with: + issue-number: ${{ github.event.pull_request.number }} + comment-author: 'github-actions[bot]' + body-includes: Performance test results + - name: Create or update comment + uses: peter-evans/create-or-update-comment@v1 + if: ${{ success() || failure() }} + with: + comment-id: ${{ steps.fc.outputs.comment-id }} + issue-number: ${{ github.event.pull_request.number }} + edit-mode: replace + body: | + Performance test results: + ${{ steps.run-performance-test.outputs.perf-result }} + - name: Build Discord Message + if: ${{ steps.run-performance-test.outputs.perf-serious-regression-found == 'true' }} + env: + TEMPLATE: >- + [ + { + "title": $title, + "url": $html_url, + "color": 2369839, + "description": $description, + "footer": { + "text": $repo_full_name + } + }, + { + "title": "Frame Tests:", + "color": 2369839, + "image": { + "url": $result_frames_chart + } + }, + { + "title": "Interaction Tests:", + "color": 14540253, + "image": { + "url": $result_interactions_chart + } + } + ] + TITLE: 'Performance Results for #${{ github.event.pull_request.number }} ${{ github.event.pull_request.title }}' + HTML_URL: ${{ github.event.pull_request.html_url }} + DESCRIPTION: 'Link to test editor: https://${{ secrets.STAGING_SERVER }}/p/?branch_name=${{ steps.extract_branch.outputs.branch }} \n \n Results: \n ${{ steps.run-performance-test.outputs.perf-discord-message }}' + REPO_FULL_NAME: ${{ github.event.repository.full_name }} + RESULT_FRAMES_CHART: ${{ steps.run-performance-test.outputs.perf-frames-chart }} + RESULT_INTERACTIONS_CHART: ${{ steps.run-performance-test.outputs.perf-interactions-chart }} + run: | + echo "DISCORD_EMBEDS=$(jq -nc --arg title "$TITLE" --arg html_url "$HTML_URL" --arg description "$DESCRIPTION" --arg repo_full_name "$REPO_FULL_NAME" --arg result_frames_chart "$RESULT_FRAMES_CHART" --arg result_interactions_chart "$RESULT_INTERACTIONS_CHART" "$TEMPLATE")" | sed 's/\\\\n/\\n/g' >> $GITHUB_ENV + - name: Send Discord Notification + uses: Ilshidur/action-discord@0.3.2 + if: ${{ steps.run-performance-test.outputs.perf-serious-regression-found == 'true' }} + env: + DISCORD_WEBHOOK: ${{ secrets.DISCORD_PRS_WEBHOOK }} + DISCORD_USERNAME: 'Puppeteer' + DISCORD_AVATAR: https://octodex.github.com/images/puppeteer.png + MESSAGE: 'Performance results for #${{ github.event.pull_request.number }}' + with: + args: ${{ env.MESSAGE }} + + system-test: + name: Run System Tests + timeout-minutes: 15 + runs-on: ubuntu-latest + needs: [deploy-branch, cache-pnpm-store] + env: + UTOPIA_SHA: ${{ github.sha }} + steps: + # Gets the branch that this PR is targeting and replaces forward slashes in the name with hyphens. + # So that later steps can produce a bundle incorporating that into the name and upload it. + - name: Extract branch name + shell: bash + run: | + FIXED_REF="${GITHUB_HEAD_REF////-}" + echo "##[set-output name=branch;]$FIXED_REF" + id: extract_branch + - name: Check out the repo + uses: actions/checkout@v2 + - name: Cache .pnpm-store + uses: actions/cache@v2 + with: + path: ${{ needs.cache-pnpm-store.outputs.pnpm-store-path }} + key: ${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}-captured-location + - name: Install Puppeteer Libraries + run: | + sudo apt-get update + sudo apt-get install -y ca-certificates fonts-liberation libappindicator3-1 libasound2 libatk-bridge2.0-0 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgbm1 libgcc1 libglib2.0-0 libgtk-3-0 libnspr4 libnss3 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 lsb-release wget xdg-utils + - name: Install nix + uses: cachix/install-nix-action@v12 + with: + nix_path: nixpkgs=https://github.com/NixOS/nixpkgs/archive/6120ac5cd201f6cb593d1b80e861be0342495be9.tar.gz + - name: Run System Test + id: run-system-test + env: + BRANCH_NAME: ${{ steps.extract_branch.outputs.branch }} + HEADLESS: 'true' + run: | + nix-shell --arg includeServerBuildSupport false --arg includeRunLocallySupport false --run "cd puppeteer-tests; pnpm install --unsafe-perm; pnpm run system-test" + + comments-test: + name: Run Comments Tests + timeout-minutes: 12 + runs-on: ubuntu-latest + needs: [deploy-branch, cache-pnpm-store] + env: + UTOPIA_SHA: ${{ github.sha }} + AUTH0_CLIENT_ID: A9v9iuucCnFzkb1OzGkbAvi3cSF8kQtu + AUTH0_ENDPOINT: utopia-staging.us.auth0.com + steps: + # Gets the branch that this PR is targeting and replaces forward slashes in the name with hyphens. + # So that later steps can produce a bundle incorporating that into the name and upload it. + - name: Extract branch name + shell: bash + run: | + FIXED_REF="${GITHUB_HEAD_REF////-}" + echo "##[set-output name=branch;]$FIXED_REF" + id: extract_branch + - name: Install nix + uses: cachix/install-nix-action@v12 + with: + nix_path: nixpkgs=https://github.com/NixOS/nixpkgs/archive/6120ac5cd201f6cb593d1b80e861be0342495be9.tar.gz + - name: Check out the repo + uses: actions/checkout@v2 + - name: Cache .pnpm-store + uses: actions/cache@v2 + with: + path: ${{ needs.cache-pnpm-store.outputs.pnpm-store-path }} + key: ${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}-captured-location + - name: Build Comments Tests + run: | + nix-shell --arg includeServerBuildSupport false --arg includeRunLocallySupport false --run "build-puppeteer-tests" + - name: Run Comments Test + id: run-comments-test + env: + BRANCH_NAME: ${{ steps.extract_branch.outputs.branch }} + BASE_URL: 'https://utopia.fish' + run: | + nix-shell --arg includeServerBuildSupport false --arg includeRunLocallySupport false --run "xvfb-run --server-args='-screen 0 1920x1080x24 -ac -nolisten tcp -dpi 96 +extension RANDR' run-comments-test" + + collaboration-test: + name: Run Collaboration Tests + timeout-minutes: 12 + runs-on: ubuntu-latest + needs: [deploy-branch, cache-pnpm-store] + env: + UTOPIA_SHA: ${{ github.sha }} + AUTH0_CLIENT_ID: A9v9iuucCnFzkb1OzGkbAvi3cSF8kQtu + AUTH0_ENDPOINT: utopia-staging.us.auth0.com + steps: + # Gets the branch that this PR is targeting and replaces forward slashes in the name with hyphens. + # So that later steps can produce a bundle incorporating that into the name and upload it. + - name: Extract branch name + shell: bash + run: | + FIXED_REF="${GITHUB_HEAD_REF////-}" + echo "##[set-output name=branch;]$FIXED_REF" + id: extract_branch + - name: Install nix + uses: cachix/install-nix-action@v12 + with: + nix_path: nixpkgs=https://github.com/NixOS/nixpkgs/archive/6120ac5cd201f6cb593d1b80e861be0342495be9.tar.gz + - name: Check out the repo + uses: actions/checkout@v2 + - name: Cache .pnpm-store + uses: actions/cache@v2 + with: + path: ${{ needs.cache-pnpm-store.outputs.pnpm-store-path }} + key: ${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}-captured-location + - name: Build Comments Tests + run: | + nix-shell --arg includeServerBuildSupport false --arg includeRunLocallySupport false --run "build-puppeteer-tests" + - name: Run Comments Test + id: run-comments-test env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: nix-shell --arg includeServerBuildSupport true --arg includeEditorBuildSupport true --arg includeReleaseSupport true --arg includeDatabaseSupport true --arg includeRunLocallySupport false --run build-all-staging + BRANCH_NAME: ${{ steps.extract_branch.outputs.branch }} + BASE_URL: 'https://utopia.fish' + run: | + nix-shell --arg includeServerBuildSupport false --arg includeRunLocallySupport false --run "xvfb-run --server-args='-screen 0 1920x1080x24 -ac -nolisten tcp -dpi 96 +extension RANDR' run-collaboration-test" From 5a4cc2da8c3c35272a96ae094c528a6fa031290a Mon Sep 17 00:00:00 2001 From: RheeseyB <1044774+Rheeseyb@users.noreply.github.com> Date: Fri, 2 Feb 2024 11:50:58 +0000 Subject: [PATCH 07/10] chore(all) Removing some now unnecessary files and scripts --- run-server-production.sh | 4 ---- shell.nix | 39 +-------------------------------------- 2 files changed, 1 insertion(+), 42 deletions(-) delete mode 100755 run-server-production.sh diff --git a/run-server-production.sh b/run-server-production.sh deleted file mode 100755 index 946fb8106a5c..000000000000 --- a/run-server-production.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env sh - -cd /server -./utopia-web +RTS -N -c diff --git a/shell.nix b/shell.nix index e9169e6326a2..e9e82dda1600 100644 --- a/shell.nix +++ b/shell.nix @@ -657,42 +657,6 @@ let ${cabal}/bin/cabal new-build utopia-web cp --verbose $(${pkgs.haskellPackages.cabal-plan}/bin/cabal-plan list-bin exe:utopia-web) . '') - (pkgs.writeScriptBin "copy-all-to-dist-folder" '' - #!/usr/bin/env bash - set -e - cd $(${pkgs.git}/bin/git rev-parse --show-toplevel)/ - rm -rf dist - mkdir dist - mkdir dist/server - mkdir dist/server/editor - mkdir dist/server/migrations - mkdir dist/server/public - mkdir dist/server/vscode - cp -r vscode-build/dist/. dist/server/vscode - cp -r website-next/out/. dist/server/public - cp -r editor/resources/editor/. dist/server/editor - cp -r editor/lib/. dist/server/editor - cp server/utopia-web dist/server - cp -r server/migrations/. dist/server/migrations - cp run-server-production.sh dist/server - '') - (pkgs.writeScriptBin "build-all-staging" '' - #!/usr/bin/env bash - set -e - if [ -z $GITHUB_TOKEN ] - then - echo "A GITHUB_TOKEN is required when running the full Utopia build. Please see the readme for instructions." - exit 1 - else - check-tool-versions - build-vscode-with-extension - install-editor - build-website - build-editor-staging - build-server - copy-all-to-dist-folder - fi - '') ]; withReleaseScripts = withCustomDevScripts ++ (lib.optionals includeReleaseSupport releaseScripts); @@ -719,12 +683,11 @@ let releasePackages = [ pkgs.heroku - pkgs.docker ]; pythonAndPackages = pkgs.python3.withPackages(ps: with ps; [ pyusb tkinter pkgconfig ]); - basePackages = [ pkgs.docker node pkgs.libsecret pythonAndPackages pkgs.pkg-config pkgs.tmux pkgs.git pkgs.wget ] ++ nodePackages ++ linuxOnlyPackages ++ macOSOnlyPackages; + basePackages = [ node pkgs.libsecret pythonAndPackages pkgs.pkg-config pkgs.tmux pkgs.git pkgs.wget ] ++ nodePackages ++ linuxOnlyPackages ++ macOSOnlyPackages; withServerBasePackages = basePackages ++ (lib.optionals includeServerBuildSupport baseServerPackages); withServerRunPackages = withServerBasePackages ++ (lib.optionals includeRunLocallySupport serverRunPackages); withReleasePackages = withServerRunPackages ++ (lib.optionals includeReleaseSupport releasePackages); From 7bad65a7b986ff4f8276d46bd0dbaca624892271 Mon Sep 17 00:00:00 2001 From: RheeseyB <1044774+Rheeseyb@users.noreply.github.com> Date: Fri, 2 Feb 2024 14:59:21 +0000 Subject: [PATCH 08/10] fix(vscode-build) Apparently this is how we need to use yarn --- vscode-build/shell.nix | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/vscode-build/shell.nix b/vscode-build/shell.nix index 0ea6695dbf3e..b9d740c3c02c 100644 --- a/vscode-build/shell.nix +++ b/vscode-build/shell.nix @@ -17,31 +17,31 @@ let #!/usr/bin/env bash set -e cd $(${pkgs.git}/bin/git rev-parse --show-toplevel)/vscode-build - ${yarn}/bin/yarn - ${yarn}/bin/yarn run make-patch + yarn + yarn run make-patch '') (pkgs.writeScriptBin "pull-extension-inner" '' #!/usr/bin/env bash set -e cd $(${pkgs.git}/bin/git rev-parse --show-toplevel)/vscode-build - ${yarn}/bin/yarn - ${yarn}/bin/yarn run pull-utopia-extension + yarn + yarn run pull-utopia-extension '') (pkgs.writeScriptBin "update-vscode-build-extension-inner" '' #!/usr/bin/env bash set -e build-utopia-vscode-extension cd $(${pkgs.git}/bin/git rev-parse --show-toplevel)/vscode-build - ${yarn}/bin/yarn - ${yarn}/bin/yarn run pull-utopia-extension + yarn + yarn run pull-utopia-extension '') (pkgs.writeScriptBin "build-vscode-inner" '' #!/usr/bin/env bash set -e cd $(${pkgs.git}/bin/git rev-parse --show-toplevel)/vscode-build rm -rf ./dist ./node_modules - ${yarn}/bin/yarn - ${yarn}/bin/yarn run build + yarn + yarn run build '') ]; From ed711465c365bbb8b863faeae34ad5a87c1488d2 Mon Sep 17 00:00:00 2001 From: RheeseyB <1044774+Rheeseyb@users.noreply.github.com> Date: Fri, 2 Feb 2024 15:08:57 +0000 Subject: [PATCH 09/10] fix(shell.nix) Nope, this is how we should use yarn --- shell.nix | 4 ++-- vscode-build/shell.nix | 20 ++++++++++---------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/shell.nix b/shell.nix index e9e82dda1600..06cc4c064ddd 100644 --- a/shell.nix +++ b/shell.nix @@ -15,12 +15,12 @@ let postgres = pkgs.postgresql_13; stdenv = pkgs.stdenv; pnpm = node.pkgs.pnpm; - yarn = pkgs.yarn; + yarn = pkgs.yarn.override { nodejs = node; }; nodePackages = [ node pnpm - (yarn.override { nodejs = node; }) + yarn ]; cabal = pkgs.haskellPackages.cabal-install; diff --git a/vscode-build/shell.nix b/vscode-build/shell.nix index b9d740c3c02c..8acb32e59ef8 100644 --- a/vscode-build/shell.nix +++ b/vscode-build/shell.nix @@ -4,12 +4,12 @@ let node = pkgs.nodejs-16_x; stdenv = pkgs.stdenv; pnpm = node.pkgs.pnpm; - yarn = pkgs.yarn; + yarn = pkgs.yarn.override { nodejs = node; }; nodePackages = [ node pnpm - (yarn.override { nodejs = node; }) + yarn ]; scripts = [ @@ -17,31 +17,31 @@ let #!/usr/bin/env bash set -e cd $(${pkgs.git}/bin/git rev-parse --show-toplevel)/vscode-build - yarn - yarn run make-patch + ${yarn}/bin/yarn + ${yarn}/bin/yarn run make-patch '') (pkgs.writeScriptBin "pull-extension-inner" '' #!/usr/bin/env bash set -e cd $(${pkgs.git}/bin/git rev-parse --show-toplevel)/vscode-build - yarn - yarn run pull-utopia-extension + ${yarn}/bin/yarn + ${yarn}/bin/yarn run pull-utopia-extension '') (pkgs.writeScriptBin "update-vscode-build-extension-inner" '' #!/usr/bin/env bash set -e build-utopia-vscode-extension cd $(${pkgs.git}/bin/git rev-parse --show-toplevel)/vscode-build - yarn - yarn run pull-utopia-extension + ${yarn}/bin/yarn + ${yarn}/bin/yarn run pull-utopia-extension '') (pkgs.writeScriptBin "build-vscode-inner" '' #!/usr/bin/env bash set -e cd $(${pkgs.git}/bin/git rev-parse --show-toplevel)/vscode-build rm -rf ./dist ./node_modules - yarn - yarn run build + ${yarn}/bin/yarn + ${yarn}/bin/yarn run build '') ]; From 499b99946f4fb0f17b45321ebbfe73f71199db92 Mon Sep 17 00:00:00 2001 From: RheeseyB <1044774+Rheeseyb@users.noreply.github.com> Date: Fri, 2 Feb 2024 15:16:19 +0000 Subject: [PATCH 10/10] chore(shell.nix) Include node in check-tool-versions --- shell.nix | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/shell.nix b/shell.nix index 06cc4c064ddd..b59c5db053cd 100644 --- a/shell.nix +++ b/shell.nix @@ -254,7 +254,8 @@ let expectedToolVersions :: [(String, [String], [String])] expectedToolVersions = - [ ("pnpm", ["--version"], ["7.14.2"]) + [ ("node", ["--version"], ["v18.12.1"]) + , ("pnpm", ["--version"], ["7.14.2"]) , ("yarn", ["--version"], ["1.22.19"]) , ("ghc", ["--version"], ["The Glorious Glasgow Haskell Compilation System, version 9.0.2"]) , ("cabal", ["--version"], ["cabal-install version 3.8.1.0", "compiled using version 3.8.1.0 of the Cabal library "])