Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 1982b78

Browse files
Merge branch 'master' of github.com:gopherjs/gopherjs into bumpMaster3
2 parents 1cf45be + 8c15d1d commit 1982b78

File tree

8 files changed

+305
-332
lines changed

8 files changed

+305
-332
lines changed
+74
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: Setup GopherJS
2+
description: Sets up Go, Node.js, and GopherJS
3+
4+
inputs:
5+
includeSyscall:
6+
description: Indicates that the node-syscall package should be installed.
7+
required: true
8+
default: 'false'
9+
10+
fixTemps:
11+
description: Indicates that the Windows Temp variables should be fixed.
12+
required: true
13+
default: 'false'
14+
15+
runs:
16+
using: composite
17+
steps:
18+
- name: Fix Windows Temp Variables
19+
if: inputs.fixTemps == 'true'
20+
shell: pwsh
21+
run: |
22+
# see https://github.com/actions/runner-images/issues/712#issuecomment-613004302
23+
echo "TEMP=$env:USERPROFILE\AppData\Local\Temp" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8
24+
echo "TMP=$env:USERPROFILE\AppData\Local\Temp" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8
25+
echo "TMPDIR=$env:USERPROFILE\AppData\Local\Temp" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8
26+
27+
- name: Setup Go
28+
uses: actions/setup-go@v5
29+
with:
30+
go-version: ${{ env.GO_VERSION }}
31+
32+
- name: Setup Go Environment
33+
working-directory: ${{ env.GOPHERJS_PATH }}
34+
shell: bash
35+
run: echo "GOROOT=$(go env GOROOT)" >> $GITHUB_ENV
36+
37+
- name: Setup Node.js
38+
uses: actions/setup-node@v4
39+
with:
40+
node-version: ${{ env.NODE_VERSION }}
41+
42+
- name: Install Node.js for non-Linux
43+
if: inputs.includeSyscall != 'true'
44+
working-directory: ${{ env.GOPHERJS_PATH }}
45+
shell: bash
46+
# Install required Node.js packages without optional (node-syscall).
47+
run: npm install --omit=optional --no-package-lock
48+
49+
- name: Install Node.js for Linux
50+
if: inputs.includeSyscall == 'true'
51+
working-directory: ${{ env.GOPHERJS_PATH }}
52+
shell: bash
53+
# Install required Node.js packages including optional (node-syscall).
54+
run: |
55+
npm install --include=optional --no-package-lock
56+
57+
- name: Setup Node.js Environment
58+
working-directory: ${{ env.GOPHERJS_PATH }}
59+
shell: bash
60+
# Make nodejs able to require installed modules from any working path.
61+
run: echo "NODE_PATH=$(npm root)" >> $GITHUB_ENV
62+
63+
- name: Install GopherJS
64+
working-directory: ${{ env.GOPHERJS_PATH }}
65+
shell: bash
66+
run: go install -v
67+
68+
- name: Setup information
69+
shell: bash
70+
run: |
71+
echo ::notice::go version: $(go version)
72+
echo ::notice::node version: $(node -v)
73+
echo ::notice::npm version: $(npm -v)
74+
echo ::notice::gopherjs version: $(gopherjs version)

.github/workflows/ci.yaml

