From cca4ddffb56ad94f28d15e4604ce587419475a10 Mon Sep 17 00:00:00 2001 From: brunosouzas-agent Date: Thu, 3 Dec 2026 19:28:35 +0000 Subject: [PATCH 1/3] ci: add the shared CI workflows and this repository's checks Co-Authored-By: Claude Sonnet 5.5 --- .github/workflows/actionlint.yml | 33 ++++++++++++ .github/workflows/ci.yml | 41 ++++++++++++++ .github/workflows/mule-extension.yml | 80 ++++++++++++++++++++++++++++ .github/workflows/openspec.yml | 32 +++++++++++ AGENTS.md | 7 ++- README.md | 26 ++++++++- 6 files changed, 216 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/actionlint.yml create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/mule-extension.yml create mode 100644 .github/workflows/openspec.yml diff --git a/.github/workflows/actionlint.yml b/.github/workflows/actionlint.yml new file mode 100644 index 0000000..99704e4 --- /dev/null +++ b/.github/workflows/actionlint.yml @@ -0,0 +1,33 @@ +name: actionlint + +# Reusable workflow: lints the caller's .github/workflows with a pinned, checksum-checked actionlint. +# The required check is named " / lint". + +on: + workflow_call: {} + +permissions: {} + +jobs: + lint: + runs-on: ubuntu-24.04 + timeout-minutes: 10 + permissions: + contents: read + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + - name: actionlint + env: + ACTIONLINT_VERSION: 1.7.12 + ACTIONLINT_SHA256: 8aca8db96f1b94770f1b0d72b6dddcb1ebb8123cb3712530b08cc387b349a3d8 + run: | + set -euo pipefail + cd "$RUNNER_TEMP" + curl -fsSLo actionlint.tar.gz --retry 3 \ + "https://github.com/rhysd/actionlint/releases/download/v${ACTIONLINT_VERSION}/actionlint_${ACTIONLINT_VERSION}_linux_amd64.tar.gz" + echo "${ACTIONLINT_SHA256} actionlint.tar.gz" | sha256sum -c - + tar -xzf actionlint.tar.gz actionlint + cd "$GITHUB_WORKSPACE" + "$RUNNER_TEMP/actionlint" -color diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..cdb8b05 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,41 @@ +name: CI + +# The checks of this repository (AGENTS.md, Test). +on: + pull_request: + push: + branches: [main] + +permissions: {} + +concurrency: + group: ci-${{ github.ref }} + cancel-in-progress: ${{ github.event_name == 'pull_request' }} + +jobs: + workflows: + uses: ./.github/workflows/actionlint.yml + permissions: + contents: read + + brand: + runs-on: ubuntu-24.04 + timeout-minutes: 10 + permissions: + contents: read + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + - uses: actions/setup-node@8fccf151e3ba8038c300f83b40c8fd1e94f9c5ce # v7.2.0 + with: + node-version: 22 + package-manager-cache: false + - name: The brand files match their specs + run: | + set -euo pipefail + npm ci --prefix brand --ignore-scripts --no-audit --no-fund + npm run check --prefix brand + - name: The issue forms are valid YAML + run: | + ruby -ryaml -e 'Dir[".github/ISSUE_TEMPLATE/*.yml"].each { |f| YAML.load_file(f) }' diff --git a/.github/workflows/mule-extension.yml b/.github/workflows/mule-extension.yml new file mode 100644 index 0000000..27a5a9d --- /dev/null +++ b/.github/workflows/mule-extension.yml @@ -0,0 +1,80 @@ +name: mule-extension + +# Reusable workflow: builds and tests a tenavu connector (`mule-extension` packaging) with +# `mvn clean verify`. It needs no secret: every artifact comes from Maven Central and MuleSoft's +# public releases repository, and the tests run on the CE runtime, so a pull request from a fork +# gets the same run. Tests that need the EE runtime stay behind a Maven profile and do not run here. +# The required check is named " / verify". +# +# With check-contract-files, it first checks that the caller's copies of tenavu-contract files equal +# the commit it pins (the caller's scripts/contract-files.sh); the contract vectors themselves run in +# the build, as the caller's tests. + +on: + workflow_call: + inputs: + check-contract-files: + description: Compare the caller's copies of tenavu-contract files with the pinned commit + type: boolean + default: false + +permissions: {} + +env: + # The hosted image's Maven is not pinned; mule-extensions-maven-plugin needs a 3.9 Maven. + MAVEN_VERSION: 3.9.11 + MAVEN_SHA512: bcfe4fe305c962ace56ac7b5fc7a08b87d5abd8b7e89027ab251069faebee516b0ded8961445d6d91ec1985dfe30f8153268843c89aa392733d1a3ec956c9978 + # Every mvn reads these (Maven 3.9 MAVEN_ARGS), the invoker's applications too: a slow or silent + # repository fails a request in minutes and is retried, instead of holding the job until its timeout. + MAVEN_ARGS: >- + -B -ntp + -Daether.connector.connectTimeout=30000 + -Daether.connector.requestTimeout=120000 + -Daether.connector.http.retryHandler.count=5 + +jobs: + verify: + runs-on: ubuntu-24.04 + timeout-minutes: 30 + permissions: + contents: read + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + - name: Check out the contract + if: inputs.check-contract-files + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + repository: tenavu/tenavu-contract + path: .tenavu-contract + # The pinned commit may be any commit of the contract. + fetch-depth: 0 + persist-credentials: false + - name: The contract copies equal the pinned commit + if: inputs.check-contract-files + run: | + set -euo pipefail + mv .tenavu-contract "$RUNNER_TEMP/tenavu-contract" + # A commit that only a branch or pull request of the contract holds is not accepted. + commit="$(tr -d '[:space:]' < src/test/resources/contract/commit)" + git -C "$RUNNER_TEMP/tenavu-contract" merge-base --is-ancestor "$commit" origin/main || + { echo "::error::the pinned contract commit is not on tenavu-contract's main"; exit 1; } + scripts/contract-files.sh check "$RUNNER_TEMP/tenavu-contract" + - uses: actions/setup-java@d1374f8ac74474200d16ef8ecee22c7ae7a51880 # v6.3.0 + with: + distribution: temurin + java-version: 17 + cache: maven + - name: Maven ${{ env.MAVEN_VERSION }} + run: | + set -euo pipefail + archive="$RUNNER_TEMP/maven.tar.gz" + curl -fsSL --retry 3 -o "$archive" \ + "https://archive.apache.org/dist/maven/maven-3/${MAVEN_VERSION}/binaries/apache-maven-${MAVEN_VERSION}-bin.tar.gz" + echo "${MAVEN_SHA512} ${archive}" | sha512sum -c - + mkdir -p "$RUNNER_TEMP/maven" + tar -xzf "$archive" -C "$RUNNER_TEMP/maven" --strip-components=1 + echo "$RUNNER_TEMP/maven/bin" >>"$GITHUB_PATH" + - name: Build and test + run: mvn clean verify diff --git a/.github/workflows/openspec.yml b/.github/workflows/openspec.yml new file mode 100644 index 0000000..a903c66 --- /dev/null +++ b/.github/workflows/openspec.yml @@ -0,0 +1,32 @@ +name: openspec + +# Reusable workflow: validates every OpenSpec spec and change of the caller, strictly. +# The required check is named " / validate". + +on: + workflow_call: {} + +permissions: {} + +jobs: + validate: + runs-on: ubuntu-24.04 + timeout-minutes: 10 + permissions: + contents: read + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + - uses: actions/setup-node@8fccf151e3ba8038c300f83b40c8fd1e94f9c5ce # v7.2.0 + with: + node-version: 22 + package-manager-cache: false + - name: openspec validate + env: + OPENSPEC_VERSION: 1.14.1 + OPENSPEC_TELEMETRY: "0" + run: | + set -euo pipefail + npm install --global --ignore-scripts --no-audit --no-fund "@fission-ai/openspec@${OPENSPEC_VERSION}" + openspec validate --all --strict --no-interactive diff --git a/AGENTS.md b/AGENTS.md index c62357a..5f397ae 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -5,7 +5,7 @@ the organization, the brand assets and the organization profile. ## Technology -Stack: Markdown, GitHub community health files, JavaScript (Node 22, `brand/`), SVG +Stack: Markdown, GitHub community health files, GitHub Actions, JavaScript (Node 22, `brand/`), SVG Standards: none Delivery: A live Integration branch: `main` @@ -18,7 +18,8 @@ Article: none - Build: `npm ci --prefix brand --ignore-scripts && npm run build --prefix brand` (needs Chrome) - Test: `ruby -ryaml -e 'Dir[".github/ISSUE_TEMPLATE/*.yml"].each { |f| YAML.load_file(f) }'`; - every relative link in a Markdown file points at a file that exists; `npm run check --prefix brand` + every relative link in a Markdown file points at a file that exists; `npm run check --prefix brand`; `actionlint` on `.github/workflows/`. CI (`.github/workflows/ci.yml`) + runs `actionlint`, the brand check and the issue form check on every pull request - Run locally: not applicable - Deliver and verify: a merge into `main` is live. Check, for `tenavu-log` and `tenavu-contract`, @@ -31,6 +32,8 @@ Article: none ## Rules for this repository - Repository text is in English. +- The workflows with `on: workflow_call` are called by the other tenavu repositories, pinned by + commit SHA: a change to an input or a job name changes every caller (and its required checks). - The profile lists no install snippet before the first publication, and its product table and the sentence under it are updated by hand when a status changes or a version is published (no version column: it scrolls sideways on a phone). diff --git a/README.md b/README.md index 7de0ba6..3477de7 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # tenavu/.github -Community files, brand and organization profile of the +Community files, brand, organization profile and shared CI of the [tenavu](https://github.com/tenavu) family of open-source Mule 4 connectors. ## What is here @@ -11,12 +11,36 @@ Community files, brand and organization profile of the | [`.github/ISSUE_TEMPLATE/`](.github/ISSUE_TEMPLATE), [`.github/pull_request_template.md`](.github/pull_request_template.md) | Issue forms and pull request template | Same default | | [`brand/`](brand) | Logo, icons, banners and social images, built from specs | Uploaded by hand or linked; see its [README](brand/README.md) | | [`profile/README.md`](profile/README.md) | Organization profile, written by hand | Shown on [github.com/tenavu](https://github.com/tenavu) | +| [`.github/workflows/`](.github/workflows) | Reusable CI workflows, and this repository's own `ci.yml` | Called by each repository; see [Reusable workflows](#reusable-workflows) | | [`TRADEMARKS.md`](TRADEMARKS.md) | Use of the name and logos | Linked from `CONTRIBUTING.md`, `NOTICE` and the profile; not a GitHub default | A repository overrides a default by adding its own file. Issue forms are all or nothing: any file in a repository's own `.github/ISSUE_TEMPLATE/` replaces every default one. `LICENSE` is never inherited: each repository carries its own. +## Reusable workflows + +None takes a secret, so a pull request from a fork runs the same checks. Call them from a job +under `on: pull_request` and `push` to `main`, pinned by the full commit SHA, with +`permissions: { contents: read }` on the job. + +| Workflow | What it runs | Check name | +|---|---|---| +| [`mule-extension.yml`](.github/workflows/mule-extension.yml) | `mvn clean verify` on Java 17; with `check-contract-files: true`, first compares the `tenavu-contract` copies with the pinned commit | ` / verify` | +| [`openspec.yml`](.github/workflows/openspec.yml) | `openspec validate --all --strict` | ` / validate` | +| [`actionlint.yml`](.github/workflows/actionlint.yml) | `actionlint` on the caller's workflows | ` / lint` | + +```yaml +jobs: + build: + uses: tenavu/.github/.github/workflows/mule-extension.yml@ # main, + permissions: + contents: read +``` + +A required check is named after the caller's job and the job above (`build / verify`); renaming +either changes the repository's ruleset too. + ## License [Apache-2.0](LICENSE), except the tenavu name, logos and the images and specs in `brand/` (see From acf21eb5df71f2be30c68f09ea78e839593e75e2 Mon Sep 17 00:00:00 2001 From: brunosouzas-agent Date: Thu, 3 Dec 2026 19:48:03 +0000 Subject: [PATCH 2/3] ci: record the required checks and how a shared workflow is delivered Co-Authored-By: Claude Sonnet 5.5 --- .github/workflows/mule-extension.yml | 2 +- .github/workflows/openspec.yml | 1 + AGENTS.md | 6 +++++- CONTRIBUTING.md | 4 ++++ README.md | 4 +++- 5 files changed, 14 insertions(+), 3 deletions(-) diff --git a/.github/workflows/mule-extension.yml b/.github/workflows/mule-extension.yml index 27a5a9d..4678c52 100644 --- a/.github/workflows/mule-extension.yml +++ b/.github/workflows/mule-extension.yml @@ -70,7 +70,7 @@ jobs: run: | set -euo pipefail archive="$RUNNER_TEMP/maven.tar.gz" - curl -fsSL --retry 3 -o "$archive" \ + curl -fsSL --retry 3 --connect-timeout 30 --max-time 300 -o "$archive" \ "https://archive.apache.org/dist/maven/maven-3/${MAVEN_VERSION}/binaries/apache-maven-${MAVEN_VERSION}-bin.tar.gz" echo "${MAVEN_SHA512} ${archive}" | sha512sum -c - mkdir -p "$RUNNER_TEMP/maven" diff --git a/.github/workflows/openspec.yml b/.github/workflows/openspec.yml index a903c66..b82a95b 100644 --- a/.github/workflows/openspec.yml +++ b/.github/workflows/openspec.yml @@ -26,6 +26,7 @@ jobs: env: OPENSPEC_VERSION: 1.14.1 OPENSPEC_TELEMETRY: "0" + # Only the CLI is pinned: it publishes no lockfile, and the job holds no secret. run: | set -euo pipefail npm install --global --ignore-scripts --no-audit --no-fund "@fission-ai/openspec@${OPENSPEC_VERSION}" diff --git a/AGENTS.md b/AGENTS.md index 5f397ae..68fc203 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -21,7 +21,11 @@ Article: none every relative link in a Markdown file points at a file that exists; `npm run check --prefix brand`; `actionlint` on `.github/workflows/`. CI (`.github/workflows/ci.yml`) runs `actionlint`, the brand check and the issue form check on every pull request - Run locally: not applicable -- Deliver and verify: a merge into `main` is live. Check, +- Required checks on `main`: `brand`, `workflows / lint`. Renaming a job changes the ruleset +- Deliver and verify: a merge into `main` is live, except a `workflow_call` file, which reaches a + repository only when it re-pins. Before merging a change to one, get a green run of a caller branch + pinned to the new commit; after merging, re-pin each caller (`tenavu-log` calls all three, + `tenavu-contract` calls `actionlint.yml`) and check its run on `main`. For the rest, check, for `tenavu-log` and `tenavu-contract`, `gh api repos/tenavu//community/profile` (contributing, code of conduct, templates) and `gh api graphql -f query='{repository(owner:"tenavu",name:""){isSecurityPolicyEnabled securityPolicyUrl}}'`, diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e002193..837b633 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -27,6 +27,10 @@ By taking part you agree to the [Code of Conduct](https://github.com/tenavu/.git numbers once releases are automated. 5. Sign off every commit (below). +CI runs on every pull request, with no secret. On your first contribution a maintainer has to +approve the run. A change under `.github/workflows/` can change what a check does, so a maintainer +reviews it line by line. + Write code, documentation, commits and messages in English. Never put real secrets, real personal data or an employer's code or data in a commit, a test or an issue. diff --git a/README.md b/README.md index 3477de7..f8f0326 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,9 @@ never inherited: each repository carries its own. ## Reusable workflows -None takes a secret, so a pull request from a fork runs the same checks. Call them from a job +None takes a secret, by decision: a public repository holds no MuleSoft EE credential, tests run +on the CE runtime, and a pull request from a fork runs the same checks (after a maintainer approves +a first-time contributor's run). Call them from a job under `on: pull_request` and `push` to `main`, pinned by the full commit SHA, with `permissions: { contents: read }` on the job. From 112ab0ccd04e84481df8213cff2980a5132c8976 Mon Sep 17 00:00:00 2001 From: brunosouzas-agent Date: Thu, 3 Dec 2026 20:21:12 +0000 Subject: [PATCH 3/3] docs: say what the contract copies check needs Co-Authored-By: Claude Sonnet 5.5 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f8f0326..792fe0f 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ under `on: pull_request` and `push` to `main`, pinned by the full commit SHA, wi | Workflow | What it runs | Check name | |---|---|---| -| [`mule-extension.yml`](.github/workflows/mule-extension.yml) | `mvn clean verify` on Java 17; with `check-contract-files: true`, first compares the `tenavu-contract` copies with the pinned commit | ` / verify` | +| [`mule-extension.yml`](.github/workflows/mule-extension.yml) | `mvn clean verify` on Java 17; with `check-contract-files: true`, first compares the `tenavu-contract` copies with the commit in `src/test/resources/contract/commit`, using the caller's `scripts/contract-files.sh`; that commit must be on the contract's `main` | ` / verify` | | [`openspec.yml`](.github/workflows/openspec.yml) | `openspec validate --all --strict` | ` / validate` | | [`actionlint.yml`](.github/workflows/actionlint.yml) | `actionlint` on the caller's workflows | ` / lint` |