Skip to content

Commit

Permalink
Merge pull request #1 from alexeagle/ci
Browse files Browse the repository at this point in the history
ci: verify that generated project can build and test
  • Loading branch information
alexeagle authored May 10, 2024
2 parents b25c1e7 + e460da1 commit e8a3e18
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 5 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '>=1.22'
- uses: bazel-contrib/[email protected]
with:
bazelisk-cache: true
repository-cache: true
- run: go install github.com/hay-kot/[email protected]
- name: Scaffold new kitchen-sink app
id: kitchen-sink
run: |
scaffold new --preset=kitchen-sink --no-prompt $GITHUB_WORKSPACE
cd scaffold_test*
git init
echo "::set-output name=dir::$PWD"
- name: Test kitchen-sink
working-directory: "${{ steps.kitchen-sink.outputs.dir }}"
run: |
bazel test ...
bazel run format
10 changes: 6 additions & 4 deletions scaffold.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,13 @@ questions:
multi: true
message: "Languages to be used in the project"
options:
- "javascript"
- "go"
- "python"
- "java"
- JavaScript
- TypeScript
features:
- value: "{{ .Scaffold.fmt }}"
globs:
- "**/tools/format/*"
presets:
kitchen-sink:
fmt: true
langs: ['JavaScript', 'TypeScript']
6 changes: 5 additions & 1 deletion {{ .ProjectSnake }}/.aspect/cli/config.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
configure:
languages:
javascript: false
{{- range .Scaffold.langs}}
{{- if eq . "JavaScript"}}
javascript: true
{{- end}}
{{- end}}
35 changes: 35 additions & 0 deletions {{ .ProjectSnake }}/MODULE.bazel
Original file line number Diff line number Diff line change
@@ -1,7 +1,42 @@
bazel_dep(name = "aspect_bazel_lib", version = "2.7.1")
bazel_dep(name = "aspect_rules_lint", version = "0.18.0")
bazel_dep(name = "rules_multitool", version = "0.7.1")
{{- range .Scaffold.langs}}
{{- if eq . "JavaScript"}}
bazel_dep(name = "aspect_rules_js", version = "1.32.6")
{{- end}}
{{- if eq . "TypeScript"}}
bazel_dep(name = "aspect_rules_ts", version = "2.3.0")
{{- end}}
{{- end}}

multitool = use_extension("@rules_multitool//multitool:extension.bzl", "multitool")
multitool.hub(lockfile = "//tools:tools.lock.json")
use_repo(multitool, "multitool")

{{- range .Scaffold.langs}}
{{- if eq . "JavaScript"}}
pnpm = use_extension("@aspect_rules_js//npm:extensions.bzl", "pnpm")
# Allows developers to get a local node_modules tree, using
# bazel run -- @pnpm//:pnpm --dir $PWD install
use_repo(pnpm, "pnpm")

npm = use_extension("@aspect_rules_js//npm:extensions.bzl", "npm")
npm.npm_translate_lock(
name = "npm",
npmrc = "//:.npmrc",
pnpm_lock = "//:pnpm-lock.yaml",
)
use_repo(npm, "npm")
{{- end}}

{{- if eq . "TypeScript"}}
rules_ts_ext = use_extension(
"@aspect_rules_ts//ts:extensions.bzl",
"ext",
dev_dependency = True,
)
rules_ts_ext.deps()
use_repo(rules_ts_ext, "npm_typescript")
{{- end}}
{{- end}}

0 comments on commit e8a3e18

Please sign in to comment.