* Enable aetest tests
* Fix v2/aefix to work with appengine/v2
* Update Contributing docs
This commit is contained in:
Kayla Nguyen 2021-08-13 16:25:29 -07:00 коммит произвёл GitHub
Родитель d0e56bde7a
Коммит cefb82f5c0
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
6 изменённых файлов: 133 добавлений и 18 удалений

94
.github/workflows/ci-v2.yaml поставляемый Normal file
Просмотреть файл

@ -0,0 +1,94 @@
name: ci-v2
on:
push:
branches: [ master, qa ]
pull_request:
branches: [ master, qa ]
jobs:
test-gomod-v2:
runs-on: ubuntu-latest
strategy:
matrix:
go-version: [ '1.11.x', '1.12.x', '1.13.x', '1.14.x', '1.15.x']
env:
working-directory: ./v2
steps:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}
- name: Checkout
uses: actions/checkout@v2
- name: Cache go modules
uses: actions/cache@v2
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-${{ matrix.go-version }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-${{ matrix.go-version }}-go-
- name: Set up Cloud SDK
uses: google-github-actions/setup-gcloud@master
- name: Install
working-directory: ${{env.working-directory}}
env:
GO111MODULE: on
run: |
go get .
gcloud components install app-engine-python app-engine-go cloud-datastore-emulator --quiet
- name: Test gomod v2
env:
GO111MODULE: on
working-directory: ${{env.working-directory}}
run: |
export APPENGINE_DEV_APPSERVER=$(which dev_appserver.py)
go test -v -cover -race google.golang.org/appengine/v2/...
# TestAPICallAllocations doesn't run under race detector.
go test -v -cover google.golang.org/appengine/v2/internal/... -run TestAPICallAllocations
test-gopath-v2:
runs-on: ubuntu-latest
strategy:
matrix:
# GOPATH is deprecated in go 1.13.
go-version: [ '1.11.x', '1.12.x']
env:
working-directory: ./v2
steps:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}
- name: Checkout
uses: actions/checkout@v2
- name: Cache go modules
uses: actions/cache@v2
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-${{ matrix.go-version }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-${{ matrix.go-version }}-go-
- name: Set up Cloud SDK
uses: google-github-actions/setup-gcloud@master
- name: Install
working-directory: ${{env.working-directory}}
env:
GO111MODULE: off
run: |
go get -u -v $(go list -f '{{join .Imports "\n"}}{{"\n"}}{{join .TestImports "\n"}}' ./... | sort | uniq | grep -v appengine)
go get -u google.golang.org/appengine/v2
gcloud components install app-engine-python app-engine-go cloud-datastore-emulator --quiet
- name: Test gopath v2
working-directory: ${{env.working-directory}}
run: |
export APPENGINE_DEV_APPSERVER=$(which dev_appserver.py)
go test -v -cover -race google.golang.org/appengine/v2/...
# TestAPICallAllocations doesn't run under race detector.
go test -v -cover google.golang.org/appengine/v2/internal/... -run TestAPICallAllocations

35
.github/workflows/ci.yml поставляемый
Просмотреть файл

@ -12,11 +12,14 @@ jobs:
strategy: strategy:
matrix: matrix:
go-version: [ '1.11.x', '1.12.x', '1.13.x', '1.14.x', '1.15.x'] go-version: [ '1.11.x', '1.12.x', '1.13.x', '1.14.x', '1.15.x']
steps: steps:
- name: Set up Go - name: Set up Go
uses: actions/setup-go@v2 uses: actions/setup-go@v2
with: with:
go-version: ${{ matrix.go-version }} go-version: ${{ matrix.go-version }}
- name: Checkout
uses: actions/checkout@v2
- name: Cache go modules - name: Cache go modules
uses: actions/cache@v2 uses: actions/cache@v2
with: with:
@ -26,22 +29,30 @@ jobs:
key: ${{ runner.os }}-${{ matrix.go-version }}-go-${{ hashFiles('**/go.sum') }} key: ${{ runner.os }}-${{ matrix.go-version }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: | restore-keys: |
${{ runner.os }}-${{ matrix.go-version }}-go- ${{ runner.os }}-${{ matrix.go-version }}-go-
- name: Checkout - name: Set up Cloud SDK
uses: actions/checkout@v2 uses: google-github-actions/setup-gcloud@master
- name: Install - name: Install
env: env:
GO111MODULE: on GO111MODULE: on
run: | run: |
go get . go get .
gcloud components install app-engine-python app-engine-go cloud-datastore-emulator --quiet
- name: Test gomod - name: Test gomod
env:
GO111MODULE: on
run: | run: |
go test -v -race google.golang.org/appengine/... export APPENGINE_DEV_APPSERVER=$(which dev_appserver.py)
go test -v -cover -race google.golang.org/appengine/...
# TestAPICallAllocations doesn't run under race detector.
go test -v -cover google.golang.org/appengine/internal/... -run TestAPICallAllocations
test-gopath: test-gopath:
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy: strategy:
matrix: matrix:
# GOPATH is deprecated in go 1.13. # GOPATH is deprecated in go 1.13.
go-version: [ '1.11.x', '1.12.x'] go-version: [ '1.11.x', '1.12.x']
steps: steps:
- name: Set up Go - name: Set up Go
uses: actions/setup-go@v2 uses: actions/setup-go@v2
@ -49,11 +60,27 @@ jobs:
go-version: ${{ matrix.go-version }} go-version: ${{ matrix.go-version }}
- name: Checkout - name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v2
- name: Cache go modules
uses: actions/cache@v2
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-${{ matrix.go-version }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-${{ matrix.go-version }}-go-
- name: Set up Cloud SDK
uses: google-github-actions/setup-gcloud@master
- name: Install - name: Install
env: env:
GO111MODULE: off GO111MODULE: off
run: | run: |
go get -u -v $(go list -f '{{join .Imports "\n"}}{{"\n"}}{{join .TestImports "\n"}}' ./... | sort | uniq | grep -v appengine) go get -u -v $(go list -f '{{join .Imports "\n"}}{{"\n"}}{{join .TestImports "\n"}}' ./... | sort | uniq | grep -v appengine)
go get -u google.golang.org/appengine
gcloud components install app-engine-python app-engine-go cloud-datastore-emulator --quiet
- name: Test gopath - name: Test gopath
run: | run: |
go test -v -race google.golang.org/appengine/... export APPENGINE_DEV_APPSERVER=$(which dev_appserver.py)
go test -v -cover -race google.golang.org/appengine/...
# TestAPICallAllocations doesn't run under race detector.
go test -v -cover google.golang.org/appengine/internal/... -run TestAPICallAllocations

Просмотреть файл

@ -19,14 +19,12 @@
## Running system tests ## Running system tests
Download and install the [Go App Engine SDK](https://cloud.google.com/appengine/docs/go/download). Make sure the `go_appengine` dir is in your `PATH`.
Set the `APPENGINE_DEV_APPSERVER` environment variable to `/path/to/go_appengine/dev_appserver.py`. Set the `APPENGINE_DEV_APPSERVER` environment variable to `/path/to/go_appengine/dev_appserver.py`.
Run tests with `goapp test`: Run tests with `go test`:
``` ```
goapp test -v google.golang.org/appengine/... go test -v google.golang.org/appengine/...
``` ```
## Contributor License Agreements ## Contributor License Agreements

Просмотреть файл

@ -19,14 +19,12 @@
## Running system tests ## Running system tests
Download and install the [Go App Engine SDK](https://cloud.google.com/appengine/docs/go/download). Make sure the `go_appengine` dir is in your `PATH`.
Set the `APPENGINE_DEV_APPSERVER` environment variable to `/path/to/go_appengine/dev_appserver.py`. Set the `APPENGINE_DEV_APPSERVER` environment variable to `/path/to/go_appengine/dev_appserver.py`.
Run tests with `goapp test`: Run tests with `go test`:
``` ```
goapp test -v google.golang.org/appengine/... go test -v google.golang.org/appengine/v2/...
``` ```
## Contributor License Agreements ## Contributor License Agreements

Просмотреть файл

@ -6,7 +6,6 @@ package main
import ( import (
"go/ast" "go/ast"
"path"
"strconv" "strconv"
"strings" "strings"
) )
@ -15,7 +14,6 @@ const (
ctxPackage = "golang.org/x/net/context" ctxPackage = "golang.org/x/net/context"
newPackageBase = "google.golang.org/" newPackageBase = "google.golang.org/"
stutterPackage = false
) )
func init() { func init() {
@ -38,10 +36,7 @@ var logMethod = map[string]bool{
// mapPackage turns "appengine" into "google.golang.org/appengine/v2", etc. // mapPackage turns "appengine" into "google.golang.org/appengine/v2", etc.
func mapPackage(s string) string { func mapPackage(s string) string {
if stutterPackage { return newPackageBase + strings.Replace(s, "appengine", "appengine/v2", 1)
s += "/" + path.Base(s)
}
return newPackageBase + s
} }
func aeFn(f *ast.File) bool { func aeFn(f *ast.File) bool {

Просмотреть файл

@ -718,6 +718,9 @@ func usesImport(f *ast.File, path string) (used bool) {
case "<nil>": case "<nil>":
// If the package name is not explicitly specified, // If the package name is not explicitly specified,
// make an educated guess. This is not guaranteed to be correct. // make an educated guess. This is not guaranteed to be correct.
if strings.HasSuffix(path, "/v2") {
path = strings.TrimRight(path, "/v2")
}
lastSlash := strings.LastIndex(path, "/") lastSlash := strings.LastIndex(path, "/")
if lastSlash == -1 { if lastSlash == -1 {
name = path name = path