|
| 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 |
0 commit comments