Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add static checks #218

Merged
merged 2 commits into from
Jan 15, 2021
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
4 changes: 4 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Diff operations cannot be performed on these files

*.min.js binary
*.min.css binary
27 changes: 26 additions & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
# Copyright 2020 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

---
name: CI Build
on:
Expand All @@ -8,11 +22,22 @@ on:

jobs:
docker:
name: "Build app"
name: Build app
runs-on: ubuntu-latest
steps:
- name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )"
uses: actions/checkout@v2

- name: Build image
run: docker build --tag=tp .

statics:
name: Static Checks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v1
- uses: actions/setup-go@v2-beta
with:
go-version: 1.15.1
- uses: pre-commit/[email protected]
101 changes: 101 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
# Copyright 2020 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
---
default_stages: [commit, push]
minimum_pre_commit_version: "1.20.0"
repos:
- repo: https://github.com/Lucas-C/pre-commit-hooks
rev: v1.1.9
hooks:
- id: insert-license
name: Add license for all shell files
exclude: ^third_party
files: \.sh$|\.sh.tmpl$|\.bash$
args:
- --comment-style
- "|#|"
- --license-filepath
- license-templates/LICENSE.txt
- --fuzzy-match-generates-todo
- id: insert-license
name: Add license for all yaml files
exclude: ^third_party
files: \.yaml$|\.yml$
args:
- --comment-style
- "|#|"
- --license-filepath
- license-templates/LICENSE.txt
- --fuzzy-match-generates-todo
- id: insert-license
name: Add license for all go files
exclude: ^third_party
files: \.go$
args:
- --comment-style
- "|//|"
- --license-filepath
- license-templates/LICENSE.txt
- --fuzzy-match-generates-todo
- repo: git://github.com/dnephin/pre-commit-golang
rev: master
hooks:
- id: go-fmt
name: Run go fmt
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.2.0
hooks:
- id: trailing-whitespace
- id: detect-private-key
- id: end-of-file-fixer
- id: check-merge-conflict
- id: mixed-line-ending
- repo: https://github.com/thlorenz/doctoc.git
rev: v1.4.0
hooks:
- id: doctoc
name: Add TOC for md files
files: \.md$
args:
- "--maxlevel"
- "3"
- "--title"
- "**Table of Contents**"
- repo: https://github.com/adrienverge/yamllint
rev: v1.23.0
hooks:
- id: yamllint
name: Check yaml files with yamllint
entry: yamllint -c yamllint-config.yml
types: [yaml]
- repo: local
hooks:
- id: language-matters
language: pygrep
name: Check for language that we do not accept as community
description: Please use "deny_list" or "allow_list" instead.
entry: "(?i)(black|white)[_-]?(list|List)"
pass_filenames: true
- id: hadolint
name: Hadolint
description: Haskell-based Docker image linter
language: docker_image
files: Dockerfile.*
entry: --entrypoint /bin/hadolint hadolint/hadolint:latest -
- id: shellcheck
name: Check Shell scripts syntax correctness
language: docker_image
entry: koalaman/shellcheck:stable -x -a
files: .*\.sh
exclude: ^third_party
22 changes: 22 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,27 @@

# Release Notes

<!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
**Table of Contents**

