Skip to content
Merged
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
47 changes: 23 additions & 24 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ jobs:
- uses: actions/checkout@v7
with:
fetch-depth: 0
filter: blob:none
- uses: actions/setup-go@v7
id: go
with:
Expand All @@ -33,29 +34,27 @@ jobs:
restore-keys: |
go-v1-${{ runner.os }}-${{ runner.arch }}-${{ steps.go.outputs.go-version }}-${{ hashFiles('go.mod', 'go.sum') }}-
go-v1-${{ runner.os }}-${{ runner.arch }}-${{ steps.go.outputs.go-version }}-
- uses: pkgxdev/setup@v5
- name: Identify the CI toolchain
id: toolchain
run: |
mkdir -p "$HOME/.cache/go-build"
fingerprint="$(
{
go version
pkgx moon --version
} | sha256sum
)"
fingerprint="${fingerprint%% *}"
echo "fingerprint=$fingerprint" >> "$GITHUB_OUTPUT"
echo "CI_TOOLCHAIN=$fingerprint" >> "$GITHUB_ENV"
- name: Restore Moon task results and outputs
id: moon-cache
uses: actions/cache@v6
- uses: moonrepo/setup-toolchain@v0
with:
moon-version: "2.5.5"
- run: mkdir -p "$HOME/.cache/go-build"
- name: Check affected tasks
id: ci
run: moon ci
- name: Report Moon CI results
if: "!cancelled() && steps.ci.outcome != 'skipped'"
uses: moonrepo/run-report-action@v1
with:
access-token: ${{ secrets.GITHUB_TOKEN }}
skip-comment: true
- name: Upload Moon reports
if: always()
uses: actions/upload-artifact@v7
with:
name: moon-reports-${{ github.run_attempt }}
path: |
.moon/cache/hashes
.moon/cache/outputs
key: moon-v1-${{ runner.os }}-${{ runner.arch }}-${{ steps.toolchain.outputs.fingerprint }}-${{ github.sha }}
restore-keys: |
moon-v1-${{ runner.os }}-${{ runner.arch }}-${{ steps.toolchain.outputs.fingerprint }}-
- name: Check
run: pkgx moon run check
.moon/cache/ciReport.json
.moon/cache/runReport.json
if-no-files-found: ignore
include-hidden-files: true
retention-days: 14
3 changes: 1 addition & 2 deletions .moon/tasks/all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ taskOptions:
unixShell: bash
outputStyle: stream
implicitInputs:
- $CI
- $CI_TOOLCHAIN
- /.moon/**/*.yml
- moon.yml
- /.github/workflows/ci.yaml
18 changes: 10 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,17 +145,19 @@ by the application, commonly `traceparent`, `tracestate`, and `baggage`.
[Moon](https://moonrepo.dev) runs the complete project check.

```sh
pkgx moon run check
moon run check
```

CI runs the same check with formatting verification and Go vet. It restores Go
modules, compiler output, and golangci-lint data, saving an updated cache for each
commit. Moon restores only its portable `hashes` and `outputs` directories, keyed
by runner architecture and the resolved Go and Moon toolchain.
CI follows [Moon's CI guide](https://moonrepo.dev/docs/guides/ci): full Git
history, source-based affected selection, and plain `moon ci`. It runs the same
project tasks used locally; aggregate checks and maintenance commands are excluded
from automatic selection. The same `moon.yml` also works as a Listenbox submodule.

Moon hashes Go sources, module files, embedded templates, fixtures, golden files,
and CI configuration inputs before reusing a result. When Moon selects the test
task, Go executes its tests without reusing its own test-result cache.
Go modules, compiler output, and golangci-lint data are cached. Moon task results
are not restored across CI runs. Sources, module files, fixtures, templates, and
configuration determine affected tasks; `$CI` is not an input. CI verifies
formatting, and selected Go tests bypass Go's test-result cache. Native Moon
reports are attached to the workflow, including on failure.

## License

Expand Down
17 changes: 13 additions & 4 deletions moon.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
toolchains:
default: system
fileGroups:
sources:
- go.mod
- go.sum
- ./**/*.go
- internal/**/*.gotmpl
tasks:
mod-download:
inputs:
Expand All @@ -12,7 +18,7 @@ tasks:
cache: true
test:
deps:
- oasmith:mod-download
- ~:mod-download
inputs:
- ./**/*.go
- internal/**/*.gotmpl
Expand All @@ -26,7 +32,7 @@ tasks:
cache: true
lint:
deps:
- oasmith:mod-download
- ~:mod-download
inputs:
- ./**/*.go
- .golangci.yaml
Expand All @@ -48,5 +54,8 @@ tasks:
cache: true
check:
deps:
- oasmith:lint
- oasmith:test
- ~:lint
- ~:test
inputs: []
options:
runInCI: false