You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beam.apache.org by pa...@apache.org on 2021/11/23 16:02:48 UTC
[beam] branch master updated: Merge pull request #16016 from [BEAM-13089][Playground] Enable playgroundPrecommit to run on GitHub Actions for pull requests
This is an automated email from the ASF dual-hosted git repository.
pabloem pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/beam.git
The following commit(s) were added to refs/heads/master by this push:
new a7ee0ea Merge pull request #16016 from [BEAM-13089][Playground] Enable playgroundPrecommit to run on GitHub Actions for pull requests
a7ee0ea is described below
commit a7ee0ea66bda5659f31299d41bae074c52d58306
Author: Sergey Kalinin <91...@users.noreply.github.com>
AuthorDate: Tue Nov 23 18:59:54 2021 +0300
Merge pull request #16016 from [BEAM-13089][Playground] Enable playgroundPrecommit to run on GitHub Actions for pull requests
* [Playground][BEAM-12941][Bugfix] Fix workflows for playground applications (#83)
* Update workflows for playground
* Attempt to fix tests
* Remove continue on error to catch errors
* Fix linter problem for backend dockerfile
* Update folder to run backend go linter
* Moved flutter test to execution via gradle tasks
* Revert "[Playground][BEAM-12941][Bugfix] Fix workflows for playground applications (#83)" (#88)
This reverts commit b73f5f70ac4184b56a0a03922731c5f2f69b9566.
* Create precommit tasks for backend and frontend, replaced separate tests in actions to running precommit
* Added linter to preCommit, updated install terraform via github actions
* Fix typos and install of terraform
Co-authored-by: Ilya <il...@akvelon.com>
Co-authored-by: Aydar Zainutdinov <ay...@akvelon.com>
---
.github/workflows/build_playground_backend.yml | 16 +++++++---------
.github/workflows/build_playground_frontend.yml | 12 +++++++-----
build.gradle.kts | 8 ++------
playground/backend/build.gradle.kts | 25 +++++++++++++++++++++++++
playground/backend/env_setup.sh | 22 ++++++++++++++--------
playground/frontend/build.gradle | 6 ++++++
6 files changed, 61 insertions(+), 28 deletions(-)
diff --git a/.github/workflows/build_playground_backend.yml b/.github/workflows/build_playground_backend.yml
index bd28687..48eab26 100644
--- a/.github/workflows/build_playground_backend.yml
+++ b/.github/workflows/build_playground_backend.yml
@@ -19,7 +19,6 @@ on:
push:
tags: 'v*'
pull_request:
- tags: 'v*'
paths: ['playground/backend/**']
workflow_dispatch:
@@ -30,6 +29,7 @@ jobs:
env:
GO_VERSION: 1.17.0
BEAM_VERSION: 2.33.0
+ TERRAFORM_VERSION: 1.0.9
steps:
- name: Check out the repo
uses: actions/checkout@v2
@@ -40,17 +40,11 @@ jobs:
- uses: actions/setup-go@v2
with:
go-version: '${{ env.GO_VERSION }}'
- - name: Prepare Go lint env
- run: "sudo ./playground/backend/env_setup.sh"
- - name: Run Lint
-# run: "golangci-lint run internal/..."
- run: "golangci-lint run cmd/server/..."
- working-directory: playground/backend/
- name: Remove default github maven configuration
# This step is a workaround to avoid a decryption issue
run: rm ~/.m2/settings.xml
- - name: Run Tests
- run: ./gradlew playground:backend:test
+ - name: Run PreCommit
+ run: ./gradlew playground:backend:precommit
- name: install npm
uses: actions/setup-node@v2
with:
@@ -60,6 +54,10 @@ jobs:
- name: lint dockerfile
run: dockerlint Dockerfile
working-directory: playground/backend/containers/java
+ - uses: hashicorp/setup-terraform@v1
+ with:
+ terraform_version: ${{ env.TERRAFORM_VERSION }}
+ if: startsWith(github.ref, 'ref/tags/')
- name: Setup GCP account
run: echo ${{ secrets.GCP_ACCESS_KEY }} | base64 -d > /tmp/gcp_access.json
if: startsWith(github.ref, 'ref/tags/')
diff --git a/.github/workflows/build_playground_frontend.yml b/.github/workflows/build_playground_frontend.yml
index f93e330..ee1bed8 100644
--- a/.github/workflows/build_playground_frontend.yml
+++ b/.github/workflows/build_playground_frontend.yml
@@ -19,7 +19,6 @@ on:
push:
tags: 'v*'
pull_request:
- tags: 'v*'
paths: ['playground/frontend/**']
workflow_dispatch:
@@ -30,6 +29,7 @@ jobs:
env:
GO_VERSION: 1.17.0
BEAM_VERSION: 2.33.0
+ TERRAFORM_VERSION: 1.0.9
steps:
- name: Check out the repo
uses: actions/checkout@v2
@@ -41,10 +41,8 @@ jobs:
uses: subosito/flutter-action@v1
with:
channel: 'stable'
- - name: Run Lint
- run: ./gradlew playground:frontend:analyze
- - name: Run Tests
- run: ./gradlew playground:frontend:test
+ - name: Run PreCommit
+ run: ./gradlew playground:frontend:precommit
- name: install npm
uses: actions/setup-node@v2
with:
@@ -54,6 +52,10 @@ jobs:
- name: lint dockerfile
run: dockerlint Dockerfile
working-directory: playground/frontend
+ - uses: hashicorp/setup-terraform@v1
+ with:
+ terraform_version: ${{ env.TERRAFORM_VERSION }}
+ if: startsWith(github.ref, 'ref/tags/')
- name: Setup GCP account
run: echo ${{ secrets.GCP_ACCESS_KEY }} | base64 -d > /tmp/gcp_access.json
if: startsWith(github.ref, 'ref/tags/')
diff --git a/build.gradle.kts b/build.gradle.kts
index 2502915..37e0164 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -248,12 +248,8 @@ task("goIntegrationTests") {
}
task("playgroundPreCommit") {
- dependsOn(":playground:backend:tidy")
- dependsOn(":playground:backend:test")
-
- dependsOn(":playground:frontend:pubGet")
- dependsOn(":playground:frontend:analyze")
- dependsOn(":playground:frontend:test")
+ dependsOn(":playground:backend:precommit")
+ dependsOn(":playground:frontend:precommit")
}
task("pythonPreCommit") {
diff --git a/playground/backend/build.gradle.kts b/playground/backend/build.gradle.kts
index 0547b7c..e73b00e 100644
--- a/playground/backend/build.gradle.kts
+++ b/playground/backend/build.gradle.kts
@@ -50,3 +50,28 @@ task("test") {
}
}
}
+
+task("installLinter") {
+ doLast {
+ exec {
+ executable("sh")
+ args("env_setup.sh")
+ }
+ }
+}
+
+task("runLint") {
+ dependsOn(":playground:backend:installLinter")
+ doLast {
+ exec {
+ executable("golangci-lint")
+ args("run", "cmd/server/...")
+ }
+ }
+}
+task("precommit") {
+ dependsOn(":playground:backend:runLint")
+ dependsOn(":playground:backend:tidy")
+ dependsOn(":playground:backend:test")
+}
+
diff --git a/playground/backend/env_setup.sh b/playground/backend/env_setup.sh
index f12af69..1b87b31 100755
--- a/playground/backend/env_setup.sh
+++ b/playground/backend/env_setup.sh
@@ -17,12 +17,18 @@
GO_LINTER_VERSION=1.42.1
# Install GO Linter
-wget https://github.com/golangci/golangci-lint/releases/download/v1.42.1/golangci-lint-$GO_LINTER_VERSION-linux-amd64.deb
-dpkg -i golangci-lint-$GO_LINTER_VERSION-linux-amd64.deb
+#wget https://github.com/golangci/golangci-lint/releases/download/v1.42.1/golangci-lint-$GO_LINTER_VERSION-linux-amd64.deb
+#dpkg -i golangci-lint-$GO_LINTER_VERSION-linux-amd64.deb
-# Install Terraform
-apt-get install -y gnupg software-properties-common curl
-curl -fsSL https://apt.releases.hashicorp.com/gpg | apt-key add -
-apt-add-repository "deb [arch=amd64] https://apt.releases.hashicorp.com $(lsb_release -cs) main"
-apt-get update
-apt-get install -y terraform
+kernelname=$(uname -s)
+
+# Running on Linux
+if [ "$kernelname" = "Linux" ]; then
+ curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v$GO_LINTER_VERSION
+
+# Running on Mac
+elif [ "$kernelname" = "Darwin" ]; then
+ brew tap golangci/tap
+ brew install golangci/tap/golangci-lint
+else echo "Unrecognized Kernel Name: $kernelname"
+fi
diff --git a/playground/frontend/build.gradle b/playground/frontend/build.gradle
index 7491fc2..608487d 100644
--- a/playground/frontend/build.gradle
+++ b/playground/frontend/build.gradle
@@ -94,6 +94,12 @@ task test {
}
}
+task precommit {
+ dependsOn(":playground:frontend:pubGet")
+ dependsOn(":playground:frontend:analyze")
+ dependsOn(":playground:frontend:test")
+}
+
task copyDockerfileDependencies(type: Copy) {
group = "build"
description = "Copy files that required to build docker container"