Add a page dedicated to examples in the Foundation SDK docs #1827
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
pull_request: ~ | |
push: | |
branches: [main] # so that we build a Go cache that can be re-used in PRs | |
env: | |
DEVBOX_VERSION: 0.13.1 | |
jobs: | |
linters: | |
name: Linters | |
runs-on: ubuntu-latest | |
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: | |
enable-cache: 'true' | |
devbox-version: ${{ env.DEVBOX_VERSION }} | |
- name: Run golangci-lint | |
run: make lint | |
tests: | |
name: Tests | |
runs-on: ubuntu-latest | |
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: | |
enable-cache: 'true' | |
devbox-version: ${{ env.DEVBOX_VERSION }} | |
- name: Tests | |
run: make tests | |
registry: | |
name: Generate registry | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
kind_version: [next, v11.3.x, v11.2.x, v11.1.x, v11.0.x, v10.4.x, v10.3.x, v10.2.x, v10.1.x] | |
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: | |
enable-cache: 'true' | |
devbox-version: ${{ env.DEVBOX_VERSION }} | |
- name: Clone kind-registry | |
run: git clone --depth=1 https://github.com/grafana/kind-registry.git ../kind-registry | |
- name: Run code generation | |
run: | | |
devbox run go run cmd/cli/main.go generate \ | |
--config ./config/foundation_sdk.dev.yaml \ | |
--parameters grafana_version=${{ matrix.kind_version == 'next' && 'main' || matrix.kind_version }},kind_registry_version=${{ matrix.kind_version }} | |
env: | |
GOGC: 'off' | |
- name: Compile generated Go code | |
run: devbox run ./scripts/ci/build-go.sh | |
- name: Compile generated Typescript code | |
run: devbox run ./scripts/ci/build-ts.sh | |
- 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 --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 | |
- name: Lint generated PHP code with psalm | |
run: devbox run psalm -c .config/ci/php/psalm.xml generated/php | |
examples: | |
name: Run examples | |
runs-on: ubuntu-latest | |
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: | |
enable-cache: 'true' | |
devbox-version: ${{ env.DEVBOX_VERSION }} | |
- name: Clone kind-registry | |
run: git clone --depth=1 https://github.com/grafana/kind-registry.git ../kind-registry | |
- name: Run code generation | |
run: make gen-sdk-dev | |
env: | |
GOGC: 'off' | |
- name: Run the Go example | |
run: make run-go-example | |
- name: Run the Typescript example | |
run: make run-ts-example | |
- 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 | |
- name: Run Python example | |
run: make run-python-example |