Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 7 additions & 9 deletions .github/workflows/build_playground_backend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ on:
push:
tags: 'v*'
pull_request:
tags: 'v*'
paths: ['playground/backend/**']
workflow_dispatch:

Expand All @@ -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
Expand All @@ -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:
Expand All @@ -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/')
Expand Down
12 changes: 7 additions & 5 deletions .github/workflows/build_playground_frontend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ on:
push:
tags: 'v*'
pull_request:
tags: 'v*'
paths: ['playground/frontend/**']
workflow_dispatch:

Expand All @@ -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
Expand All @@ -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:
Expand All @@ -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/')
Expand Down
8 changes: 2 additions & 6 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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") {
Expand Down
25 changes: 25 additions & 0 deletions playground/backend/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}

22 changes: 14 additions & 8 deletions playground/backend/env_setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 6 additions & 0 deletions playground/frontend/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,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"
Expand Down