Skip to content
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

Cache go vendors in CI #601

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 6 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
78 changes: 77 additions & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,16 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Restore go vendors
uses: actions/cache@v4
with:
path: |
~/go/pkg/mod
~/.cache/go-build
key: go-deps-${{ runner.os }}-${{ hashFiles('go.sum') }}
restore-keys: |
go-deps-${{ runner.os }}

- name: Install devbox
uses: jetify-com/[email protected]
with:
Expand All @@ -31,6 +41,16 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Restore go vendors
uses: actions/cache@v4
with:
path: |
~/go/pkg/mod
~/.cache/go-build
key: go-deps-${{ runner.os }}-${{ hashFiles('go.sum') }}
restore-keys: |
go-deps-${{ runner.os }}

- name: Install devbox
uses: jetify-com/[email protected]
with:
Expand All @@ -51,6 +71,16 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Restore go vendors
uses: actions/cache@v4
with:
path: |
~/go/pkg/mod
~/.cache/go-build
key: go-deps-${{ runner.os }}-${{ matrix.kind_version }}-${{ hashFiles('go.sum') }}
restore-keys: |
go-deps-${{ runner.os }}

- name: Install devbox
uses: jetify-com/[email protected]
with:
Expand All @@ -65,6 +95,8 @@ jobs:
devbox run go run cmd/cli/main.go generate \
--config ./config/foundation_sdk.dev.yaml \
--parameters output_dir=./generated/%l,grafana_version=${{ matrix.kind_version == 'next' && 'main' || matrix.kind_version }},kind_registry_version=${{ matrix.kind_version }},go_package_root=github.com/grafana/cog/generated/go
env:
GOGC: 'off'

- name: Compile generated Go code
run: devbox run ./scripts/ci/build-go.sh
Expand All @@ -75,8 +107,30 @@ jobs:
- name: Lint generated Python code
run: devbox run mypy generated/python/

# See https://docs.gradle.org/current/userguide/build_cache.html
- name: Restore Gradle build cache
uses: actions/cache@v4
with:
path: |
~/.gradle/caches
key: gradle-build-cache-${{ runner.os }}-${{ matrix.kind_version }}
restore-keys: |
gradle-build-cache-${{ runner.os }}-

- name: Compile generated Java code
run: devbox run gradle build -p generated/java
run: devbox run gradle build --build-cache -p generated/java

# See https://phpstan.org/user-guide/result-cache
# See https://psalm.dev/docs/running_psalm/configuration/#cachedirectory
- name: Restore PHP linters cache
uses: actions/cache@v4
with:
path: |
/tmp/phpstan
~/.cache/psalm
key: php-linters-result-cache-${{ matrix.kind_version }}
restore-keys: |
php-linters-result-cache-

- name: Lint generated PHP code with phpstan
run: devbox run phpstan analyze --memory-limit 512M -c .config/ci/php/phpstan.neon
Expand All @@ -91,6 +145,16 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Restore go vendors
uses: actions/cache@v4
with:
path: |
~/go/pkg/mod
~/.cache/go-build
key: go-deps-${{ runner.os }}-next-${{ hashFiles('go.sum') }}
restore-keys: |
go-deps-${{ runner.os }}

- name: Install devbox
uses: jetify-com/[email protected]
with:
Expand All @@ -102,6 +166,8 @@ jobs:

- name: Run code generation
run: make gen-sdk-dev
env:
GOGC: 'off'

- name: Run the Go example
run: make run-go-example
Expand All @@ -112,5 +178,15 @@ jobs:
- name: Run the PHP example
run: make run-php-example

# See https://docs.gradle.org/current/userguide/build_cache.html
- name: Restore Gradle build cache
uses: actions/cache@v4
with:
path: |
~/.gradle/caches
key: gradle-build-cache-${{ runner.os }}-${{ matrix.kind_version }}
restore-keys: |
gradle-build-cache-${{ runner.os }}-

- name: Run Java example
run: make run-java-example
11 changes: 11 additions & 0 deletions .github/workflows/grafana-foundation-sdk-diff-preview.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,16 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Restore go vendors
uses: actions/cache@v4
with:
path: |
~/go/pkg/mod
~/.cache/go-build
key: go-deps-${{ runner.os }}-next-${{ hashFiles('go.sum') }}
restore-keys: |
go-deps-${{ runner.os }}

- name: Install devbox
uses: jetify-com/[email protected]
with:
Expand All @@ -30,6 +40,7 @@ jobs:
FOUNDATION_SDK_PATH: ./grafana-foundation-sdk
FOUNDATION_SDK_REPO: https://github.com/grafana/grafana-foundation-sdk.git
LOG_LEVEL: '7' # debug
GOGC: 'off'

- name: Preview diff
run: |
Expand Down
Loading