-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revamp Github CI/CD and Integration Testing (#446)
Summary: Make a variety of updates to simplify maintenance of our codebase after the fbcode migration: * Remove redundant Golang hooks - we have `go vet`, `golangci-lint` etc provided internally * Move non-Python, non-shell linters and checks out of the pre-commit hook. * Remove mage - we no longer need it now that dependency load has been reduced and integration tests have been simplified * Remove containers - we delegate containerization to `act` The payoffs of this refactor are: * **Much lower maintenance overhead** - dependabot's builtin security features can handle security updates for our actions ([source](https://docs.github.com/en/code-security/dependabot/dependabot-security-updates/about-dependabot-security-updates)) so we no longer need renovate to make PRs. We'll only update when we need to. - `act` takes care of any required containerization * Streamlined developer onboarding - just install Golang, only install other tools if needed. * Faster CI/CD runs - many actions that previously ran in serial now run in parallel * Improved consistency - we used to have many different Golang versions scattered around the project. They can now be unified in a single action. Pull Request resolved: #446 Reviewed By: cedowens Differential Revision: D51518892 Pulled By: d3sch41n fbshipit-source-id: ea5310743c14e5e450e5d63ef0a09ee8ddad32e5
- Loading branch information
1 parent
f8e6ffc
commit b79573f
Showing
36 changed files
with
125 additions
and
2,118 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
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,30 @@ | ||
--- | ||
name: go-licenses | ||
on: | ||
pull_request: | ||
types: | ||
- opened | ||
- synchronize | ||
jobs: | ||
licenses: | ||
name: run go-licenses against this project's dependencies | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout Git repository | ||
uses: actions/checkout@v4 | ||
- name: Setup Build Environment | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: "1.21" | ||
- name: Install go-licenses | ||
run: go install github.com/google/go-licenses@latest | ||
- name: Run go-licenses | ||
run: | | ||
output=$(go-licenses check ./... 2> /dev/null) | ||
if [[ "${output}" == *"ERROR: forbidden license found"* ]]; then | ||
echo "Forbidden licenses found. Please remove them." | ||
exit 1 | ||
else | ||
echo "No forbidden licenses found." | ||
fi | ||
shell: bash |
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 @@ | ||
--- | ||
name: markdownlint | ||
on: | ||
pull_request: | ||
types: | ||
- opened | ||
- synchronize | ||
jobs: | ||
markdownlint: | ||
name: run markdownlint against this codebase | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout Git repository | ||
uses: actions/checkout@v4 | ||
- name: Run markdownlint | ||
uses: DavidAnson/markdownlint-cli2-action@v13 | ||
with: | ||
globs: '**/*.md' |
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 |
---|---|---|
|
@@ -5,51 +5,14 @@ on: | |
types: | ||
- opened | ||
- synchronize | ||
# Run once a week (see https://crontab.guru) | ||
schedule: | ||
- cron: "0 0 * * 0" | ||
workflow_dispatch: | ||
jobs: | ||
pre-commit: | ||
name: Update pre-commit hooks and run pre-commit | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Set up git repository | ||
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@65d7f2d534ac1bc67fcd62888c5f4f3d2cb2b236 # v4 | ||
with: | ||
python-version: "3.x" | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4 | ||
with: | ||
go-version: "1.21.0" | ||
|
||
- name: Install go module dependencies | ||
run: | | ||
go install mvdan.cc/sh/v3/cmd/shfmt@latest | ||
go install github.com/magefile/mage@latest | ||
- name: Checkout Git repository | ||
uses: actions/checkout@v4 | ||
- name: Install pre-commit | ||
run: pip3 install pre-commit | ||
|
||
- name: Run go mod tidy - necessary to avoid errors with renovatebot PRs | ||
run: | | ||
go mod tidy | ||
pushd magefiles; go mod tidy; popd | ||
- name: Commit go.mod and go.sum changes to keep pre-commit happy | ||
run: | | ||
git config --global user.email "[email protected]" | ||
git config --global user.name "GitHub Action" | ||
git add go.mod go.sum magefiles/go.mod magefiles/go.sum | ||
git diff --quiet && git diff --staged --quiet || \ | ||
git commit -m "Update go.mod and go.sum" | ||
- name: Install pre-commit dependencies | ||
run: mage installDeps | ||
|
||
- name: Run pre-commit | ||
run: mage runPreCommit | ||
run: pre-commit run --all-files |
Oops, something went wrong.