Skip to content

Commit

Permalink
chore: Merge with repo-template-go (#1601)
Browse files Browse the repository at this point in the history
Signed-off-by: Ian Lewis <[email protected]>
  • Loading branch information
ianlewis authored Feb 8, 2025
1 parent 500f911 commit d85c0f5
Show file tree
Hide file tree
Showing 15 changed files with 1,153 additions and 198 deletions.
1 change: 1 addition & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Copyright 2023 Google LLC
# Copyright 2024 Ian Lewis
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
1 change: 0 additions & 1 deletion .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,3 @@ proposing them via a Pull Request. -->
- [ ] Add unit tests if applicable.
- [ ] Update documentation if applicable.
- [ ] Add a note in the [CHANGELOG.md](../blob/main/CHANGELOG.md) if applicable.
- [ ] Sign the [Google CLA](https://cla.developers.google.com/about/google-corporate).
94 changes: 63 additions & 31 deletions .github/workflows/pre-submit.units.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Copyright 2023 Google LLC
# Copyright 2024 Ian Lewis
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -29,32 +30,45 @@ jobs:
# Unit tests for Go code
######################################

unit-tests:
unit-tests-matrix:
name: unit tests
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
os:
- ubuntu-latest
- macos-latest
- windows-latest
runs-on: ${{ matrix.os }}
if: ${{ always() }}
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
- uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5.1.0
with:
go-version-file: "go.mod"
- name: unit tests
run: |
make go-test
run: make go-test
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@e28ff129e5465c2c0dcc6f003fc735cb6ae0c673 # v4.5.0
uses: codecov/codecov-action@5c47607acb93fed5485fdbf7232e8a31425f672a # v5.0.2
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage.out
fail_ci_if_error: true

# autogen for license headers
# NOTE: needed for protected branch checks.
unit-tests:
runs-on: ubuntu-latest
needs: [unit-tests-matrix]
if: ${{ always() }}
env:
UNIT_TESTS_RESULT: ${{ needs.unit-tests-matrix.result }}
steps:
- run: |
[ "${UNIT_TESTS_RESULT}" == "success" ]
# Check license headers
###############################

autogen:
license-headers:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
Expand All @@ -65,7 +79,9 @@ jobs:
path: autogen
- run: |
echo "${GITHUB_WORKSPACE}/autogen" >> "${GITHUB_PATH}"
- run: make autogen
- run: |
git config user.name "Unknown"
make license-headers
- name: check diff
run: |
set -euo pipefail
Expand All @@ -75,6 +91,31 @@ jobs:
exit 1
fi
# formatting
###############################

formatting:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4.2.0
with:
node-version-file: "package.json"
- uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0
with:
go-version-file: "go.mod"
- run: go install mvdan.cc/[email protected]
- run: go install github.com/daixiang0/[email protected]
- run: make format
- name: check diff
run: |
set -euo pipefail
if [ "$(GIT_PAGER="cat" git diff --ignore-space-at-eol | wc -l)" -gt "0" ]; then
echo "Detected formatting changes. See status below:"
GIT_PAGER="cat" git diff
exit 1
fi
# linters
###############################

Expand All @@ -84,10 +125,10 @@ jobs:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: actionlint
env:
SHELLCHECK_VERSION: "0.8.0"
SHELLCHECK_CHECKSUM: "ab6ee1b178f014d1b86d1e24da20d1139656c8b0ed34d2867fbb834dad02bf0a"
ACTIONLINT_VERSION: "1.6.24"
ACTIONLINT_CHECKSUM: "3c5818744143a5d6754edd3dcc4c2b32c9dfcdd3bb30e0e108fb5e5c505262d4"
SHELLCHECK_VERSION: "0.10.0"
SHELLCHECK_CHECKSUM: "6c881ab0698e4e6ea235245f22832860544f17ba386442fe7e9d629f8cbedf87"
ACTIONLINT_VERSION: "1.7.3"
ACTIONLINT_CHECKSUM: "37252b4d440b56374b0fc1726e05fd7452d30d6d774f6e9b52e65bb64475f9db"
run: |
set -euo pipefail
Expand Down Expand Up @@ -115,16 +156,22 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
- uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4.2.0
with:
node-version: 16
node-version-file: "package.json"
- run: make markdownlint

yamllint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- run: make yamllint

golangci-lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
- uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0
with:
go-version-file: "go.mod"
- env:
Expand All @@ -144,21 +191,6 @@ jobs:
# Run golangci-lint
make golangci-lint
yamllint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- env:
YAMLLINT_VERSION: "1.26.3"
run: |
set -euo pipefail
# Install yamllint
pip install -r requirements.txt --require-hashes
# Run yamllint
make yamllint
SUPPORTED_LANGUAGES:
runs-on: ubuntu-latest
steps:
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/schedule.issue-reopener.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Copyright 2023 Google LLC
# Copyright 2024 Ian Lewis
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -25,8 +26,10 @@ jobs:
issue-reopener:
runs-on: ubuntu-latest
permissions:
# NOTE: contents: read is necessary for private repositories.
contents: read
issues: write
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Issue Reopener
uses: ianlewis/todo-issue-reopener@9adf81abbaeceed8d6c90c106cc2a965797963cf # v1.3.0
uses: ianlewis/todo-issue-reopener@1a99cfd93fb95eb4f212a1ebaf3e9ef8ba4c46f8 # v1.4.0
45 changes: 45 additions & 0 deletions .github/workflows/schedule.stale.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Copyright 2024 Ian Lewis
#
# 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: "Close stale issues and PRs"
on:
schedule:
- cron: "30 1 * * *"

permissions: {}

jobs:
stale:
runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: write
steps:
- uses: actions/stale@5bef64f19d7facfb25b37b414482c7164d639639 # v9.1.0
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
stale-issue-message: "A friendly reminder that this issue had no activity for 120 days."
stale-pr-message: "A friendly reminder that this PR had no activity for 120 days."
stale-issue-label: "stale"
stale-pr-label: "stale"
days-before-stale: 120
days-before-close: 90
remove-stale-when-updated: true
exempt-pr-labels: "no-auto-close"
exempt-issue-labels: "no-auto-close,enhancement,good first issue,help wanted"
operations-per-run: 1000
close-issue-label: "auto-closed"
close-pr-label: "auto-closed"
close-issue-message: "This issue has been closed due to lack of activity."
close-pr-message: "This PR has been closed due to lack of activity."
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# For markdownlint.
# For markdownlint
.git

# Binaries for programs and plugins
Expand All @@ -17,6 +17,7 @@
# Dependency directories (remove the comment below to include it)
vendor/
node_modules/
.venv

# JetBrains IDEs
.idea
3 changes: 1 addition & 2 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Copyright 2023 Google LLC
# Copyright 2024 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -34,8 +35,6 @@ issues:
linters:
disable-all: true
enable:
# Some linters have been removed because of the go 1.18 issues.
# https://github.com/golangci/golangci-lint/issues/2649
- asciicheck
- contextcheck
- copyloopvar
Expand Down
7 changes: 1 addition & 6 deletions .markdownlint.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Copyright 2023 Google LLC
# Copyright 2024 Ian Lewis
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -63,9 +64,3 @@ MD047: true
# MD048/code-fence-style - Code fence style
MD048:
style: "backtick"

# Disable checks that currently have bugs:
# TODO(github.com/DavidAnson/markdownlint/issues/538): Re-enable when fixed.
MD051: false
# TODO(github.com/DavidAnson/markdownlint/issues/537): Re-enable when fixed.
MD053: false
1 change: 1 addition & 0 deletions .prettierignore
5 changes: 2 additions & 3 deletions .yamllint.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Copyright 2023 Google LLC
# Copyright 2024 Ian Lewis
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -15,9 +16,7 @@
---
extends: default

ignore: |
node_modules/
vendor/
ignore-from-file: [.gitignore]

rules:
comments:
Expand Down
8 changes: 2 additions & 6 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Changelog

All notable changes to this project will be documented in this file.
All notable changes will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
Expand All @@ -19,7 +19,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
[Powershell](https://learn.microsoft.com/en-us/powershell/).
- Support was added for [Elixir](https://elixir-lang.org/).
- Support was added for [ERB templates](https://github.com/ruby/erb).
- Support was added for [Pascal](https://en.wikipedia.org/wiki/Pascal_(programming_language)).
- Support was added for [Pascal](<https://en.wikipedia.org/wiki/Pascal_(programming_language)>).

## [0.9.0] - 2024-08-08

Expand Down Expand Up @@ -196,7 +196,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Initial release of `todos` CLI application.
- Simple support for scanning directories for TODO/FIXME/BUG/HACK/XXX comments.

[Unreleased]: https://github.com/ianlewis/todos/compare/v0.10.0...HEAD
[0.0.1]: https://github.com/ianlewis/todos/releases/tag/v0.0.1
[0.1.0]: https://github.com/ianlewis/todos/releases/tag/v0.1.0
[0.2.0]: https://github.com/ianlewis/todos/releases/tag/v0.2.0
Expand All @@ -206,8 +205,5 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
[0.6.0]: https://github.com/ianlewis/todos/releases/tag/v0.6.0
[0.7.0]: https://github.com/ianlewis/todos/releases/tag/v0.7.0
[0.8.0]: https://github.com/ianlewis/todos/releases/tag/v0.8.0
[0.9.0-rc.1]: https://github.com/ianlewis/todos/releases/tag/v0.9.0-rc.1
[0.9.0-rc.2]: https://github.com/ianlewis/todos/releases/tag/v0.9.0-rc.2
[0.9.0-rc.3]: https://github.com/ianlewis/todos/releases/tag/v0.9.0-rc.3
[0.9.0]: https://github.com/ianlewis/todos/releases/tag/v0.9.0
[0.10.0]: https://github.com/ianlewis/todos/releases/tag/v0.10.0
Loading

0 comments on commit d85c0f5

Please sign in to comment.