+221
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,221 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ "*" ]
6+
pull_request:
7+
branches: [ "*" ]
8+
9+
permissions:
10+
contents: read
11+
12+
concurrency:
13+
group: ci-${{ github.ref }}
14+
cancel-in-progress: true
15+
16+
env:
17+
GO_VERSION: 1.19.13
18+
NODE_VERSION: 12
19+
GOLANGCI_VERSION: v1.53.3
20+
GOPHERJS_EXPERIMENT: generics
21+
SOURCE_MAP_SUPPORT: true
22+
GOPATH: ${{ github.workspace }}/go
23+
GOPHERJS_PATH: ${{ github.workspace }}/go/src/github.com/${{ github.repository }}
24+
25+
jobs:
26+
ubuntu_smoke:
27+
name: Ubuntu Smoke
28+
runs-on: ubuntu-latest
29+
steps:
30+
- uses: actions/checkout@v4
31+
with:
32+
path: ${{ env.GOPHERJS_PATH }}
33+
- name: Copy Actions
34+
run: cp -r ${{ env.GOPHERJS_PATH }}/.github .
35+
- name: Setup GopherJS
36+
uses: ./.github/actions/setup-gopherjs/
37+
with:
38+
includeSyscall: 'true'
39+
- name: Test GopherJS
40+
working-directory: ${{ env.GOPHERJS_PATH }}
41+
run: go test -v -short ./...
42+
- name: Run Tests
43+
working-directory: ${{ env.GOPHERJS_PATH }}
44+
run: |
45+
gopherjs build -v net/http
46+
gopherjs test -v --short fmt log ./tests
47+
48+
windows_smoke:
49+
name: Window Smoke
50+
runs-on: windows-latest
51+
env:
52+
# Windows does not support source maps.
53+
SOURCE_MAP_SUPPORT: false
54+
steps:
55+
- uses: actions/checkout@v4
56+
with:
57+
path: ${{ env.GOPHERJS_PATH }}
58+
- name: Copy Actions
59+
run: cp -r ${{ env.GOPHERJS_PATH }}/.github .
60+
- name: Setup GopherJS
61+
uses: ./.github/actions/setup-gopherjs/
62+
with:
63+
fixTemps: 'true'
64+
- name: Test GopherJS
65+
working-directory: ${{ env.GOPHERJS_PATH }}
66+
run: go test -v -short ./...
67+
- name: Run Tests
68+
working-directory: ${{ env.GOPHERJS_PATH }}
69+
run: |
70+
gopherjs build -v net/http
71+
gopherjs test -v --short fmt sort ./tests
72+
73+
darwin_smoke:
74+
name: Darwin Smoke
75+
runs-on: macos-latest
76+
env:
77+
# Node version '12' is not found for darwin.
78+
NODE_VERSION: 20
79+
steps:
80+
- uses: actions/checkout@v4
81+
with:
82+
path: ${{ env.GOPHERJS_PATH }}
83+
- name: Copy Actions
84+
run: cp -r ${{ env.GOPHERJS_PATH }}/.github .
85+
- name: Setup GopherJS
86+
uses: ./.github/actions/setup-gopherjs/
87+
- name: Test GopherJS
88+
working-directory: ${{ env.GOPHERJS_PATH }}
89+
run: go test -v -short ./...
90+
- name: Run Tests
91+
working-directory: ${{ env.GOPHERJS_PATH }}
92+
run: |
93+
gopherjs build -v net/http
94+
gopherjs test -v --short fmt log os ./tests
95+
96+
lint:
97+
name: Lint Checks
98+
runs-on: ubuntu-latest
99+
steps:
100+
- uses: actions/checkout@v4
101+
with:
102+
path: ${{ env.GOPHERJS_PATH }}
103+
- uses: actions/setup-go@v5
104+
with:
105+
go-version: ${{ env.GO_VERSION }}
106+
- name: Install golangci-lint
107+
uses: golangci/golangci-lint-action@v3
108+
with:
109+
working-directory: ${{ env.GOPHERJS_PATH }}
110+
version: ${{ env.GOLANGCI_VERSION }}
111+
only-new-issues: true
112+
- name: Check go.mod
113+
working-directory: ${{ env.GOPHERJS_PATH }}
114+
run: go mod tidy && git diff --exit-code
115+
- name: Check natives build tags
116+
working-directory: ${{ env.GOPHERJS_PATH }}
117+
# All those packages should have // +build js.
118+
run: diff -u <(echo -n) <(go list ./compiler/natives/src/...)
119+
120+
go_tests:
121+
name: Go Tests
122+
runs-on: ubuntu-latest
123+
steps:
124+
- uses: actions/checkout@v4
125+
with:
126+
path: ${{ env.GOPHERJS_PATH }}
127+
- name: Copy Actions
128+
run: cp -r ${{ env.GOPHERJS_PATH }}/.github .
129+
- name: Setup GopherJS
130+
uses: ./.github/actions/setup-gopherjs/
131+
- name: Run Tests
132+
working-directory: ${{ env.GOPHERJS_PATH }}
133+
# Run all tests except gorepo tests.
134+
run: go test -v -race $(go list ./... | grep -v github.com/gopherjs/gopherjs/tests/gorepo)
135+
136+
todomvc_check:
137+
name: TodoMVC GO111MODULE Check
138+
runs-on: ubuntu-latest
139+
steps:
140+
- uses: actions/checkout@v4
141+
with:
142+
path: ${{ env.GOPHERJS_PATH }}
143+
- name: Copy Actions
144+
run: cp -r ${{ env.GOPHERJS_PATH }}/.github .
145+
- name: Setup GopherJS
146+
uses: ./.github/actions/setup-gopherjs/
147+
- name: TodoMVC in GOPATH mode
148+
working-directory: ${{ env.GOPHERJS_PATH }}
149+
env:
150+
GO111MODULE: off
151+
GOPATH: /tmp/gopath
152+
run: |
153+
mkdir -p $GOPATH/src/github.com/gopherjs/gopherjs
154+
cp -r -p ${{ env.GOPHERJS_PATH }}/. $GOPATH/src/github.com/gopherjs/gopherjs/
155+
go get -v github.com/gopherjs/todomvc
156+
gopherjs build -v -o /tmp/todomvc_gopath.js github.com/gopherjs/todomvc
157+
gopherjs test -v github.com/gopherjs/todomvc/...
158+
find $GOPATH
159+
- name: TodoMVC in Go Modules mode
160+
env:
161+
GO111MODULE: on
162+
GOPATH: /tmp/gmod
163+
run: |
164+
mkdir -p $GOPATH/src
165+
cd /tmp
166+
git clone --depth=1 https://github.com/gopherjs/todomvc.git
167+
cd /tmp/todomvc
168+
gopherjs build -v -o /tmp/todomvc_gomod.js github.com/gopherjs/todomvc
169+
gopherjs test -v github.com/gopherjs/todomvc/...
170+
find $GOPATH
171+
- name: Compare GOPATH and Go Modules output
172+
run: |
173+
diff -u \
174+
<(sed 's/todomvc_gomod.js.map/todomvc_ignored.js.map/' /tmp/todomvc_gomod.js) \
175+
<(sed 's/todomvc_gopath.js.map/todomvc_ignored.js.map/' /tmp/todomvc_gopath.js)
176+
177+
gopherjs_tests:
178+
name: GopherJS Tests (${{ matrix.filter.name }})
179+
runs-on: ubuntu-latest
180+
strategy:
181+
fail-fast: false
182+
matrix:
183+
filter:
184+
- name: non-crypto
185+
pattern: '-Pve "^crypto"'
186+
- name: cypto
187+
pattern: '-Pe "^crypto"'
188+
steps:
189+
- uses: actions/checkout@v4
190+
with:
191+
path: ${{ env.GOPHERJS_PATH }}
192+
- name: Copy Actions
193+
run: cp -r ${{ env.GOPHERJS_PATH }}/.github .
194+
- name: Setup GopherJS
195+
uses: ./.github/actions/setup-gopherjs/
196+
- name: Run GopherJS tests
197+
working-directory: ${{ env.GOPHERJS_PATH }}
198+
run: |
199+
PACKAGE_NAMES=$( \
200+
GOOS=js GOARCH=wasm go list std github.com/gopherjs/gopherjs/js/... github.com/gopherjs/gopherjs/tests/... \
201+
| grep -v -x -f .std_test_pkg_exclusions \
202+
| grep ${{ matrix.filter.pattern }} \
203+
)
204+
echo "Running tests for packages:"
205+
echo "$PACKAGE_NAMES"
206+
gopherjs test -p 4 --minify -v --short $PACKAGE_NAMES
207+
208+
gorepo_tests:
209+
name: Gorepo Tests
210+
runs-on: ubuntu-latest
211+
steps:
212+
- uses: actions/checkout@v4
213+
with:
214+
path: ${{ env.GOPHERJS_PATH }}
215+
- name: Copy Actions
216+
run: cp -r ${{ env.GOPHERJS_PATH }}/.github .
217+
- name: Setup GopherJS
218+
uses: ./.github/actions/setup-gopherjs/
219+
- name: Run GopherJS tests
220+
working-directory: ${{ env.GOPHERJS_PATH }}
221+
run: go test -v github.com/gopherjs/gopherjs/tests/gorepo