- [Version 1.3.0 - 2020-08-24](#version-130---2020-08-24)
- [Version 1.2.1 - 2020-07-17](#version-121---2020-07-17)
- [Version 1.2.0 - 2020-07-14](#version-120---2020-07-14)
- [Version 1.2.0-beta.3 - 2020-06-19](#version-120-beta3---2020-06-19)
- [Version 1.2.0-beta.2 - 2020-06-17](#version-120-beta2---2020-06-17)
- [Version 1.2.0-beta.1 - 2020-06-10](#version-120-beta1---2020-06-10)
- [Version 1.1.0 - 2020-05-19](#version-110---2020-05-19)
- [Version 1.0.0 - 2020-05-13](#version-100---2020-05-13)
- [Version 1.0.0-beta.4 - 2020-05-11](#version-100-beta4---2020-05-11)
- [Version 1.0.0-beta.3 - 2020-05-06](#version-100-beta3---2020-05-06)
- [Version 1.0.0-beta.2 - 2020-05-05](#version-100-beta2---2020-05-05)
- [Version 1.0.0-beta.1 - 2020-04-27](#version-100-beta1---2020-04-27)
- [Version v2020-04-22.1 - 2020-04-22](#version-v2020-04-221---2020-04-22)
- [Version v2020-04-22.0 - 2020-04-22](#version-v2020-04-220---2020-04-22)

<!-- END doctoc generated TOC please keep comment here to allow auto update -->

## Version 1.3.0 - 2020-08-24

* Defer comment tags until all data is fetched, use cached metadata when available [#207](https://github.com/google/triage-party/pull/207)
Expand Down
38 changes: 38 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
**Table of Contents**

- [How to Contribute](#how-to-contribute)
- [Contributor License Agreement](#contributor-license-agreement)
- [Code reviews](#code-reviews)
- [Community Guidelines](#community-guidelines)
- [Static checks](#static-checks)

<!-- END doctoc generated TOC please keep comment here to allow auto update -->

# How to Contribute

We'd love to accept your patches and contributions to this project. There are
Expand Down Expand Up @@ -26,3 +38,29 @@ information on using pull requests.

This project follows [Google's Open Source Community
Guidelines](https://opensource.google.com/conduct/).

## Static checks

This project is using [pre-commits](https://pre-commit.com) to ensure the quality of the code.
We encourage you to use pre-commits, but it's not a required to contribute. Every change is checked
on CI and if it does not pass the tests it cannot be accepted. If you want to check locally then
you should install Python3.6 or newer together and run:
```bash
pip install pre-commit
# or
brew install pre-commit
```
For more installation options visit the [pre-commits](https://pre-commit.com).

To turn on pre-commit checks for commit operations in git, run:
```bash
pre-commit install
```
To run all checks on your staged files, run:
```bash
pre-commit run
```
To run all checks on all files, run:
```bash
pre-commit run --all-files
```
15 changes: 8 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
# using "base.Dockerfile"

# Stage 1: Build Triage Party (identical to base.Dockerfile)
FROM golang AS builder
FROM golang:1.15.2-buster AS builder
WORKDIR /app
ENV SRC_DIR=/src/tparty
ENV GO111MODULE=on
Expand All @@ -37,14 +37,15 @@ RUN go mod download
RUN go build cmd/server/main.go

# Stage 2: Copy local persistent cache into temp container containing "mv"
FROM alpine AS temp
FROM alpine:3.12.0 AS temp
ARG CFG=config/config.yaml
COPY pcache /pc
RUN echo "Pre-populating cache if found (failure is perfectly OK)"
RUN mv /pc/$(basename $CFG).pc /config.yaml.pc || touch /config.yaml.pc
RUN mv "/pc/$(basename "${CFG}").pc" /config.yaml.pc || touch /config.yaml.pc

# Stage 3: Build the configured application container
FROM gcr.io/distroless/base AS triage-party
# hadolint ignore=DL3007
FROM gcr.io/distroless/base:latest AS triage-party
ARG CFG=config/config.yaml
COPY --from=builder /src/tparty/main /app/
COPY --from=temp /config.yaml.pc /app/pcache/config.yaml.pc
Expand All @@ -53,13 +54,13 @@ COPY third_party /app/third_party/
COPY $CFG /app/config/config.yaml

# Useful environment variables:
#
#
# * GITHUB_TOKEN: Sets GitHub API token
# * CONFIG_PATH: Sets configuration path (defaults to "/app/config/config.yaml")
# * PORT: Sets HTTP listening port (defaults to 8080)
# * PERSIST_BACKEND: Set the cache persistence backend
# * PERSIST_PATH: Set the cache persistence path
#
#
# For other environment variables, see:
# https://github.com/google/triage-party/blob/master/docs/deploy.md
CMD ["/app/main", "--min-refresh=30s", "--max-refresh=8m", "--site=/app/site", "--3p=/app/third_party"]
CMD ["/app/main", "--min-refresh=30s", "--max-refresh=8m", "--site=/app/site", "--3p=/app/third_party"]
Empty file added LICENSE.txt
Empty file.
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,22 @@ Triage Party focuses on reducing response latency for incoming GitHub issues and

Triage Party is configured via YAML, and designed for projects to self-host on anything from a Raspberry Pi, Google Cloud Run, or Kubernetes.

<!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
**Table of Contents**

- [Novel Features](#novel-features)
- [Triage Party in production](#triage-party-in-production)
- [Requirements](#requirements)
- [Try it](#try-it)
- [Usage Tips](#usage-tips)
- [Multi-player mode](#multi-player-mode)
- [Kanban mode (NEW)](#kanban-mode-new)
- [Data freshness](#data-freshness)
- [Documentation](#documentation)

<!-- END doctoc generated TOC please keep comment here to allow auto update -->

## Novel Features

* Multiplayer mode: Up to 20 simultaneous players in group triage
Expand Down
1 change: 0 additions & 1 deletion SECURITY_CONTACTS
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
# Defined below are the security contacts for this repo.
tstromberg

30 changes: 22 additions & 8 deletions cloudbuild.yaml
Original file line number Diff line number Diff line change
@@ -1,15 +1,29 @@
# Copyright 2020 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
---
steps:
- name: gcr.io/cloud-builders/docker
args: [
"build",
"-t", "gcr.io/$PROJECT_ID/$_REPO_NAME:$_TAG_NAME",
"-f", "Dockerfile",
".",
]
- name: gcr.io/cloud-builders/docker
args: [
"build",
"-t", "gcr.io/$PROJECT_ID/$_REPO_NAME:$_TAG_NAME",
"-f", "Dockerfile",
".",
]

substitutions:
_REPO_NAME: triage-party
_TAG_NAME: latest

images:
- 'gcr.io/$PROJECT_ID/$_REPO_NAME:$_TAG_NAME'
- 'gcr.io/$PROJECT_ID/$_REPO_NAME:$_TAG_NAME'
4 changes: 2 additions & 2 deletions cmd/server/main.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// Copyright 2020 Google LLC
// Copyright 2020 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
Expand Down
4 changes: 2 additions & 2 deletions cmd/tester/main.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// Copyright 2020 Google LLC
// Copyright 2020 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
Expand Down
Loading