Skip to content

Commit

Permalink
Incorporate PGO into builds
Browse files Browse the repository at this point in the history
For #428
  • Loading branch information
turt2live committed Sep 8, 2023
1 parent 56fb90e commit 0275533
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 0 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
/dev/conduit-db
/dev/psql
/vcpkg
/libheif

# Generated files
assets.bin.go
Expand Down
17 changes: 17 additions & 0 deletions .github/workflows/download_pgo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: "Update PGO performance profile"
on:
# schedule:
# - cron: "0 0 * * 2" # Every Tuesday at 00:00
workflow_dispatch:
jobs:
update_providers:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v3
- name: "Download new pgo_media_repo.pprof"
run: "curl -s --fail -X POST -H \"Authorization: Bearer ${PGO_MERGE}\" https://pgo-mmr.t2host.io/v1/merge?and_combine=true > pgo_media_repo.pprof"
- uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: "Update pgo_media_repo.pprof"
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
/dev/conduit-db
/dev/psql
/vcpkg
/libheif

# Generated files
assets.bin.go
Expand Down
1 change: 1 addition & 0 deletions build-dist.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ do
pth="$os-$arch"
mkdir $PWD/bin/$pth
GOOS=$os GOARCH=$arch GOBIN=$PWD/bin go build -o $PWD/bin/$pth -a -ldflags "-X github.com/turt2live/matrix-media-repo/common/version.GitCommit=$(git rev-list -1 HEAD) -X github.com/turt2live/matrix-media-repo/common/version.Version=$(git describe --tags)" -v ./cmd/...
GOOS=$os GOARCH=$arch GOBIN=$PWD/bin go build -pgo=pgo_media_repo.pprof -o $PWD/bin/$pth -a -ldflags "-X github.com/turt2live/matrix-media-repo/common/version.GitCommit=$(git rev-list -1 HEAD) -X github.com/turt2live/matrix-media-repo/common/version.Version=$(git describe --tags)" -v ./cmd/media_repo
cd $PWD/bin/$pth
if [ "$arch" == "amd64" ]; then
arch="x64"
Expand Down
3 changes: 3 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#!/bin/sh

set -ex

GOBIN=$PWD/bin go install -v ./cmd/compile_assets
$PWD/bin/compile_assets
GOBIN=$PWD/bin go install -ldflags "-X github.com/turt2live/matrix-media-repo/common/version.GitCommit=$(git rev-list -1 HEAD) -X github.com/turt2live/matrix-media-repo/common/version.Version=$(git describe --tags)" -v ./cmd/...
GOBIN=$PWD/bin go install -pgo=pgo_media_repo.pprof -ldflags "-X github.com/turt2live/matrix-media-repo/common/version.GitCommit=$(git rev-list -1 HEAD) -X github.com/turt2live/matrix-media-repo/common/version.Version=$(git describe --tags)" -v ./cmd/media_repo
Binary file added pgo_media_repo.pprof
Binary file not shown.

0 comments on commit 0275533

Please sign in to comment.