forked from redhat-best-practices-for-k8s/l2discovery-lib
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from edcdavid/add-ci
Add CI
- Loading branch information
Showing
4 changed files
with
124 additions
and
21 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,2 @@ | ||
[maxbodylength] | ||
disabled = true |
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,88 @@ | ||
name: Test Incoming Changes | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
pull_request: | ||
branches: [ main ] | ||
workflow_dispatch: | ||
|
||
permissions: | ||
contents: read | ||
|
||
env: | ||
TERM: xterm-color | ||
CM_BIN: /usr/local/bin/checkmake | ||
CM_URL_LINUX: https://github.com/mrtazz/checkmake/releases/download/0.2.2/checkmake-0.2.2.linux.amd64 # yamllint disable-line | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.event.number || github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
lint-and-test: | ||
name: Run Linters, Vet and unit tests | ||
runs-on: ubuntu-22.04 | ||
env: | ||
SHELL: /bin/bash | ||
|
||
steps: | ||
- name: Set up Go 1.22 | ||
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2 | ||
with: | ||
go-version: 1.22.5 | ||
|
||
- name: Disable default go problem matcher | ||
run: echo "::remove-matcher owner=go::" | ||
|
||
- name: Check out code | ||
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | ||
with: | ||
ref: ${{ github.sha }} | ||
|
||
- name: Extract dependent Pull Requests | ||
uses: depends-on/depends-on-action@9e8a61fce18b15281e831f1bba0e14c71d1e1f46 # main | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Install checkmake | ||
run: | | ||
curl --location --output $CM_BIN --silent $CM_URL_LINUX | ||
chmod +x $CM_BIN | ||
- name: Install Shfmt | ||
uses: mfinelli/setup-shfmt@031e887e39d899d773a7e9b6dd6472c2c23ff50d # v3.0.1 | ||
|
||
- name: Golangci-lint | ||
uses: golangci/golangci-lint-action@aaa42aa0628b4ae2578232a66b541047968fac86 # v6.1.0 | ||
with: | ||
version: v1.59 | ||
args: --timeout 10m0s | ||
|
||
- name: Checkmake | ||
run: checkmake --config=.checkmake Makefile | ||
|
||
- name: Hadolint | ||
uses: hadolint/hadolint-action@54c9adbab1582c2ef04b2016b760714a4bfde3cf # v3.1.0 | ||
with: | ||
dockerfile: Dockerfile | ||
recursive: true | ||
|
||
- name: Shfmt | ||
run: shfmt -d scripts | ||
|
||
- name: ShellCheck | ||
uses: ludeeus/action-shellcheck@00b27aa7cb85167568cb48a3838b75f4265f2bca # master | ||
|
||
- name: Go vet | ||
run: make vet | ||
|
||
- name: Run Build | ||
run: make build | ||
env: | ||
SHELL: /bin/bash | ||
|
||
- name: Run Tests | ||
run: make test | ||
env: | ||
SHELL: /bin/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
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,5 +1,7 @@ | ||
GOLANGCI_VERSION=v1.53.2 | ||
|
||
.PHONY: all clean test build | ||
|
||
lint: | ||
golangci-lint run | ||
# Install golangci-lint | ||
|