-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat!: break mono-package into individual packages (#1000)
- Loading branch information
1 parent
405c91b
commit 5151c5e
Showing
109 changed files
with
1,435 additions
and
5,892 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
name: Find Changed Go Packages | ||
description: Finds the changed Go packages in a PR | ||
|
||
outputs: | ||
changedGoPackages: | ||
description: 'The changed Go packages' | ||
value: ${{ steps.changedGoPackages.outputs.changedGoPackages }} | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- uses: dorny/[email protected] | ||
id: filter | ||
with: | ||
initial-fetch-depth: '1' | ||
list-files: json | ||
filters: | | ||
changed: | ||
- added|modified: '**' | ||
- uses: actions/github-script@v6 | ||
id: changedGoPackages | ||
with: | ||
script: | | ||
const path = require("path") | ||
const fs = require("fs") | ||
const changedFiles = ${{ steps.filter.outputs.changed_files }} | ||
const changedDirs = changedFiles.map(f => path.dirname(f)) | ||
const changedGoPackages = changedDirs.filter(d => fs.existsSync(path.join(d, "go.mod"))) | ||
const uniqueChangedGoPackages = [...new Set(changedGoPackages)]; | ||
console.log(`Found the following changed Go packages: ${JSON.stringify(uniqueChangedGoPackages, null, 2)}\n OG: ${JSON.stringify(changedFiles, null, 2)} `) | ||
core.setOutput("changedGoPackages", uniqueChangedGoPackages) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
version: 2 | ||
updates: | ||
- package-ecosystem: gomod | ||
directory: "/" | ||
schedule: | ||
interval: weekly | ||
open-pull-requests-limit: 10 | ||
- package-ecosystem: gomod | ||
directory: "/" | ||
schedule: | ||
interval: weekly | ||
open-pull-requests-limit: 10 | ||
commit-message: | ||
prefix: "chore: " |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,68 @@ | ||
on: push | ||
on: | ||
- pull_request | ||
|
||
name: CI | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
run: | ||
runs-on: ubuntu-latest | ||
find-changed-packages: | ||
runs-on: [ARM64, self-hosted, Linux] | ||
outputs: | ||
changedPackages: ${{ steps.changedGoPackages.outputs.changedGoPackages }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Find Changed Go Packages | ||
id: changedGoPackages | ||
uses: ./.github/actions/find-changed-packages | ||
|
||
run-lint: | ||
runs-on: [ARM64, self-hosted, Linux] | ||
needs: find-changed-packages | ||
if: ${{ needs.find-changed-packages.outputs.changedPackages != '[]' }} | ||
strategy: | ||
matrix: | ||
gopkg: ${{ fromJson(needs.find-changed-packages.outputs.changedPackages) }} | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-go@v5 | ||
with: | ||
go-version-file: ${{ matrix.gopkg }}/go.mod | ||
- name: Run golangci-lint | ||
uses: reviewdog/action-golangci-lint@v2 | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
go_version_file: ${{ matrix.gopkg }}/go.mod | ||
level: info | ||
reporter: github-pr-review | ||
golangci_lint_flags: "--config=../.golangci.yml --out-format=line-number -v --timeout 5m" | ||
workdir: ${{ matrix.gopkg }} | ||
|
||
run-tests: | ||
runs-on: [ARM64, self-hosted, Linux] | ||
needs: find-changed-packages | ||
if: ${{ needs.find-changed-packages.outputs.changedPackages != '[]' }} | ||
strategy: | ||
matrix: | ||
target: | ||
- check-mod | ||
- lint-ci | ||
- test-ci | ||
gopkg: ${{ fromJson(needs.find-changed-packages.outputs.changedPackages) }} | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-go@v3 | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-go@v5 | ||
with: | ||
go-version-file: go.mod | ||
- name: Install dependencies | ||
run: make setup | ||
|
||
- name: make ${{ matrix.target }} | ||
env: | ||
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: make ${{ matrix.target }} | ||
go-version-file: ${{ matrix.gopkg }}/go.mod | ||
- name: Run tests | ||
run: make test-ci | ||
working-directory: ${{ matrix.gopkg }} | ||
|
||
# this job exists to give us something to make a required check on that will ensure all CI runs are complete | ||
run-ci-complete: | ||
runs-on: [ARM64, self-hosted, Linux] | ||
needs: | ||
- run-tests | ||
- run-lint | ||
steps: | ||
- run: echo "CI runs complete" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Validates PR title follows conventional commits | ||
name: conventional-commits | ||
on: | ||
pull_request: | ||
branches: main | ||
types: | ||
- edited | ||
- opened | ||
- synchronize | ||
- reopened | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
jobs: | ||
conventional_commit_title: | ||
runs-on: [ARM64, self-hosted, Linux] | ||
steps: | ||
- uses: chanzuckerberg/github-actions/.github/actions/[email protected] |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
on: | ||
- pull_request | ||
|
||
name: Update go.mod | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
find-changed-packages: | ||
runs-on: [ARM64, self-hosted, Linux] | ||
outputs: | ||
changedPackages: ${{ steps.changedGoPackages.outputs.changedGoPackages }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Find Changed Go Packages | ||
id: changedGoPackages | ||
uses: ./.github/actions/find-changed-packages | ||
|
||
update-go-mod: | ||
runs-on: [ARM64, self-hosted, Linux] | ||
needs: find-changed-packages | ||
strategy: | ||
matrix: | ||
gopkg: ${{ fromJson(needs.find-changed-packages.outputs.changedPackages) }} | ||
if: ${{ needs.find-changed-packages.outputs.changedPackages != '[]' }} | ||
outputs: | ||
updated_go_mod: ${{ steps.commit_go_mod.outputs.committed }} | ||
steps: | ||
- name: Generate token | ||
id: generate_token | ||
uses: chanzuckerberg/[email protected] | ||
with: | ||
app_id: ${{ secrets.CZI_GITHUB_HELPER_APP_ID }} | ||
private_key: ${{ secrets.CZI_GITHUB_HELPER_PK }} | ||
- uses: actions/checkout@v4 | ||
with: | ||
token: ${{ steps.generate_token.outputs.token }} | ||
ref: ${{ github.event.pull_request.head.ref }} | ||
- uses: actions/setup-go@v5 | ||
with: | ||
go-version-file: ${{ matrix.gopkg }}/go.mod | ||
cache: true | ||
- name: Update go.mod | ||
run: go mod tidy | ||
working-directory: ${{ matrix.gopkg }} | ||
- uses: EndBug/add-and-commit@v9 | ||
id: commit_go_mod | ||
with: | ||
add: -A | ||
message: ci - update ${{ matrix.gopkg }}/go.mod | ||
|
||
# this job exists to give us something to make a required check on that will ensure all go.mod updates are complete | ||
go-mod-updates-complete: | ||
runs-on: [ARM64, self-hosted, Linux] | ||
needs: update-go-mod | ||
steps: | ||
- run: echo "Go mod updates complete" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,44 @@ | ||
linters: | ||
enable: | ||
- asciicheck | ||
- bodyclose | ||
- deadcode | ||
- dupl | ||
- depguard | ||
- errcheck | ||
- exportloopref | ||
- goconst | ||
- gocyclo | ||
- errorlint | ||
- forbidigo | ||
- gci | ||
- gofmt | ||
- goimports | ||
- golint | ||
- gosec | ||
- interfacer | ||
- megacheck | ||
- misspell | ||
- nlreturn | ||
- nolintlint | ||
- rowserrcheck | ||
- scopelint | ||
- sqlclosecheck | ||
- structcheck | ||
- unconvert | ||
- unparam | ||
- varcheck | ||
- gosimple | ||
- govet | ||
- ineffassign | ||
- staticcheck | ||
- typecheck | ||
- unused | ||
- whitespace | ||
- wsl | ||
|
||
linters-settings: | ||
forbidigo: | ||
# These are forbidden in non-test files | ||
# If you have mock functions,etc that are meant to be used in tests please add them here | ||
forbid: | ||
- ^fmt\.Print.*$ | ||
- ^spew\.Dump$ | ||
- ^println$ | ||
depguard: | ||
rules: | ||
main: | ||
deny: | ||
- pkg: gopkg.in/yaml.v2 | ||
desc: please use gopkg.in/yaml.v3 instead | ||
- pkg: github.com/pkg/errors | ||
desc: please use errors from the standard library instead | ||
- pkg: golang.org/x/xerrors | ||
desc: please use errors from the standard library instead | ||
- pkg: github.com/sirupsen/logrus | ||
desc: please use log/slog from the standard library instead | ||
|
||
issues: | ||
exclude-rules: | ||
# Exclude some linters from running on tests files. | ||
- path: _test\.go | ||
linters: | ||
- forbidigo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,16 @@ | ||
{".":"1.12.0"} | ||
{ | ||
".": "1.12.0", | ||
"aws": "1.12.0", | ||
"config": "1.12.0", | ||
"errors": "1.12.0", | ||
"keypair": "1.12.0", | ||
"kmsauth": "1.12.0", | ||
"oidc_cli": "1.12.0", | ||
"osutil": "1.12.0", | ||
"pidlock": "1.12.0", | ||
"sets": "1.12.0", | ||
"slack": "1.12.0", | ||
"snowflake": "1.12.0", | ||
"survey": "1.12.0", | ||
"ver": "1.12.0" | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
|
||
include ../scripts/common.mk | ||
|
||
generate-mocks: ## will generate mocks | ||
go install github.com/golang/mock/[email protected] | ||
go get -u github.com/aws/aws-sdk-go/... | ||
go get -u github.com/aws/aws-sdk-go-v2/... | ||
rm -rf aws/mocks/* | ||
cd aws; go generate | ||
go mod tidy | ||
.PHONY: generate-mocks |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
module github.com/chanzuckerberg/go-misc/aws | ||
|
||
go 1.21 | ||
|
||
toolchain go1.21.1 | ||
|
||
require ( | ||
github.com/aws/aws-sdk-go v1.50.23 | ||
github.com/golang/mock v1.6.0 | ||
github.com/pkg/errors v0.9.1 | ||
) | ||
|
||
require ( | ||
github.com/davecgh/go-spew v1.1.1 // indirect | ||
github.com/jmespath/go-jmespath v0.4.0 // indirect | ||
golang.org/x/net v0.21.0 // indirect | ||
gopkg.in/yaml.v2 v2.4.0 // indirect | ||
) |
Oops, something went wrong.