-
Notifications
You must be signed in to change notification settings - Fork 470
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into build_tag_ci
- Loading branch information
Showing
77 changed files
with
893 additions
and
270 deletions.
There are no files selected for viewing
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 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,98 @@ | ||
name: Docker image for Goss | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
tags: | ||
- "v*" | ||
workflow_dispatch: | ||
|
||
env: | ||
PLATFORMS: "linux/amd64,linux/arm64" | ||
|
||
jobs: | ||
goss: | ||
name: Build and push Docker image | ||
runs-on: ubuntu-latest | ||
permissions: | ||
packages: write | ||
contents: read | ||
security-events: write # To upload Trivy sarif files | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Login to GHCR | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Extract metadata (tags, labels) for Docker | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: | | ||
ghcr.io/${{ github.repository_owner }}/goss | ||
- name: Get latest git tag | ||
uses: actions-ecosystem/action-get-latest-tag@v1 | ||
id: get-latest-tag | ||
|
||
- name: Set short git commit SHA | ||
run: | | ||
calculatedSha=$(git rev-parse --short ${{ github.sha }}) | ||
echo "COMMIT_SHORT_SHA=$calculatedSha" >> $GITHUB_ENV | ||
- name: Get the current version of Go from project. | ||
run: echo "GO_VERSION_FROM_PROJECT=$(go mod edit -json | jq -r .Go)" >> $GITHUB_ENV | ||
|
||
- name: Build master goss image | ||
if: github.ref_name == 'master' | ||
uses: docker/build-push-action@v5 | ||
with: | ||
build-args: | | ||
GO_VERSION=${{ env.GO_VERSION_FROM_PROJECT }} | ||
GOSS_VERSION=${{ steps.get-latest-tag.outputs.tag }}-${{ github.ref_name }}+${{ env.COMMIT_SHORT_SHA }} | ||
context: . | ||
push: true | ||
tags: | | ||
ghcr.io/${{ github.repository_owner }}/goss:master | ||
labels: ${{ steps.meta.outputs.labels }} | ||
platforms: ${{ env.PLATFORMS }} | ||
|
||
- name: Build release goss image | ||
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') | ||
uses: docker/build-push-action@v5 | ||
with: | ||
build-args: | | ||
GO_VERSION=${{ env.GO_VERSION_FROM_PROJECT }} | ||
GOSS_VERSION=${{ github.ref_name }} | ||
context: . | ||
push: true | ||
tags: | | ||
ghcr.io/${{ github.repository_owner }}/goss:latest | ||
ghcr.io/${{ github.repository_owner }}/goss:${{ github.ref_name }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
platforms: ${{ env.PLATFORMS }} | ||
|
||
- name: Run Trivy vulnerability scanner | ||
uses: aquasecurity/trivy-action@master | ||
with: | ||
image-ref: ghcr.io/${{ github.repository_owner }}/goss:master | ||
format: "sarif" | ||
output: "trivy-results.sarif" | ||
|
||
- name: Upload Trivy scan results to GitHub Security tab | ||
uses: github/codeql-action/upload-sarif@v3 | ||
with: | ||
sarif_file: "trivy-results.sarif" |
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 |
---|---|---|
@@ -0,0 +1,55 @@ | ||
name: Golang ci | ||
on: | ||
# don't build any branch other than master (and prs) when git pushed | ||
pull_request: {} | ||
push: | ||
branches: | ||
- master | ||
- "/^v\\d+\\.\\d+(\\.\\d+)?(-\\S*)?$/" | ||
paths-ignore: | ||
- "**/*.md" | ||
|
||
permissions: | ||
contents: read | ||
pull-requests: read | ||
|
||
jobs: | ||
lint: | ||
name: lint | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-go@v5 | ||
with: | ||
go-version-file: go.mod | ||
|
||
- name: golangci-lint | ||
uses: golangci/golangci-lint-action@v6 | ||
with: | ||
version: v1.59 | ||
|
||
coverage: | ||
needs: [lint] | ||
name: coverage | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-go@v5 | ||
with: | ||
go-version-file: go.mod | ||
|
||
- name: Unit tests and coverage | ||
run: make cov | ||
|
||
integartion-test: | ||
needs: [coverage] | ||
name: Integration tests | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-go@v5 | ||
with: | ||
go-version-file: go.mod | ||
|
||
- name: Integration tests | ||
run: make test-int-all |
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,7 +5,7 @@ on: | |
- opened | ||
paths: | ||
- mkdocs.yml | ||
- docs/ | ||
- docs/** | ||
- README.md | ||
- LICENSE | ||
- extras/**/README.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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
linters: | ||
# Disable all linters. | ||
# Default: false | ||
disable-all: true | ||
# Enable specific linter | ||
# https://golangci-lint.run/usage/linters/#enabled-by-default | ||
enable: | ||
# default linter | ||
# - errcheck # there are to many failures at the moment | ||
- gosimple | ||
- govet | ||
- ineffassign | ||
- staticcheck | ||
- unused | ||
# custom linter | ||
- gofmt |
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
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 @@ | ||
ARG GO_VERSION=1.21 | ||
|
||
FROM docker.io/golang:${GO_VERSION}-alpine AS base | ||
|
||
ARG GOSS_VERSION=v0.0.0 | ||
WORKDIR /build | ||
|
||
RUN --mount=target=. \ | ||
CGO_ENABLED=0 go build \ | ||
-ldflags "-X github.com/goss-org/goss/util.Version=${GOSS_VERSION} -s -w" \ | ||
-o "/release/goss" \ | ||
./cmd/goss | ||
|
||
FROM alpine:3.19 | ||
|
||
COPY --from=base /release/* /usr/bin/ | ||
|
||
RUN mkdir /goss | ||
VOLUME /goss |
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 |
---|---|---|
|
@@ -35,10 +35,10 @@ htmlcov: | |
go test -v -coverpkg=./... -coverprofile=c.out ./... | ||
go tool cover -html ./c.out | ||
|
||
|
||
lint: | ||
$(info INFO: Starting build $@) | ||
golint $(pkgs) || true | ||
go install github.com/golangci/golangci-lint/cmd/[email protected] | ||
golangci-lint run --timeout 5m $(pkgs) || true | ||
|
||
vet: | ||
$(info INFO: Starting build $@) | ||
|
@@ -96,15 +96,19 @@ test-darwin-all: test-short-all test-int-darwin-all | |
test-linux-all: test-short-all test-int-64 test-int-32 | ||
test-windows-all: test-short-all test-int-windows-all | ||
|
||
test-int-64: centos7 wheezy trusty alpine3 arch test-int-serve-linux-amd64 | ||
test-int-32: centos7-32 wheezy-32 trusty-32 alpine3-32 arch-32 | ||
test-int-64: rockylinux9 wheezy trusty alpine3 arch test-int-serve-linux-amd64 | ||
test-int-32: rockylinux9-32 wheezy-32 trusty-32 alpine3-32 arch-32 | ||
test-int-darwin-all: test-int-validate-darwin-amd64 test-int-serve-darwin-amd64 | ||
test-int-windows-all: test-int-validate-windows-amd64 test-int-serve-windows-amd64 | ||
test-int-all: test-int-32 test-int-64 | ||
|
||
centos7-32: build | ||
$(info INFO: Starting build $@) | ||
cd integration-tests/ && ./test.sh centos7 386 | ||
.PHONY: rockylinux9-32 | ||
rockylinux9-32: build | ||
$(info INFO: Starting build $@) | ||
cd integration-tests/ && ./test.sh rockylinux9 386 | ||
wheezy-32: build | ||
$(info INFO: Starting build $@) | ||
cd integration-tests/ && ./test.sh wheezy 386 | ||
|
@@ -120,6 +124,10 @@ arch-32: build | |
centos7: build | ||
$(info INFO: Starting build $@) | ||
cd integration-tests/ && ./test.sh centos7 amd64 | ||
.PHONY: rockylinux9 | ||
rockylinux9: build | ||
$(info INFO: Starting build $@) | ||
cd integration-tests/ && ./test.sh rockylinux9 amd64 | ||
wheezy: build | ||
$(info INFO: Starting build $@) | ||
cd integration-tests/ && ./test.sh wheezy amd64 | ||
|
@@ -146,10 +154,10 @@ $(PYTHON): | |
$(info Creating virtualenv in $(VENV)) | ||
@python -m venv $(VENV) | ||
|
||
$(DOCS_DEPS): $(PYTHON) docs/requirements.pip | ||
$(DOCS_DEPS): $(PYTHON) docs/requirements.txt | ||
$(info Installing dependencies) | ||
@pip install --upgrade pip | ||
@pip install --requirement docs/requirements.pip | ||
@pip install --requirement docs/requirements.txt | ||
@touch $(DOCS_DEPS) | ||
|
||
docs/setup: $(DOCS_DEPS) | ||
|
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
Oops, something went wrong.