Skip to content

Commit

Permalink
Migrate to Github Actions (#2700)
Browse files Browse the repository at this point in the history
  • Loading branch information
johanbrandhorst committed May 23, 2022
1 parent a094494 commit 635bbea
Show file tree
Hide file tree
Showing 18 changed files with 6,279 additions and 303 deletions.
8 changes: 0 additions & 8 deletions .circleci/README.md

This file was deleted.

229 changes: 0 additions & 229 deletions .circleci/config.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{
"name": "Go",
"build": {
"dockerfile": "../.circleci/Dockerfile",
"dockerfile": "../.github/Dockerfile",
"args": {
"NODE_VERSION": "10"
}
Expand Down
File renamed without changes.
4 changes: 4 additions & 0 deletions .github/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
### Whats up with the Dockerfile?

The `Dockerfile` in this folder is used as the build environment when regenerating the files (see CONTRIBUTING.md).
The canonical repository for this Dockerfile is `docker.pkg.github.com/grpc-ecosystem/grpc-gateway/build-env`.
145 changes: 145 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
on:
- pull_request
permissions:
contents: read
name: CI
jobs:
build:
strategy:
matrix:
go-version: [1.17.x, 1.18.x]
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go-version }}
- uses: actions/checkout@v3
- run: go build ./...
test:
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v3
with:
check-latest: true
- uses: actions/checkout@v3
- run: go test ./...
node_test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 10
- uses: actions/setup-go@v3
with:
check-latest: true
- run: >
cd examples/internal/browser &&
npm install gulp-cli &&
npm install &&
./node_modules/.bin/gulp
generate:
container:
image: docker.pkg.github.com/grpc-ecosystem/grpc-gateway/build-env:1.17
options: "--user root"
credentials:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: make install
- run: make clean
- run: make generate
- run: go mod tidy
- run: git diff --exit-code
bazel:
container:
image: docker.pkg.github.com/grpc-ecosystem/grpc-gateway/build-env:1.17
options: "--user root"
credentials:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: /home/vscode/.cache/_grpc_gateway_bazel
key: v1-bazel-cache-${{ hashFiles('repositories.bzl') }}
restore-keys: v1-bazel-cache-
- name: Configure bazel
run: |
cat > .bazelrc << EOF
startup --output_base /home/vscode/.cache/_grpc_gateway_bazel
build --test_output errors
build --features race
# Workaround https://github.com/bazelbuild/bazel/issues/3645
# See https://docs.bazel.build/versions/0.23.0/command-line-reference.html
build --local_ram_resources=7168 # Github runners have 7G of memory
build --local_cpu_resources=2 # Github runners have 2 vCPU
EOF
- name: Check that Bazel BUILD files are up-to-date
run: bazel run //:gazelle && git diff --exit-code
- name: Check that repositories.bzl is up-to-date
run: |
bazel run //:gazelle -- update-repos -from_file=go.mod -to_macro=repositories.bzl%go_repositories &&
git diff --exit-code
- name: Check formatting of Bazel BUILD files
run: bazel run //:buildifier && git diff --exit-code
- name: Run tests with Bazel
run: bazel test //...
gorelease:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
check-latest: true
- run: go run golang.org/x/exp/cmd/gorelease@latest -base=v2.10.1
proto_lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
check-latest: true
- run: make install
- run: PATH=$PATH:~/go/bin buf build
- run: PATH=$PATH:~/go/bin buf lint
- run: PATH=$PATH:~/go/bin buf format -w && git diff --exit-code
- run: PATH=$PATH:~/go/bin buf breaking --path protoc-gen-openapiv2/ --against 'https://github.com/grpc-ecosystem/grpc-gateway.git#branch=master'
golangci:
permissions:
pull-requests: read # for golangci/golangci-lint-action to fetch pull requests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: golangci/golangci-lint-action@v2
with:
version: v1.45
args: --enable goimports
fuzz:
runs-on: ubuntu-latest
steps:
- name: Build Fuzzers
id: build
uses: google/oss-fuzz/infra/cifuzz/actions/build_fuzzers@master
with:
oss-fuzz-project-name: "grpc-gateway"
dry-run: false
language: go
- name: Run Fuzzers
uses: google/oss-fuzz/infra/cifuzz/actions/run_fuzzers@master
with:
oss-fuzz-project-name: "grpc-gateway"
fuzz-seconds: 600
dry-run: false
language: go
- name: Upload Crash
uses: actions/upload-artifact@v1
if: failure() && steps.build.outcome == 'success'
with:
name: artifacts
path: ./out/artifacts

0 comments on commit 635bbea

Please sign in to comment.