.github/workflows/lint.yaml

-25
This file was deleted.

.github/workflows/measure-size.yml

+7-5
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,29 @@ name: Measure canonical app size
22

33
on: ['pull_request']
44

5+
env:
6+
GO_VERSION: '~1.19.13'
7+
58
jobs:
69
measure:
710
runs-on: ubuntu-latest
811
steps:
9-
- uses: actions/checkout@v2
12+
- uses: actions/checkout@v4
1013
with:
1114
fetch-depth: 0
12-
- uses: actions/setup-go@v2
15+
- uses: actions/setup-go@v5
1316
with:
14-
go-version: '~1.20.14'
17+
go-version: ${{ env.GO_VERSION }}
1518
- uses: gopherjs/output-size-action/measure@main
1619
with:
1720
name: jQuery TodoMVC
1821
repo: https://github.com/gopherjs/todomvc
1922
go-package: github.com/gopherjs/todomvc
2023
report_json: /tmp/report.json
2124
report_md: /tmp/report.md
22-
- uses: actions/upload-artifact@v2
25+
- uses: actions/upload-artifact@v4
2326
with:
2427
name: size_report
2528
path: |
2629
/tmp/report.json
2730
/tmp/report.md
28-

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
[![GoDoc](https://godoc.org/github.com/gopherjs/gopherjs/js?status.svg)](https://godoc.org/github.com/gopherjs/gopherjs/js)
44
[![Sourcegraph](https://sourcegraph.com/github.com/gopherjs/gopherjs/-/badge.svg)](https://sourcegraph.com/github.com/gopherjs/gopherjs?badge)
5-
[![Circle CI](https://circleci.com/gh/gopherjs/gopherjs.svg?style=svg)](https://circleci.com/gh/gopherjs/gopherjs)
5+
[![Github Actions CI](https://github.com/gopherjs/gopherjs/actions/workflows/ci.yaml/badge.svg)](https://github.com/gopherjs/gopherjs/actions/workflows/ci.yaml)
66

77
GopherJS compiles Go code ([go.dev](https://go.dev/)) to pure JavaScript code. Its main purpose is to give you the opportunity to write front-end code in Go which will still run in all browsers.
88

0 commit comments

Comments
 (0)