diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..d0369b7 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +src/test/resources/** text eol=lf diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 370e80e..5e27162 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -28,57 +28,46 @@ permissions: contents: read jobs: - linting: - name: Check linting - uses: ./.github/workflows/lint.yml + lint: + uses: reqstool/.github/.github/workflows/java-lint.yml@91cd368066d5458b5d46bdf34c4d8ca483f6633f # 1.2.2 + build: - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - reqstool-source: [pypi, main] - steps: - # Full history and tags: Nisse derives the version from git state, so a - # shallow clone would build the wrong number rather than fail. - - uses: actions/checkout@v7.0.1 - with: - persist-credentials: false - fetch-depth: 0 - fetch-tags: true - ref: ${{ inputs.ref || github.ref }} - - name: Set up JDK - uses: actions/setup-java@v6.3.0 - with: - java-version: "21.0.12+8.0.LTS" - distribution: "temurin" - - name: Build and run tests - run: mvn clean verify - - name: Install into local repository - run: mvn -DskipTests install - - name: Self-apply own annotation processor to own sources - run: mvn compiler:compile compiler:testCompile -Pself-apply - - name: Combine main/test annotation processor output - # The processor's main/test annotation outputs land in separate - # generated-sources directories (no shared mojo to combine them, unlike - # the Maven/Gradle plugins) -- merge them the same way those plugins' - # combineOutput() would, so reqstool status has real, non-fabricated data. - run: | - scripts/combine-annotations.sh \ - target/generated-sources/annotations/resources/annotations.yml \ - target/generated-test-sources/test-annotations/resources/annotations.yml \ - target/reqstool/annotations.yml - - name: Install reqstool - uses: reqstool/.github/.github/actions/install-reqstool@6fc8d3e3d4c3fdf7a83cb7b7a274e4761486ca71 # 1.2.1 - with: - reqstool-source: ${{ matrix.reqstool-source }} - - name: Validate reqstool spec completeness - # not yet available in the latest PyPI release - if: matrix.reqstool-source == 'main' - uses: reqstool/.github/.github/actions/validate-reqstool@6fc8d3e3d4c3fdf7a83cb7b7a274e4761486ca71 # 1.2.1 - - name: Run reqstool status - uses: reqstool/.github/.github/actions/reqstool-status@6fc8d3e3d4c3fdf7a83cb7b7a274e4761486ca71 # 1.2.1 - with: - fail-if-incomplete: "true" + needs: lint + uses: reqstool/.github/.github/workflows/java-build-maven.yml@91cd368066d5458b5d46bdf34c4d8ca483f6633f # 1.2.2 + with: + ref: ${{ inputs.ref }} + artifact-name: ${{ inputs.artifact-name || 'dist' }} + post-test-command: | + mvn --batch-mode -DskipTests install + mvn --batch-mode compiler:compile compiler:testCompile -Pself-apply + scripts/combine-annotations.sh \ + target/generated-sources/annotations/resources/annotations.yml \ + target/generated-test-sources/test-annotations/resources/annotations.yml \ + target/reqstool/annotations.yml + + reqstool: + needs: build + uses: reqstool/.github/.github/workflows/common-reqstool-verify.yml@91cd368066d5458b5d46bdf34c4d8ca483f6633f # 1.2.2 + with: + build-artifact: ${{ inputs.artifact-name || 'dist' }}-build + build-directory: target + + smoke: + needs: build + uses: reqstool/.github/.github/workflows/java-smoke.yml@91cd368066d5458b5d46bdf34c4d8ca483f6633f # 1.2.2 + with: + command: mvn --batch-mode verify validate-openspec: uses: reqstool/.github/.github/workflows/common-validate-openspec.yml@6fc8d3e3d4c3fdf7a83cb7b7a274e4761486ca71 # 1.2.1 + + ci: + if: ${{ always() }} + needs: [lint, build, reqstool, smoke, validate-openspec] + runs-on: ubuntu-latest + steps: + - name: Fail unless every needed job succeeded + env: + NEEDS: ${{ toJSON(needs) }} + run: | + echo "$NEEDS" | python3 -c 'import json,sys; r={k:v["result"] for k,v in json.load(sys.stdin).items()}; print(r); sys.exit(0 if all(v=="success" for v in r.values()) else 1)' diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml deleted file mode 100644 index 2f3d288..0000000 --- a/.github/workflows/lint.yml +++ /dev/null @@ -1,21 +0,0 @@ -name: Linting - -on: - workflow_call: - -jobs: - linting: - runs-on: ubuntu-latest - - steps: - - name: Checkout code - uses: actions/checkout@v7.0.1 - - - name: Set up JDK - uses: actions/setup-java@v6.3.0 - with: - distribution: "temurin" - java-version: "21.0.12+8.0.LTS" - - - name: Run linting - run: mvn clean validate diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index a4978ca..17a9ab5 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -6,7 +6,7 @@ For DCO sign-off, commit conventions, and code review process, see the organizat ## Prerequisites -- Java 21+ +- Java 25+ - Maven 3.9+ - [reqstool](https://github.com/reqstool/reqstool-client) (`pipx install reqstool`) - [OpenSpec](https://github.com/Fission-AI/OpenSpec) (`npm install -g @fission-ai/openspec`) diff --git a/pom.xml b/pom.xml index e293e99..b0cc9ae 100644 --- a/pom.xml +++ b/pom.xml @@ -49,9 +49,9 @@ Eclipse Adoptium - 21 - 21 - 21 + 25 + 25 + 25 diff --git a/src/main/java/io/github/reqstool/processor/AbstractAnnotationsProcessor.java b/src/main/java/io/github/reqstool/processor/AbstractAnnotationsProcessor.java index 0a87485..27418cc 100644 --- a/src/main/java/io/github/reqstool/processor/AbstractAnnotationsProcessor.java +++ b/src/main/java/io/github/reqstool/processor/AbstractAnnotationsProcessor.java @@ -132,8 +132,7 @@ private boolean exportToYAML() { processingEnv.getMessager() .printMessage(Diagnostic.Kind.NOTE, "Writing Requirements Annotations data to: " + file.getName()); - // write JSON schema - writer.write(YAML_LANG_SERVER_SCHEMA_INFO + System.lineSeparator()); + writer.write(YAML_LANG_SERVER_SCHEMA_INFO + "\n"); // write serialized result om.writeValue(writer, result);