-
Notifications
You must be signed in to change notification settings - Fork 570
Another attempt to move tests from CircleCI to GitHub Actions #1317
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
name: Setup GopherJS | ||
description: Sets up Go, Node.js, and GopherJS | ||
|
||
inputs: | ||
includeSyscall: | ||
description: Indicates that the node-syscall package should be installed. | ||
required: true | ||
default: 'false' | ||
|
||
fixTemps: | ||
description: Indicates that the Windows Temp variables should be fixed. | ||
required: true | ||
default: 'false' | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- name: Fix Windows Temp Variables | ||
if: inputs.fixTemps == 'true' | ||
shell: pwsh | ||
run: | | ||
# see https://github.com/actions/runner-images/issues/712#issuecomment-613004302 | ||
echo "TEMP=$env:USERPROFILE\AppData\Local\Temp" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8 | ||
echo "TMP=$env:USERPROFILE\AppData\Local\Temp" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8 | ||
echo "TMPDIR=$env:USERPROFILE\AppData\Local\Temp" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8 | ||
|
||
- name: Setup Go | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: ${{ env.GO_VERSION }} | ||
|
||
- name: Setup Go Environment | ||
working-directory: ${{ env.GOPHERJS_PATH }} | ||
shell: bash | ||
run: echo "GOROOT=$(go env GOROOT)" >> $GITHUB_ENV | ||
|
||
- name: Setup Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: ${{ env.NODE_VERSION }} | ||
|
||
- name: Install Node.js for non-Linux | ||
if: inputs.includeSyscall != 'true' | ||
working-directory: ${{ env.GOPHERJS_PATH }} | ||
shell: bash | ||
# Install required Node.js packages without optional (node-syscall). | ||
run: npm install --omit=optional --no-package-lock | ||
|
||
- name: Install Node.js for Linux | ||
if: inputs.includeSyscall == 'true' | ||
working-directory: ${{ env.GOPHERJS_PATH }} | ||
shell: bash | ||
# Install required Node.js packages including optional (node-syscall). | ||
run: | | ||
npm install --include=optional --no-package-lock | ||
|
||
- name: Setup Node.js Environment | ||
working-directory: ${{ env.GOPHERJS_PATH }} | ||
shell: bash | ||
# Make nodejs able to require installed modules from any working path. | ||
run: echo "NODE_PATH=$(npm root)" >> $GITHUB_ENV | ||
|
||
- name: Install GopherJS | ||
working-directory: ${{ env.GOPHERJS_PATH }} | ||
shell: bash | ||
run: go install -v | ||
|
||
- name: Setup information | ||
shell: bash | ||
run: | | ||
echo ::notice::go version: $(go version) | ||
echo ::notice::node version: $(node -v) | ||
echo ::notice::npm version: $(npm -v) | ||
echo ::notice::gopherjs version: $(gopherjs version) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,221 @@ | ||
name: CI | ||
flimzy marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
on: | ||
push: | ||
branches: [ "*" ] | ||
pull_request: | ||
branches: [ "*" ] | ||
|
||
permissions: | ||
contents: read | ||
|
||
concurrency: | ||
group: ci-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
env: | ||
GO_VERSION: 1.19.13 | ||
NODE_VERSION: 12 | ||
GOLANGCI_VERSION: v1.53.3 | ||
GOPHERJS_EXPERIMENT: generics | ||
SOURCE_MAP_SUPPORT: true | ||
GOPATH: ${{ github.workspace }}/go | ||
GOPHERJS_PATH: ${{ github.workspace }}/go/src/github.com/${{ github.repository }} | ||
|
||
jobs: | ||
ubuntu_smoke: | ||
name: Ubuntu Smoke | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
path: ${{ env.GOPHERJS_PATH }} | ||
- name: Copy Actions | ||
run: cp -r ${{ env.GOPHERJS_PATH }}/.github . | ||
- name: Setup GopherJS | ||
uses: ./.github/actions/setup-gopherjs/ | ||
with: | ||
includeSyscall: 'true' | ||
- name: Test GopherJS | ||
working-directory: ${{ env.GOPHERJS_PATH }} | ||
run: go test -v -short ./... | ||
- name: Run Tests | ||
working-directory: ${{ env.GOPHERJS_PATH }} | ||
run: | | ||
gopherjs build -v net/http | ||
gopherjs test -v --short fmt log ./tests | ||
|
||
windows_smoke: | ||
name: Window Smoke | ||
runs-on: windows-latest | ||
env: | ||
# Windows does not support source maps. | ||
SOURCE_MAP_SUPPORT: false | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
path: ${{ env.GOPHERJS_PATH }} | ||
- name: Copy Actions | ||
run: cp -r ${{ env.GOPHERJS_PATH }}/.github . | ||
- name: Setup GopherJS | ||
uses: ./.github/actions/setup-gopherjs/ | ||
with: | ||
fixTemps: 'true' | ||
- name: Test GopherJS | ||
working-directory: ${{ env.GOPHERJS_PATH }} | ||
run: go test -v -short ./... | ||
- name: Run Tests | ||
working-directory: ${{ env.GOPHERJS_PATH }} | ||
run: | | ||
gopherjs build -v net/http | ||
gopherjs test -v --short fmt sort ./tests | ||
|
||
darwin_smoke: | ||
name: Darwin Smoke | ||
runs-on: macos-latest | ||
env: | ||
# Node version '12' is not found for darwin. | ||
NODE_VERSION: 20 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
path: ${{ env.GOPHERJS_PATH }} | ||
- name: Copy Actions | ||
run: cp -r ${{ env.GOPHERJS_PATH }}/.github . | ||
- name: Setup GopherJS | ||
uses: ./.github/actions/setup-gopherjs/ | ||
- name: Test GopherJS | ||
working-directory: ${{ env.GOPHERJS_PATH }} | ||
run: go test -v -short ./... | ||
- name: Run Tests | ||
working-directory: ${{ env.GOPHERJS_PATH }} | ||
run: | | ||
gopherjs build -v net/http | ||
gopherjs test -v --short fmt log os ./tests | ||
|
||
lint: | ||
name: Lint Checks | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
path: ${{ env.GOPHERJS_PATH }} | ||
- uses: actions/setup-go@v5 | ||
with: | ||
go-version: ${{ env.GO_VERSION }} | ||
- name: Install golangci-lint | ||
uses: golangci/golangci-lint-action@v3 | ||
with: | ||
working-directory: ${{ env.GOPHERJS_PATH }} | ||
version: ${{ env.GOLANGCI_VERSION }} | ||
only-new-issues: true | ||
- name: Check go.mod | ||
working-directory: ${{ env.GOPHERJS_PATH }} | ||
run: go mod tidy && git diff --exit-code | ||
- name: Check natives build tags | ||
working-directory: ${{ env.GOPHERJS_PATH }} | ||
# All those packages should have // +build js. | ||
run: diff -u <(echo -n) <(go list ./compiler/natives/src/...) | ||
|
||
go_tests: | ||
name: Go Tests | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
path: ${{ env.GOPHERJS_PATH }} | ||
- name: Copy Actions | ||
run: cp -r ${{ env.GOPHERJS_PATH }}/.github . | ||
- name: Setup GopherJS | ||
uses: ./.github/actions/setup-gopherjs/ | ||
- name: Run Tests | ||
working-directory: ${{ env.GOPHERJS_PATH }} | ||
# Run all tests except gorepo tests. | ||
run: go test -v -race $(go list ./... | grep -v github.com/gopherjs/gopherjs/tests/gorepo) | ||
|
||
todomvc_check: | ||
name: TodoMVC GO111MODULE Check | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
path: ${{ env.GOPHERJS_PATH }} | ||
- name: Copy Actions | ||
run: cp -r ${{ env.GOPHERJS_PATH }}/.github . | ||
- name: Setup GopherJS | ||
uses: ./.github/actions/setup-gopherjs/ | ||
- name: TodoMVC in GOPATH mode | ||
working-directory: ${{ env.GOPHERJS_PATH }} | ||
env: | ||
GO111MODULE: off | ||
GOPATH: /tmp/gopath | ||
run: | | ||
mkdir -p $GOPATH/src/github.com/gopherjs/gopherjs | ||
cp -r -p ${{ env.GOPHERJS_PATH }}/. $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/... | ||
find $GOPATH | ||
- name: TodoMVC in Go Modules mode | ||
env: | ||
GO111MODULE: on | ||
GOPATH: /tmp/gmod | ||
run: | | ||
mkdir -p $GOPATH/src | ||
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/... | ||
find $GOPATH | ||
- name: Compare GOPATH and Go Modules output | ||
run: | | ||
diff -u \ | ||
<(sed 's/todomvc_gomod.js.map/todomvc_ignored.js.map/' /tmp/todomvc_gomod.js) \ | ||
<(sed 's/todomvc_gopath.js.map/todomvc_ignored.js.map/' /tmp/todomvc_gopath.js) | ||
|
||
gopherjs_tests: | ||
name: GopherJS Tests (${{ matrix.filter.name }}) | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
filter: | ||
- name: non-crypto | ||
pattern: '-Pve "^crypto"' | ||
- name: cypto | ||
pattern: '-Pe "^crypto"' | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
path: ${{ env.GOPHERJS_PATH }} | ||
- name: Copy Actions | ||
run: cp -r ${{ env.GOPHERJS_PATH }}/.github . | ||
- name: Setup GopherJS | ||
uses: ./.github/actions/setup-gopherjs/ | ||
- name: Run GopherJS tests | ||
working-directory: ${{ env.GOPHERJS_PATH }} | ||
run: | | ||
PACKAGE_NAMES=$( \ | ||
GOOS=js GOARCH=wasm go list std github.com/gopherjs/gopherjs/js/... github.com/gopherjs/gopherjs/tests/... \ | ||
| grep -v -x -f .std_test_pkg_exclusions \ | ||
| grep ${{ matrix.filter.pattern }} \ | ||
) | ||
echo "Running tests for packages:" | ||
echo "$PACKAGE_NAMES" | ||
gopherjs test -p 4 --minify -v --short $PACKAGE_NAMES | ||
|
||
gorepo_tests: | ||
name: Gorepo Tests | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
path: ${{ env.GOPHERJS_PATH }} | ||
- name: Copy Actions | ||
run: cp -r ${{ env.GOPHERJS_PATH }}/.github . | ||
- name: Setup GopherJS | ||
uses: ./.github/actions/setup-gopherjs/ | ||
- name: Run GopherJS tests | ||
working-directory: ${{ env.GOPHERJS_PATH }} | ||
run: go test -v github.com/gopherjs/gopherjs/tests/gorepo |
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.