Skip to content

Commit fcaf0ac

Browse files
committed
Initial commit
0 parents  commit fcaf0ac

File tree

20 files changed

+1320
-0
lines changed

20 files changed

+1320
-0
lines changed

.dockerignore

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
.vscode
2+
.idea
3+
.git
4+
Dockerfile
5+
*.md
6+
/dist
7+
/images
8+
/.github
9+
/tmp
10+
target
11+
debug

.editorconfig

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
root = true
2+
3+
[*]
4+
end_of_line = lf
5+
charset = utf-8
6+
trim_trailing_whitespace = true
7+
insert_final_newline = true
8+
9+
[*.go]
10+
indent_style = tab
11+
12+
[*.{rs,sh}]
13+
indent_style = space
14+
indent_size = 4

.errcheck_excludes.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
(github.com/go-kit/log.Logger).Log

.github/workflows/build.yml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: Build
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
env:
10+
# renovate: datasource=go depName=mvdan.cc/gofumpt
11+
GOFUMPT_VERSION: v0.3.1
12+
# renovate: datasource=go depName=github.com/golangci/golangci-lint
13+
GOLANGCI_LINT_VERSION: v1.50.1
14+
15+
jobs:
16+
skip-check:
17+
name: Skip check
18+
continue-on-error: true
19+
runs-on: ubuntu-latest
20+
outputs:
21+
should_skip: ${{ steps.skip-check.outputs.should_skip }}
22+
permissions:
23+
actions: write
24+
contents: read
25+
steps:
26+
- id: skip-check
27+
uses: fkirc/skip-duplicate-actions@9d116fa7e55f295019cfab7e3ab72b478bcf7fdd # tag=v4.0.0
28+
with:
29+
do_not_skip: '["schedule", "workflow_dispatch"]'
30+
paths: |-
31+
[
32+
"**.go",
33+
".github/workflows/build.yml",
34+
"Makefile",
35+
"go.mod",
36+
"go.sum"
37+
]
38+
skip_after_successful_duplicate: false
39+
40+
go-build-test:
41+
name: Go Build
42+
runs-on: ubuntu-latest
43+
needs: skip-check
44+
if: ${{ needs.skip-check.outputs.should_skip != 'true' }}
45+
steps:
46+
- name: Check out the code
47+
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3.0.2
48+
49+
- name: Set up Go
50+
uses: actions/setup-go@84cbf8094393cdc5fe1fe1671ff2647332956b1a # tag=v3.2.1
51+
with:
52+
go-version-file: 'go.mod'
53+
check-latest: true
54+
cache: true
55+
56+
- name: Build
57+
run: make build
58+
59+
- name: Test
60+
run: |
61+
make test
62+
63+
- name: Format
64+
run: |
65+
make format
66+
git diff --exit-code
67+
68+
- name: Vet
69+
run: make vet
70+
71+
- name: Lint
72+
uses: golangci/golangci-lint-action@0ad9a0988b3973e851ab0a07adf248ec2e100376 # tag=v3.3.1
73+
with:
74+
version: ${{ env.GOLANGCI_LINT_VERSION }}
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# For most projects, this workflow file will not need changing; you simply need
2+
# to commit it to your repository.
3+
#
4+
# You may wish to alter this file to override the set of languages analyzed,
5+
# or to provide custom queries or build logic.
6+
#
7+
# ******** NOTE ********
8+
# We have attempted to detect the languages in your repository. Please check
9+
# the `language` matrix defined below to confirm you have the correct set of
10+
# supported CodeQL languages.
11+
#
12+
name: "CodeQL"
13+
14+
on:
15+
push:
16+
branches: [ main ]
17+
pull_request:
18+
# The branches below must be a subset of the branches above
19+
branches: [ main ]
20+
schedule:
21+
- cron: '28 16 * * 3'
22+
23+
jobs:
24+
analyze:
25+
name: Analyze
26+
runs-on: ubuntu-latest
27+
permissions:
28+
actions: read
29+
contents: read
30+
security-events: write
31+
32+
strategy:
33+
fail-fast: false
34+
matrix:
35+
language: [ 'go' ]
36+
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
37+
# Learn more:
38+
# 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
39+
40+
steps:
41+
- name: Check out the code
42+
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3.0.2
43+
44+
- name: Set up Go
45+
uses: actions/setup-go@84cbf8094393cdc5fe1fe1671ff2647332956b1a # tag=v3.2.1
46+
with:
47+
go-version-file: 'go.mod'
48+
cache: true
49+
50+
# Initializes the CodeQL tools for scanning.
51+
- name: Initialize CodeQL
52+
uses: github/codeql-action/init@0c670bbf0414f39666df6ce8e718ec5662c21e03 # tag=v2.1.17
53+
with:
54+
languages: ${{ matrix.language }}
55+
# If you wish to specify custom queries, you can do so here or in a config file.
56+
# By default, queries listed here will override any specified in a config file.
57+
# Prefix the list here with "+" to use these queries and those in the config file.
58+
# queries: ./path/to/local/query, your-org/your-repo/queries@main
59+
60+
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
61+
# If this step fails, then you should remove it and run the build manually (see below)
62+
# - name: Autobuild
63+
# uses: github/codeql-action/autobuild@v1
64+
65+
# ℹ️ Command-line programs to run using the OS shell.
66+
# 📚 https://git.io/JvXDl
67+
68+
- run: make build
69+
70+
- name: Perform CodeQL Analysis
71+
uses: github/codeql-action/analyze@0c670bbf0414f39666df6ce8e718ec5662c21e03 # tag=v2.1.17

