-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 8f2ce37
Showing
22 changed files
with
2,355 additions
and
0 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,11 @@ | ||
.vscode | ||
.idea | ||
.git | ||
Dockerfile | ||
*.md | ||
/dist | ||
/images | ||
/.github | ||
/tmp | ||
target | ||
debug |
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,14 @@ | ||
root = true | ||
|
||
[*] | ||
end_of_line = lf | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
|
||
[*.go] | ||
indent_style = tab | ||
|
||
[*.{rs,sh}] | ||
indent_style = space | ||
indent_size = 4 |
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 @@ | ||
(github.com/go-kit/log.Logger).Log |
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,74 @@ | ||
name: Build | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
pull_request: | ||
branches: [ main ] | ||
|
||
env: | ||
# renovate: datasource=go depName=mvdan.cc/gofumpt | ||
GOFUMPT_VERSION: v0.3.1 | ||
# renovate: datasource=go depName=github.com/golangci/golangci-lint | ||
GOLANGCI_LINT_VERSION: v1.53.3 | ||
|
||
jobs: | ||
skip-check: | ||
name: Skip check | ||
continue-on-error: true | ||
runs-on: ubuntu-latest | ||
outputs: | ||
should_skip: ${{ steps.skip-check.outputs.should_skip }} | ||
permissions: | ||
actions: write | ||
contents: read | ||
steps: | ||
- id: skip-check | ||
uses: fkirc/skip-duplicate-actions@9d116fa7e55f295019cfab7e3ab72b478bcf7fdd # tag=v4.0.0 | ||
with: | ||
do_not_skip: '["schedule", "workflow_dispatch"]' | ||
paths: |- | ||
[ | ||
"**.go", | ||
".github/workflows/build.yml", | ||
"Makefile", | ||
"go.mod", | ||
"go.sum" | ||
] | ||
skip_after_successful_duplicate: false | ||
|
||
go-build-test: | ||
name: Go Build | ||
runs-on: ubuntu-latest | ||
needs: skip-check | ||
if: ${{ needs.skip-check.outputs.should_skip != 'true' }} | ||
steps: | ||
- name: Check out the code | ||
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3.0.2 | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@84cbf8094393cdc5fe1fe1671ff2647332956b1a # tag=v3.2.1 | ||
with: | ||
go-version-file: 'go.mod' | ||
check-latest: true | ||
cache: true | ||
|
||
- name: Build | ||
run: make build | ||
|
||
- name: Test | ||
run: | | ||
make test | ||
- name: Format | ||
run: | | ||
make format | ||
git diff --exit-code | ||
- name: Vet | ||
run: make vet | ||
|
||
- name: Lint | ||
uses: golangci/golangci-lint-action@0ad9a0988b3973e851ab0a07adf248ec2e100376 # tag=v3.3.1 | ||
with: | ||
version: ${{ env.GOLANGCI_LINT_VERSION }} |
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,71 @@ | ||
# For most projects, this workflow file will not need changing; you simply need | ||
# to commit it to your repository. | ||
# | ||
# You may wish to alter this file to override the set of languages analyzed, | ||
# or to provide custom queries or build logic. | ||
# | ||
# ******** NOTE ******** | ||
# We have attempted to detect the languages in your repository. Please check | ||
# the `language` matrix defined below to confirm you have the correct set of | ||
# supported CodeQL languages. | ||
# | ||
name: "CodeQL" | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
pull_request: | ||
# The branches below must be a subset of the branches above | ||
branches: [ main ] | ||
schedule: | ||
- cron: '28 16 * * 3' | ||
|
||
jobs: | ||
analyze: | ||
name: Analyze | ||
runs-on: ubuntu-latest | ||
permissions: | ||
actions: read | ||
contents: read | ||
security-events: write | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
language: [ 'go' ] | ||
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ] | ||
# Learn more: | ||
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed | ||
|
||
steps: | ||
- name: Check out the code | ||
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3.0.2 | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@84cbf8094393cdc5fe1fe1671ff2647332956b1a # tag=v3.2.1 | ||
with: | ||
go-version-file: 'go.mod' | ||
cache: true | ||
|
||
# Initializes the CodeQL tools for scanning. | ||
- name: Initialize CodeQL | ||
uses: github/codeql-action/init@0c670bbf0414f39666df6ce8e718ec5662c21e03 # tag=v2.1.17 | ||
with: | ||
languages: ${{ matrix.language }} | ||
# If you wish to specify custom queries, you can do so here or in a config file. | ||
# By default, queries listed here will override any specified in a config file. | ||
# Prefix the list here with "+" to use these queries and those in the config file. | ||
# queries: ./path/to/local/query, your-org/your-repo/queries@main | ||
|
||
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java). | ||
# If this step fails, then you should remove it and run the build manually (see below) | ||
# - name: Autobuild | ||
# uses: github/codeql-action/autobuild@v1 | ||
|
||
# ℹ️ Command-line programs to run using the OS shell. | ||
# 📚 https://git.io/JvXDl | ||
|
||
- run: make build | ||
|
||
- name: Perform CodeQL Analysis | ||
uses: github/codeql-action/analyze@0c670bbf0414f39666df6ce8e718ec5662c21e03 # tag=v2.1.17 |
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,133 @@ | ||
name: Container | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
pull_request: | ||
branches: [ main ] | ||
|
||
env: | ||
# renovate: datasource=go depName=github.com/goreleaser/goreleaser | ||
GORELEASER_VERSION: v1.10.2 | ||
|
||
jobs: | ||
skip-check: | ||
name: Skip check | ||
continue-on-error: true | ||
runs-on: ubuntu-latest | ||
outputs: | ||
should_skip: ${{ steps.skip-check.outputs.should_skip }} | ||
permissions: | ||
actions: write | ||
contents: read | ||
steps: | ||
- id: skip-check | ||
uses: fkirc/skip-duplicate-actions@9d116fa7e55f295019cfab7e3ab72b478bcf7fdd # tag=v4.0.0 | ||
with: | ||
do_not_skip: '["schedule", "workflow_dispatch"]' | ||
paths: |- | ||
[ | ||
"**.go", | ||
".dockerignore", | ||
".github/workflows/container.yml", | ||
"Dockerfile*", | ||
"Makefile", | ||
"go.mod", | ||
"go.sum" | ||
] | ||
skip_after_successful_duplicate: false | ||
|
||
|
||
build-binaries: | ||
name: Build binaries using goreleaser | ||
needs: skip-check | ||
if: ${{ needs.skip-check.outputs.should_skip != 'true' }} | ||
runs-on: ubuntu-latest | ||
container: | ||
image: docker.io/goreleaser/goreleaser-cross:v1.18.3 | ||
options: --privileged | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
GORELEASER_CURRENT_TAG: "${{ env.goreleaser_current_tag }}" | ||
steps: | ||
- name: Check out the code | ||
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3.0.2 | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@84cbf8094393cdc5fe1fe1671ff2647332956b1a # tag=v3.2.1 | ||
with: | ||
go-version-file: 'go.mod' | ||
cache: true | ||
|
||
- name: Run Goreleaser | ||
run: goreleaser release --rm-dist --skip-validate --skip-publish --snapshot --debug | ||
|
||
- name: Archive generated artifacts | ||
uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # tag=v3.1.0 | ||
with: | ||
name: profile-exporter-dist-container | ||
if-no-files-found: error | ||
path: | | ||
goreleaser/dist | ||
!goreleaser/dist/*.txt | ||
build-and-push-container: | ||
name: Container build and push (when merged) | ||
needs: build-binaries | ||
runs-on: ubuntu-latest | ||
container: | ||
image: quay.io/containers/podman:v4.6.2@sha256:e0cef628e369cf466979d08bda2c25d861e2b90e6236e99b817235b612c511b3 | ||
options: >- | ||
--device /dev/fuse:rw | ||
--privileged | ||
--security-opt label=disable | ||
--security-opt seccomp=unconfined | ||
permissions: | ||
id-token: write | ||
packages: write | ||
contents: read | ||
steps: | ||
- name: Install dependencies | ||
run: dnf install --assumeyes --repo fedora git make jq | ||
|
||
- name: Check out code into the Go module directory | ||
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3.0.2 | ||
|
||
# https://github.com/actions/checkout/issues/766 | ||
- name: Add repository directory to the git global config as a safe directory | ||
run: git config --global --add safe.directory "${GITHUB_WORKSPACE}" | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@84cbf8094393cdc5fe1fe1671ff2647332956b1a # tag=v3.2.1 | ||
with: | ||
go-version-file: 'go.mod' | ||
check-latest: true | ||
|
||
- uses: actions/download-artifact@v3 | ||
with: | ||
name: profile-exporter-dist-container | ||
path: goreleaser/dist | ||
|
||
- name: Build container | ||
run: make container | ||
|
||
- name: Check images are created | ||
run: podman images | grep 'ghcr.io/polarsignals/profile-exporter' | ||
|
||
- name: Install cosign | ||
uses: sigstore/cosign-installer@11086d25041f77fe8fe7b9ea4e48e3b9192b8f19 # v3.1.2 | ||
|
||
- name: Login to registry | ||
if: ${{ github.event_name != 'pull_request' }} | ||
run: | | ||
echo "${{ secrets.GITHUB_TOKEN }}" | podman login -u polarsignals --password-stdin ghcr.io | ||
- name: Install crane | ||
uses: imjasonh/setup-crane@00c9e93efa4e1138c9a7a5c594acd6c75a2fbf0c # v0.3 | ||
|
||
- name: Push and sign container | ||
env: | ||
COSIGN_EXPERIMENTAL: true | ||
run: | | ||
make push-container | ||
make sign-container |
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,58 @@ | ||
name: Documents | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
paths: | ||
pull_request: | ||
branches: [ main ] | ||
|
||
jobs: | ||
skip-check: | ||
name: Skip check | ||
continue-on-error: true | ||
runs-on: ubuntu-latest | ||
outputs: | ||
should_skip: ${{ steps.skip-check.outputs.should_skip }} | ||
permissions: | ||
actions: write | ||
contents: read | ||
steps: | ||
- id: skip-check | ||
uses: fkirc/skip-duplicate-actions@9d116fa7e55f295019cfab7e3ab72b478bcf7fdd # tag=v4.0.0 | ||
with: | ||
do_not_skip: '["schedule", "workflow_dispatch"]' | ||
paths: |- | ||
[ | ||
".github/workflows/docs.yml", | ||
"Makefile", | ||
"cmd/profile-exporter/main.go", | ||
"docs" | ||
] | ||
skip_after_successful_duplicate: false | ||
|
||
docs: | ||
name: Generate documentation | ||
needs: skip-check | ||
if: ${{ needs.skip-check.outputs.should_skip != 'true' }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out the code | ||
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3.0.2 | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@84cbf8094393cdc5fe1fe1671ff2647332956b1a # tag=v3.2.1 | ||
with: | ||
go-version-file: 'go.mod' | ||
cache: true | ||
|
||
- name: Set up tools | ||
run: ./env.sh | ||
|
||
- name: Build | ||
run: make build | ||
|
||
- name: Docs check | ||
run: | | ||
make README.md | ||
git diff --exit-code |
Oops, something went wrong.