From 84d980b6d6838f9940398c48bd088df761e14c38 Mon Sep 17 00:00:00 2001 From: Jonathan Hall Date: Thu, 2 Nov 2023 10:27:09 +0100 Subject: [PATCH 01/12] NOMERGE: disable size calculation temporarily --- .github/workflows/measure-size.yml | 51 +++++++++++++++--------------- 1 file changed, 26 insertions(+), 25 deletions(-) diff --git a/.github/workflows/measure-size.yml b/.github/workflows/measure-size.yml index d193b0df6..1c764cd0c 100644 --- a/.github/workflows/measure-size.yml +++ b/.github/workflows/measure-size.yml @@ -1,28 +1,29 @@ -name: Measure canonical app size +# Temporarily disabling this, to avoid cluttering the PR. I won't merge this commit +# name: Measure canonical app size -on: ['pull_request'] +# on: ['pull_request'] -jobs: - measure: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - uses: actions/setup-go@v2 - with: - go-version: '~1.18.10' - - uses: gopherjs/output-size-action/measure@main - with: - name: jQuery TodoMVC - repo: https://github.com/gopherjs/todomvc - go-package: github.com/gopherjs/todomvc - report_json: /tmp/report.json - report_md: /tmp/report.md - - uses: actions/upload-artifact@v2 - with: - name: size_report - path: | - /tmp/report.json - /tmp/report.md +# jobs: +# measure: +# runs-on: ubuntu-latest +# steps: +# - uses: actions/checkout@v2 +# with: +# fetch-depth: 0 +# - uses: actions/setup-go@v2 +# with: +# go-version: '~1.18.10' +# - uses: gopherjs/output-size-action/measure@main +# with: +# name: jQuery TodoMVC +# repo: https://github.com/gopherjs/todomvc +# go-package: github.com/gopherjs/todomvc +# report_json: /tmp/report.json +# report_md: /tmp/report.md +# - uses: actions/upload-artifact@v2 +# with: +# name: size_report +# path: | +# /tmp/report.json +# /tmp/report.md From 9d3c3782dda6a7104792d60b6c202d237fcd9dfa Mon Sep 17 00:00:00 2001 From: Jonathan Hall Date: Thu, 2 Nov 2023 10:01:55 +0100 Subject: [PATCH 02/12] Move tags check to GitHub Actions linter workflow --- .github/workflows/lint.yaml | 4 ++++ circle.yml | 3 --- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index 5f6c971e7..6b59fda33 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -23,3 +23,7 @@ jobs: - name: Check go.mod run: | go mod tidy && git diff --exit-code + + - name: Check natives build tags + run: | + diff -u <(echo -n) <(go list ./compiler/natives/src/...) # All those packages should have // +build js. diff --git a/circle.yml b/circle.yml index 12b0aa45f..fcb806e63 100644 --- a/circle.yml +++ b/circle.yml @@ -72,9 +72,6 @@ jobs: executor: gopherjs steps: - setup_and_install_gopherjs - - run: - name: Check natives build tags - command: diff -u <(echo -n) <(go list ./compiler/natives/src/...) # All those packages should have // +build js. - run: name: Smoke tests command: | From 707619ec3228644e8895740f129f6d07dd0e71a6 Mon Sep 17 00:00:00 2001 From: Jonathan Hall Date: Thu, 2 Nov 2023 10:08:31 +0100 Subject: [PATCH 03/12] Add smoke tests to GitHub actions --- .github/workflows/tests.yml | 71 +++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 .github/workflows/tests.yml diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 000000000..db52684ad --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,71 @@ +name: tests +on: + pull_request: +permissions: + contents: read +jobs: + tests: + name: tests + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, macos-latest, windows-latest] + + steps: + - uses: actions/setup-go@v3 + with: + go-version: "1.18.10" + - uses: actions/setup-node@v3 + with: + node-version: "12" + - name: Set up environment + if: matrix.os != 'windows-latest' + run: | + echo "SOURCE_MAP_SUPPORT=true" >> $GITHUB_ENV + # Make nodejs able to require installed modules from any working path. + echo "NODE_PATH=$(npm root)" >> $GITHUB_ENV + echo ::notice::$(go version) + echo ::notice::$(node -v) + echo ::notice::$(npm -v) + - name: Set up environment + if: matrix.os == 'windows-latest' + run: | + # Fix TEMP variable, see https://github.com/actions/runner-images/issues/712#issuecomment-613004302 + echo "TEMP=$env:USERPROFILE\AppData\Local\Temp" >> $env:GITHUB_ENV + echo "TMP=$env:USERPROFILE\AppData\Local\Temp" >> $env:GITHUB_ENV + echo "TMPDIR=$env:USERPROFILE\AppData\Local\Temp" >> $env:GITHUB_ENV + echo "NODE_PATH=$(npm root)" >> $env:GITHUB_ENV + echo "SOURCE_MAP_SUPPORT=false" >> $env:GITHUB_ENV + echo "::notice::$(npm root)" + echo "::notice::$(node -v)" + echo "::notice::$(npm -v)" + - uses: actions/checkout@v3 + - name: Install required Node.js packages + if: matrix.os == 'ubuntu-latest' + run: | + npm ci + - name: Install required Node.js packages + if: matrix.os != 'ubuntu-latest' + run: | + # Extra flags to avoid installing node-syscall. + npm install --no-optional --no-package-lock + - name: Build and Install GopherJS + run: | + go install -v + echo ::notice::$(gopherjs version) + + - name: Smoke tests + if: matrix.os == 'ubuntu-latest' + run: | + gopherjs build -v net/http + gopherjs test -v fmt log + - name: Smoke tests + if: matrix.os == 'macos-latest' + run: | + gopherjs build -v net/http + gopherjs test -v --short fmt log os ./tests + - name: Smoke tests + if: matrix.os == 'windows-latest' + run: | + gopherjs build -v net/http + gopherjs test -v --short fmt sort ./tests From 785969643a0ced42950d4fa967a1c7b153bb8901 Mon Sep 17 00:00:00 2001 From: Jonathan Hall Date: Thu, 2 Nov 2023 12:02:20 +0100 Subject: [PATCH 04/12] Remove smoke tests from Cirlce config --- circle.yml | 66 ------------------------------------------------------ 1 file changed, 66 deletions(-) diff --git a/circle.yml b/circle.yml index fcb806e63..8fe48bb5d 100644 --- a/circle.yml +++ b/circle.yml @@ -44,12 +44,6 @@ workflows: - gorepo_tests: requires: - build - - darwin_smoke: - requires: - - build - - windows_smoke: - requires: - - build parameters: go_version: @@ -72,11 +66,6 @@ jobs: executor: gopherjs steps: - setup_and_install_gopherjs - - run: - name: Smoke tests - command: | - gopherjs build -v net/http # Should build successfully. - gopherjs test -v fmt log # Should catch problems with test execution and source maps. - run: name: go test ... command: | @@ -159,61 +148,6 @@ jobs: command: | go test -v github.com/gopherjs/gopherjs/tests/gorepo - windows_smoke: - executor: - name: win/default - shell: powershell.exe - steps: - - checkout - - run: - name: Install Go - command: | - choco install golang --version="<< pipeline.parameters.go_version >>" -my - go version - (Get-Command go).Path - [Environment]::SetEnvironmentVariable( - "Path", - [Environment]::GetEnvironmentVariable("Path", [EnvironmentVariableTarget]::Machine) + ";C:\Users\circleci\go\bin", - [EnvironmentVariableTarget]::Machine) - - - install_deps: - optional: false - - run: - name: Install GopherJS - command: - go install -v . - (Get-Command gopherjs).Path - - run: - name: Test GopherJS - command: go test -v -short ./... - - run: - name: Smoke tests - command: | - $env:NODE_PATH=$(npm root) - $env:SOURCE_MAP_SUPPORT=false - gopherjs build -v net/http - gopherjs test -v --short fmt sort ./tests - - darwin_smoke: - macos: - xcode: 13.4.1 # Mac OS 12.6.1, see https://circleci.com/docs/using-macos/ - steps: - - checkout - - setup_environment - - install_deps: - optional: false - - run: - name: Install GopherJS - command: go install -v . - - run: - name: Test GopherJS - command: go test -v -short ./... - - run: - name: Smoke tests - command: | - gopherjs build -v net/http - gopherjs test -v --short fmt log os ./tests - commands: setup_environment: description: Set up Go, NVM and Node.js From b24545bc8951f75bc50114e98657825d2792262c Mon Sep 17 00:00:00 2001 From: Jonathan Hall Date: Thu, 2 Nov 2023 11:58:29 +0100 Subject: [PATCH 05/12] Add main GopherJS test suite to GHA --- .github/workflows/tests.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index db52684ad..2fe413db3 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -69,3 +69,14 @@ jobs: run: | gopherjs build -v net/http gopherjs test -v --short fmt sort ./tests + - name: go test ... + if: matrix.os != 'windows-latest' + run: | + # Run all tests except gorepo, which will be run separately in parallel. + go test -v -race $(go list ./... | grep -v github.com/gopherjs/gopherjs/tests/gorepo) + - name: go test ... + if: matrix.os == 'windows-latest' + run: | + $ErrorActionPreference = "Stop" + # Run all tests except gorepo, which will be run separately in parallel. + go test -v -race $(go list ./... | Where-Object { $_ -notmatch "github.com/gopherjs/gopherjs/tests/gorepo" }) From b0cbcf89bc1ac3b97c39a174150fb0ce582d8e51 Mon Sep 17 00:00:00 2001 From: Jonathan Hall Date: Thu, 2 Nov 2023 12:04:54 +0100 Subject: [PATCH 06/12] Friendlier names for workflows --- .github/workflows/lint.yaml | 2 +- .github/workflows/tests.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index 6b59fda33..ff1d367c9 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -1,4 +1,4 @@ -name: golangci-lint +name: Lint Checks on: pull_request: permissions: diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 2fe413db3..d23ad5c79 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -1,4 +1,4 @@ -name: tests +name: Tests on: pull_request: permissions: From 04133cf26bb702ab365d3c7968159d7038f0f489 Mon Sep 17 00:00:00 2001 From: Jonathan Hall Date: Thu, 2 Nov 2023 12:25:40 +0100 Subject: [PATCH 07/12] Remove main GopherJS tests from Cirlce config --- circle.yml | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/circle.yml b/circle.yml index 8fe48bb5d..83e23d1b4 100644 --- a/circle.yml +++ b/circle.yml @@ -66,19 +66,6 @@ jobs: executor: gopherjs steps: - setup_and_install_gopherjs - - run: - name: go test ... - command: | - set +e - # Run all tests except gorepo, which will be run separately in parallel. - go test -v -race $(go list ./... | grep -v github.com/gopherjs/gopherjs/tests/gorepo) | tee /tmp/test-go.txt - status="$?" - # Convert test output into junit format for CircleCI. - mkdir -p ~/test-reports/ - go-junit-report --full-class-name < /tmp/test-go.txt > ~/test-reports/go.xml - exit "$status" - - store_test_results: - path: ~/test-reports/ - run: name: TodoMVC in GOPATH mode command: | From 65b4b8601e181bda5a174d9382afb2f91a02dfcb Mon Sep 17 00:00:00 2001 From: Jonathan Hall Date: Thu, 2 Nov 2023 12:25:30 +0100 Subject: [PATCH 08/12] Add TodoMVC tests to GHA --- .github/workflows/tests.yml | 43 +++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index d23ad5c79..789359d6f 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -80,3 +80,46 @@ jobs: $ErrorActionPreference = "Stop" # Run all tests except gorepo, which will be run separately in parallel. go test -v -race $(go list ./... | Where-Object { $_ -notmatch "github.com/gopherjs/gopherjs/tests/gorepo" }) + - name: TodoMVC in GOPATH mode + if: matrix.os != 'windows-latest' + run: | + set -e + export GO111MODULE=off + export GOPATH=/tmp/gopath + mkdir -p $GOPATH/src/github.com/gopherjs/gopherjs + cp -r -p . $GOPATH/src/github.com/gopherjs/gopherjs/ + go get -v github.com/gopherjs/todomvc + gopherjs build -v -o /tmp/todomvc_gopath.js github.com/gopherjs/todomvc + gopherjs test -v github.com/gopherjs/todomvc/... + - name: TodoMVC in GOPATH mode + if: matrix.os == 'windows-latest' + run: | + $ErrorActionPreference = "Stop" + $env:GO111MODULE = "off" + $env:GOPATH = "C:\tmp\gopath" + $destinationPath = "$env:GOPATH\src\github.com\gopherjs\gopherjs" + if (-not (Test-Path $destinationPath)) { + New-Item -ItemType Directory -Force -Path $destinationPath + } + Copy-Item -Recurse -Path . -Destination $destinationPath + go get -v github.com/gopherjs/todomvc + gopherjs build -v -o C:\tmp\todomvc_gopath.js github.com/gopherjs/todomvc + gopherjs test -v github.com/gopherjs/todomvc/... + - name: TodoMVC in Modules mode + if: matrix.os != 'windows-latest' + run: | + set -e + cd /tmp + git clone --depth=1 https://github.com/gopherjs/todomvc.git + cd /tmp/todomvc + gopherjs build -v -o /tmp/todomvc_gomod.js github.com/gopherjs/todomvc + gopherjs test -v github.com/gopherjs/todomvc/... + - name: TodoMVC in Modules mode + if: matrix.os == 'windows-latest' + run: | + $ErrorActionPreference = "Stop" + Set-Location C:\tmp + git clone --depth=1 https://github.com/gopherjs/todomvc.git + Set-Location C:\tmp\todomvc + gopherjs build -v -o C:\tmp\todomvc_gomod.js github.com/gopherjs/todomvc + gopherjs test -v github.com/gopherjs/todomvc/... From 2b219925f52e50d514efd28680ec87a286c866f6 Mon Sep 17 00:00:00 2001 From: Jonathan Hall Date: Thu, 2 Nov 2023 13:21:04 +0100 Subject: [PATCH 09/12] Run repo tests in GHA --- .github/workflows/tests.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 789359d6f..b313a8120 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -123,3 +123,6 @@ jobs: Set-Location C:\tmp\todomvc gopherjs build -v -o C:\tmp\todomvc_gomod.js github.com/gopherjs/todomvc gopherjs test -v github.com/gopherjs/todomvc/... + - name: Go Repository tests + run: | + go test -v github.com/gopherjs/gopherjs/tests/gorepo From d12c96dc927ee34810c600d337858a6451c0cf09 Mon Sep 17 00:00:00 2001 From: Jonathan Hall Date: Thu, 2 Nov 2023 13:28:04 +0100 Subject: [PATCH 10/12] Remove go_repo tests from Cirlce config --- circle.yml | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/circle.yml b/circle.yml index 83e23d1b4..98b29b114 100644 --- a/circle.yml +++ b/circle.yml @@ -41,9 +41,6 @@ workflows: - gopherjs_tests: requires: - build - - gorepo_tests: - requires: - - build parameters: go_version: @@ -122,19 +119,6 @@ jobs: - store_test_results: path: ~/test-reports/ - gorepo_tests: - executor: gopherjs - parallelism: 4 - steps: - - setup_environment - - checkout - - install_deps - - install_gopherjs - - run: - name: Go Repository tests - command: | - go test -v github.com/gopherjs/gopherjs/tests/gorepo - commands: setup_environment: description: Set up Go, NVM and Node.js From 8c2955641e197b21a43a3ca8142153939c7b726b Mon Sep 17 00:00:00 2001 From: Jonathan Hall Date: Thu, 2 Nov 2023 13:29:56 +0100 Subject: [PATCH 11/12] Run gopherjs test ... from GHA --- .github/workflows/tests.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index b313a8120..f3d46d5d8 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -126,3 +126,13 @@ jobs: - name: Go Repository tests run: | go test -v github.com/gopherjs/gopherjs/tests/gorepo + - name: gopherjs test ... + if: matrix.os == 'ubuntu-latest' + run: | + set -e + ulimit -s 10000 + PACKAGE_NAMES=$( \ + GOOS=js GOARCH=ecmascript go list std github.com/gopherjs/gopherjs/js/... github.com/gopherjs/gopherjs/tests/... \ + | grep -v -x -f .std_test_pkg_exclusions \ + ) + gopherjs test -p 2 --minify -v --short $PACKAGE_NAMES From 7bcad62bb56bf6e419429d8837b9801074dc2fa9 Mon Sep 17 00:00:00 2001 From: Jonathan Hall Date: Thu, 2 Nov 2023 17:05:45 +0100 Subject: [PATCH 12/12] Try splitting tests --- .github/workflows/tests.yml | 47 ++++++++++++++++++++++++++++++++----- 1 file changed, 41 insertions(+), 6 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index f3d46d5d8..537923131 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -10,6 +10,15 @@ jobs: strategy: matrix: os: [ubuntu-latest, macos-latest, windows-latest] + include: + - os: ubuntu-latest + index: 0 + - os: ubuntu-latest + index: 1 + - os: ubuntu-latest + index: 2 + - os: ubuntu-latest + index: 3 steps: - uses: actions/setup-go@v3 @@ -126,13 +135,39 @@ jobs: - name: Go Repository tests run: | go test -v github.com/gopherjs/gopherjs/tests/gorepo + + - name: Download JUnit Summary from Previous Workflow + if: matrix.index + id: download-artifact + uses: dawidd6/action-download-artifact@v2 + with: + workflow_conclusion: success + name: junit-test-summary + if_no_artifact_found: warn + # Uncomment the next line before pushing to main branch, that way all branches can + # benefit from timing data once it's established there. + # branch: main + + - name: Install gotestsum + if: matrix.index + run: go install gotest.tools/gotestsum@latest + - name: Generate go test Slice + if: matrix.index + id: test_split + env: + GOOS: js + GOARCH: ecmascript + uses: hashicorp-forge/go-test-split-action@v1 + with: + total: 4 + index: ${{ matrix.index }} + packages: "std github.com/gopherjs/gopherjs/js/... github.com/gopherjs/gopherjs/tests/..." - name: gopherjs test ... - if: matrix.os == 'ubuntu-latest' + if: matrix.index run: | set -e ulimit -s 10000 - PACKAGE_NAMES=$( \ - GOOS=js GOARCH=ecmascript go list std github.com/gopherjs/gopherjs/js/... github.com/gopherjs/gopherjs/tests/... \ - | grep -v -x -f .std_test_pkg_exclusions \ - ) - gopherjs test -p 2 --minify -v --short $PACKAGE_NAMES + + PACKAGE_NAMES=$(for pkg in ${{ steps.test_split.outputs.run }}; do echo "$pkg"; done | grep -v -x -f .std_test_pkg_exclusions) + + gopherjs test -p 2 --minify -v --short "${{ steps.test_split.outputs.run }}"