.github/workflows/container.yml

Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
name: Container
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
env:
10+
# renovate: datasource=go depName=github.com/goreleaser/goreleaser
11+
GORELEASER_VERSION: v1.10.2
12+
13+
jobs:
14+
skip-check:
15+
name: Skip check
16+
continue-on-error: true
17+
runs-on: ubuntu-latest
18+
outputs:
19+
should_skip: ${{ steps.skip-check.outputs.should_skip }}
20+
permissions:
21+
actions: write
22+
contents: read
23+
steps:
24+
- id: skip-check
25+
uses: fkirc/skip-duplicate-actions@9d116fa7e55f295019cfab7e3ab72b478bcf7fdd # tag=v4.0.0
26+
with:
27+
do_not_skip: '["schedule", "workflow_dispatch"]'
28+
paths: |-
29+
[
30+
"**.go",
31+
".dockerignore",
32+
".github/workflows/container.yml",
33+
"Dockerfile*",
34+
"Makefile",
35+
"go.mod",
36+
"go.sum"
37+
]
38+
skip_after_successful_duplicate: false
39+
40+
41+
build-binaries:
42+
name: Build binaries using goreleaser
43+
needs: skip-check
44+
if: ${{ needs.skip-check.outputs.should_skip != 'true' }}
45+
runs-on: ubuntu-latest
46+
container:
47+
image: docker.io/goreleaser/goreleaser-cross:v1.18.3
48+
options: --privileged
49+
env:
50+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
51+
GORELEASER_CURRENT_TAG: "${{ env.goreleaser_current_tag }}"
52+
steps:
53+
- name: Check out the code
54+
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3.0.2
55+
56+
- name: Set up Go
57+
uses: actions/setup-go@84cbf8094393cdc5fe1fe1671ff2647332956b1a # tag=v3.2.1
58+
with:
59+
go-version-file: 'go.mod'
60+
cache: true
61+
62+
- name: Run Goreleaser
63+
run: goreleaser release --rm-dist --skip-validate --skip-publish --snapshot --debug
64+
65+
- name: Archive generated artifacts
66+
uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # tag=v3.1.0
67+
with:
68+
name: parca-push-dist-container
69+
if-no-files-found: error
70+
path: |
71+
goreleaser/dist
72+
!goreleaser/dist/*.txt
73+
74+
build-and-push-container:
75+
name: Container build and push (when merged)
76+
needs: build-binaries
77+
runs-on: ubuntu-latest
78+
container:
79+
# https://github.com/containers/podman/tree/main/contrib/podmanimage
80+
# Specifying SHA repeatedly fails:
81+
# @sha256:421ac576cebff98e90c531e7b9ce4482370ecc7cee59abc2341714031bfb5f43
82+
image: quay.io/containers/podman:v4.1.1
83+
options: >-
84+
--device /dev/fuse:rw
85+
--privileged
86+
--security-opt label=disable
87+
--security-opt seccomp=unconfined
88+
permissions:
89+
id-token: write
90+
packages: write
91+
contents: read
92+
steps:
93+
- name: Install dependencies
94+
run: dnf install --assumeyes --repo fedora git make jq
95+
96+
- name: Check out code into the Go module directory
97+
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3.0.2
98+
99+
- name: Set up Go
100+
uses: actions/setup-go@84cbf8094393cdc5fe1fe1671ff2647332956b1a # tag=v3.2.1
101+
with:
102+
go-version-file: 'go.mod'
103+
check-latest: true
104+
105+
- uses: actions/download-artifact@v3
106+
with:
107+
name: parca-push-dist-container
108+
path: goreleaser/dist
109+
110+
- name: Build container
111+
run: make container
112+
113+
- name: Check images are created
114+
run: podman images | grep 'ghcr.io/parca-dev/parca-push'
115+
116+
- name: Install cosign
117+
if: ${{ github.event_name != 'pull_request' }}
118+
uses: sigstore/cosign-installer@09a077b27eb1310dcfb21981bee195b30ce09de0 # tag=v2.5.0
119+
120+
- name: Login to registry
121+
if: ${{ github.event_name != 'pull_request' }}
122+
run: |
123+
echo "${{ secrets.GITHUB_TOKEN }}" | podman login -u parca-dev --password-stdin ghcr.io
124+
125+
- name: Install crane
126+
if: ${{ github.event_name != 'pull_request' }}
127+
uses: imjasonh/setup-crane@e82f1b9a8007d399333baba4d75915558e9fb6a4 # tag=v0.2
128+
129+
- name: Push and sign container
130+
if: ${{ github.event_name != 'pull_request' }}
131+
env:
132+
COSIGN_EXPERIMENTAL: true
133+
run: |
134+
make push-container
135+
make sign-container

.github/workflows/docs.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Documents
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
paths:
7+
pull_request:
8+
branches: [ main ]
9+
10+
jobs:
11+
skip-check:
12+
name: Skip check
13+
continue-on-error: true
14+
runs-on: ubuntu-latest
15+
outputs:
16+
should_skip: ${{ steps.skip-check.outputs.should_skip }}
17+
permissions:
18+
actions: write
19+
contents: read
20+
steps:
21+
- id: skip-check
22+
uses: fkirc/skip-duplicate-actions@9d116fa7e55f295019cfab7e3ab72b478bcf7fdd # tag=v4.0.0
23+
with:
24+
do_not_skip: '["schedule", "workflow_dispatch"]'
25+
paths: |-
26+
[
27+
".github/workflows/docs.yml",
28+
"Makefile",
29+
"cmd/parca-push/main.go",
30+
"docs"
31+
]
32+
skip_after_successful_duplicate: false
33+
34+
docs:
35+
name: Generate documentation
36+
needs: skip-check
37+
if: ${{ needs.skip-check.outputs.should_skip != 'true' }}
38+
runs-on: ubuntu-latest
39+
steps:
40+
- name: Check out the code
41+
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3.0.2
42+
43+
- name: Set up Go
44+
uses: actions/setup-go@84cbf8094393cdc5fe1fe1671ff2647332956b1a # tag=v3.2.1
45+
with:
46+
go-version-file: 'go.mod'
47+
cache: true
48+
49+
- name: Set up tools
50+
run: ./env.sh
51+
52+
- name: Build
53+
run: make build
54+
55+
- name: Docs check
56+
run: |
57+
make README.md
58+
git diff --exit-code

0 commit comments

Comments
 (0)