Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
petethepig committed Dec 3, 2020
0 parents commit b11ab95
Show file tree
Hide file tree
Showing 129 changed files with 21,508 additions and 0 deletions.
43 changes: 43 additions & 0 deletions .air-test.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# .air-test.conf
# Config file for [Air](https://github.com/cosmtrek/air) in TOML format

# Working directory
# . or absolute path, please note that the directories following must be under root.
root = "."
tmp_dir = "tmp"

[build]
# Just plain old shell command. You could use `make` as well.
cmd = "true"
# Binary file yields from `cmd`.
full_bin = "go test ./..."
# Customize binary.
# Watch these filename extensions.
include_ext = ["go", "tpl", "tmpl", "html"]
# Ignore these filename extensions or directories.
exclude_dir = ["assets", "tmp", "vendor", "node_modules", "webapp", "examples"]
# Watch these directories if you specified.
include_dir = []
# Exclude files.
exclude_file = []
# It's not necessary to trigger build each time file changes if it's too frequent.
delay = 1000 # ms
# Stop to run old binary when build errors occur.
stop_on_error = true
# This log file places in your tmp_dir.
log = "air_errors.log"

[log]
# Show log time
time = false

[color]
# Customize each part's color. If no color found, use the raw app log.
main = "magenta"
watcher = "cyan"
build = "yellow"
runner = "green"

[misc]
# Delete tmp directory on exit
# clean_on_exit = true
48 changes: 48 additions & 0 deletions .air.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# .air.conf
# Config file for [Air](https://github.com/cosmtrek/air) in TOML format

# Working directory
# . or absolute path, please note that the directories following must be under root.
root = "."
tmp_dir = "tmp"

[build]
# Just plain old shell command. You could use `make` as well.
cmd = "make build"
# Binary file yields from `cmd`.
full_bin = "bin/pyroscope server"
# Customize binary.
# Watch these filename extensions.
include_ext = ["go", "tpl", "tmpl", "html"]
# Ignore these filename extensions or directories.
exclude_dir = ["assets", "tmp", "vendor", "node_modules", "webapp", "examples"]
# Watch these directories if you specified.
include_dir = []
# Exclude files.
exclude_file = []
# It's not necessary to trigger build each time file changes if it's too frequent.
delay = 1000 # ms

send_interrupt = true

kill_delay = 100 # ms

# Stop to run old binary when build errors occur.
stop_on_error = true
# This log file places in your tmp_dir.
log = "air_errors.log"

[log]
# Show log time
time = false

[color]
# Customize each part's color. If no color found, use the raw app log.
main = "magenta"
watcher = "cyan"
build = "yellow"
runner = "green"

[misc]
# Delete tmp directory on exit
# clean_on_exit = true
5 changes: 5 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"plugins": [
"transform-class-properties"
]
}
3 changes: 3 additions & 0 deletions .github/markdown-images/architecture.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
97 changes: 97 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
name: Release

on:
push:
# Sequence of patterns matched against refs/tags
tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10

jobs:
create_release:
name: Create Release
runs-on: ubuntu-latest
steps:
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
# This token is provided by Actions, you do not need to create your own token
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
# body: TODO
draft: false
prerelease: false

- name: Checkout code
uses: actions/checkout@v2

- name: Cache go mod directories
uses: actions/cache@v2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Create build directory
run: mkdir build

- name: Build
run: go build -o build/pyroscope ./cmd/pyroscope

- name: List Assets
run: ls build/

- name: Determine file name
id: file_name
run: echo ::set-output name=file_name::pyroscope-linux-x86_64-${GITHUB_REF#refs/*/}.tar.gz

- name: Make package build directory
run: mkdir -p package-build/bin

- name: Copy binary to package-build directory
run: cp build/pyroscope package-build/bin/pyroscope

- name: Generate build number
id: buildnumber
uses: einaregilsson/build-number@v2
with:
token: ${{secrets.github_token}}

- name: Determine iteration
id: iteration
run: echo ::set-output name=iteration::${{ steps.buildnumber.outputs.build_number }}.$(date +%Y%m%d)git${GITHUB_SHA::8}

- name: Determine rpm name
id: rpm_name
run: echo ::set-output name=rpm_name::pyroscope-${GITHUB_REF#refs/*/v}-${{ steps.iteration.outputs.iteration }}-x86_64.rpm

- name: Determine deb name
id: deb_name
run: echo ::set-output name=deb_name::pyroscope_${GITHUB_REF#refs/*/v}_amd64.deb

- name: Install fpm
run: "sudo gem install fpm"

- name: Create rpm package
run: "fpm -s dir -t rpm -n pyroscope --iteration ${{ steps.iteration.outputs.iteration }} --architecture x86_64 -v ${GITHUB_REF#refs/*/v} --description 'pyroscope is continuous profiling software' -p ${{ steps.rpm_name.outputs.rpm_name }} ./package-build"

- name: Create deb package
run: "fpm -s dir -t deb -n pyroscope --iteration ${{ steps.iteration.outputs.iteration }} --architecture x86_64 -v ${GITHUB_REF#refs/*/v} --description 'pyroscope is continuous profiling software' -p ${{ steps.rpm_name.outputs.deb_name }} ./package-build"

- name: Archive Assets
run: tar czf ${{ steps.file_name.outputs.file_name }} build/*

- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
# This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./${{ steps.file_name.outputs.file_name }}
asset_name: ${{ steps.file_name.outputs.file_name }}
asset_content_type: application/gzip
23 changes: 23 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Tests

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Cache go mod directories
uses: actions/cache@v2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Run tests
run: go test ./...
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
tmp
node_modules
/webapp/public
/bin
/third_party/*/lib*.a
pkged.go
.DS_Store
/Icon*
Loading

0 comments on commit b11ab95

Please sign in to comment.