Skip to content

test caching #711

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .buildkite/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
services:
golangci-lint:
image: golangci/golangci-lint:v2.1.6
working_dir: /app
volumes:
- ..:/app
- ~/.cache/golangci-lint/v2.1.6:/root/.cache
- ~/gocache:/gocache
- ~/gomodcache:/gomodcache
environment:
- GOCACHE=/gocache
- GOMODCACHE=/gomodcache
6 changes: 6 additions & 0 deletions .buildkite/hooks/pre-command
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash

set -euo pipefail

mkdir -p $HOME/.cache/go-build
mkdir -p $HOME/.cache/golangci-lint
50 changes: 50 additions & 0 deletions .buildkite/pipeline.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,17 @@ env:
RUNNER_SMALL: "small"
GRAPHQL_SCHEMA_LOCATION: "internal/graphapi/clientschema/schema.graphql"
GRAPHQL_SCHEMA_NAME: "Openlane-2fwyqq@current"
BUILDKITE_PLUGIN_S3_CACHE_BUCKET: "bkcache"
BUILDKITE_PLUGIN_S3_CACHE_ENDPOINT: "s3://arn:aws:s3:us-east-1:329599614681:accesspoint/bkcache"

steps:
- name: ":golangci-lint: lint"
command: golangci-lint run --config=.golangci.yaml --verbose
plugins:
- docker-compose#v5.2.0:
config: .buildkite/docker-compose.yaml
run: golangci-lint
tty: true
- group: ":knife: Pre-check"
key: "precheck"
steps:
Expand All @@ -23,12 +32,24 @@ steps:
size: $RUNNER_LARGE
cancel_on_build_failing: true
plugins:
- cache#v1.6.0:
manifest:
- go.mod
- go.sum
path: go-build
restore: pipeline
backend: s3
save:
- file
- branch
- docker#v5.12.0:
image: "ghcr.io/theopenlane/build-image:latest"
always_pull: true
command: ["task", "ci"]
environment:
- "GOTOOLCHAIN=auto"
- "GOCACHE=s3://arn:aws:s3:us-east-1:329599614681:accesspoint/bkcache/go-build"
- "GOLANGCI_LINT_CACHE=s3://arn:aws:s3:us-east-1:329599614681:accesspoint/bkcache/golangci-lint"
- label: ":yaml: generate config"
key: "generate_config"
cancel_on_build_failing: true
Expand All @@ -52,12 +73,21 @@ steps:
timeout_in_minutes: 20
key: "lint"
plugins:
- cache#v1.6.0:
manifest:
- go.mod
- go.sum
path: go-build
restore: file
backend: s3
- docker#v5.12.0:
image: "ghcr.io/theopenlane/build-image:latest"
command: ["task", "go:lint:ci"]
always_pull: true
environment:
- "GOTOOLCHAIN=auto"
- "GOCACHE=s3://arn:aws:s3:us-east-1:329599614681:accesspoint/bkcache/go-build"
- "GOLANGCI_LINT_CACHE=s3://arn:aws:s3:us-east-1:329599614681:accesspoint/bkcache/golangci-lint"
artifact_paths: ["coverage.out"]
- label: ":golang: go test - {{matrix.version}}"
agents:
Expand All @@ -68,11 +98,21 @@ steps:
cancel_on_build_failing: true
env:
TEST_DB_URL: "docker://postgres:{{matrix.version}}"
GOMODCACHE: pkg/cache
matrix:
setup:
version:
- 17-alpine
plugins:
- cache#v1.6.0:
path: pkg/cache
manifest:
- go.mod
- go.sum
restore: file
save: file
backend: s3
key-extra: "{{matrix.version}}"
- docker#v5.12.0:
image: ghcr.io/theopenlane/build-image:latest
always_pull: true
Expand Down Expand Up @@ -306,6 +346,16 @@ steps:
push: true
build-args:
- NAME=${APP_NAME}
- cache#v1.6.0:
manifest:
- go.mod
- go.sum
path: go-build
restore: file
backend: s3
save:
- pipeline
- all
- trigger: "core-deploy"
depends_on: "docker-build-and-tag"
label: ":rocket: trigger core-deploy"
Expand Down