From 1d3a8ebdf8a38b3fdecd5bc821041f17feb4705b Mon Sep 17 00:00:00 2001 From: mclacore Date: Fri, 4 Oct 2024 09:52:41 -0700 Subject: [PATCH] Adding workflow files from mass CLI, + codeowners --- .github/CODEOWNERS | 2 ++ .github/workflows/lint.yaml | 26 ++++++++++++++++++++++++++ .github/workflows/pre-commit.yaml | 19 +++++++++++++++++++ .github/workflows/test.yaml | 21 +++++++++++++++++++++ 4 files changed, 68 insertions(+) create mode 100644 .github/CODEOWNERS create mode 100644 .github/workflows/lint.yaml create mode 100644 .github/workflows/pre-commit.yaml create mode 100644 .github/workflows/test.yaml diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 0000000..a0ba85d --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1,2 @@ +* @chrisghill +* @mclacore diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml new file mode 100644 index 0000000..2ba2ba3 --- /dev/null +++ b/.github/workflows/lint.yaml @@ -0,0 +1,26 @@ +# adapted from https://github.com/golangci/golangci-lint-action +name: golangci-lint + +on: + push: + branches: [main] + pull_request: + branches: [main] +permissions: + contents: read + # Optional: allow read access to pull request. Use with `only-new-issues` option. + pull-requests: read +jobs: + golangci: + name: lint + runs-on: ubuntu-latest + steps: + - uses: actions/setup-go@v5 + with: + go-version: 1.22 + - uses: actions/checkout@v4 + - name: golangci-lint + uses: golangci/golangci-lint-action@v3 + with: + # Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version + version: v1.56.2 diff --git a/.github/workflows/pre-commit.yaml b/.github/workflows/pre-commit.yaml new file mode 100644 index 0000000..2d840ea --- /dev/null +++ b/.github/workflows/pre-commit.yaml @@ -0,0 +1,19 @@ +name: pre-commit + +on: + pull_request: + push: + branches: [main] + +jobs: + pre-commit: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v2 + - uses: pre-commit/action@v2.0.3 + env: + # this check prevents devs from commit to main. + # however, we don't want it to fail on commits to main in CI. + # we use the golangci-lint gh action in lint.yaml because it generates useful comments. + SKIP: no-commit-to-branch,golangci-lint diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml new file mode 100644 index 0000000..d385681 --- /dev/null +++ b/.github/workflows/test.yaml @@ -0,0 +1,21 @@ +name: Test + +on: + push: + branches: [main] + pull_request: + branches: [main] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version: 1.22 + - name: Build + run: go build -v ./... + - name: Test + run: go test -v ./...