From f19b38e67236f894c5dac53bef91dc4f99c1c3b8 Mon Sep 17 00:00:00 2001 From: Kyle Aure Date: Tue, 28 Nov 2023 08:02:08 -0600 Subject: [PATCH 1/4] cleanup workflows --- .github/scripts/checkout.sh | 18 ++++++++ .github/workflows/{java-CI.yml => ci.yml} | 4 +- .github/workflows/pull-request.yml | 38 ++++++++++++++++ .github/workflows/release.yml | 23 +++++++--- .github/workflows/update.yml | 53 +++++++++++++++++++++++ 5 files changed, 130 insertions(+), 6 deletions(-) create mode 100755 .github/scripts/checkout.sh rename .github/workflows/{java-CI.yml => ci.yml} (92%) create mode 100644 .github/workflows/pull-request.yml create mode 100644 .github/workflows/update.yml diff --git a/.github/scripts/checkout.sh b/.github/scripts/checkout.sh new file mode 100755 index 00000000..b8b3643f --- /dev/null +++ b/.github/scripts/checkout.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +if [ $# -ne 1 ]; then + echo "The checkout.sh script requires exactly 1 argument" + exit 1 +fi + +branch=$1 + +if [ "$(git ls-remote --heads origin refs/heads/$branch | wc -l)" -eq "1" ]; then + git fetch origin + git checkout -t origin/$branch + echo "branch_existed=true" >> $GITHUB_OUTPUT +else + git checkout main + git checkout -b $branch + echo "branch_existed=false" >> $GITHUB_OUTPUT +fi diff --git a/.github/workflows/java-CI.yml b/.github/workflows/ci.yml similarity index 92% rename from .github/workflows/java-CI.yml rename to .github/workflows/ci.yml index 7391e360..0329d9f6 100644 --- a/.github/workflows/java-CI.yml +++ b/.github/workflows/ci.yml @@ -14,9 +14,11 @@ permissions: jobs: build: + + # TODO update once 25-ea is available strategy: matrix: - java-version: [ '17', '21' ] + java-version: [ '21' ] runs-on: ubuntu-latest diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml new file mode 100644 index 00000000..5112d848 --- /dev/null +++ b/.github/workflows/pull-request.yml @@ -0,0 +1,38 @@ +# This is a reusable workflow for creating a pull request for an existing branch in github + +name: Create a pull request + +on: + workflow_call: + inputs: + branch: + required: true + type: string + title: + required: true + type: string + body: + required: true + type: string + +jobs: + pull: + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + - name: Check branch + id: check + run: .github/scripts/checkout.sh ${{ inputs.branch }} + - name: Create pull request + if: steps.check.outputs.branch_existed == 'true' + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + gh pr create \ + --base main \ + --head ${{ inputs.branch }} \ + --title "${{ inputs.title }}" \ + --body "${{ inputs.body }}" \ + --label 'bot' diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a64d752a..9a841abc 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -7,29 +7,42 @@ on: types: [published] jobs: - build: + update: runs-on: ubuntu-latest steps: - name: checkout uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - name: Create branch - run: | - git checkout -b update-templates + id: checkout + run: .github/scripts/checkout.sh update-templates-${{ github.sha }} - name: Insert release - ${{ github.event.release.tag_name }} uses: mikefarah/yq@1cf9ecc79df9cabe69ae75a0bbfa7df7f9fe8a2f #v4.40.2 with: cmd: | yq -i '( .body.[] | select(.id == "version") ) ref $x | $x .attributes.options = ["${{ github.event.release.tag_name }}"] + $x .attributes.options' .github/ISSUE_TEMPLATE/bug-report.yml && yq -i '( .body.[] | select(.id == "version") ) ref $x | $x .attributes.options = ["${{ github.event.release.tag_name }}"] + $x .attributes.options' .github/ISSUE_TEMPLATE/tck-challenge.yml - - name: Create Pull Request + - name: Needs updates + id: update + run: echo "update_count=$(git status -s -uno | wc -l)" >> $GITHUB_OUTPUT + - name: Create commit + if: steps.update.outputs.update_count > 0 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | git config user.email "41898282+github-actions[bot]@users.noreply.github.com" git config user.name "github-actions[bot]" + git add .github/ISSUE_TEMPLATE/bug-report.yml git add .github/ISSUE_TEMPLATE/tck-challenge.yml + git commit -m "Update templates to include release ${{ github.event.release.tag_name }}" git push origin update-templates - gh pr create -B main --title 'Update templates to include release ${{ github.event.release.tag_name }}' --body 'Created by Github action' --label 'version' + + pull-request: + needs: [update] + uses: ./.github/workflows/pull-request.yml + with: + branch: 'update-templates-${{ github.sha }}' + title: 'Update templates to include release ${{ github.event.release.tag_name }}' + body: 'generated pull request' \ No newline at end of file diff --git a/.github/workflows/update.yml b/.github/workflows/update.yml new file mode 100644 index 00000000..4ded2d4a --- /dev/null +++ b/.github/workflows/update.yml @@ -0,0 +1,53 @@ +# This workflow automates the deployment of generated files + +name: Update generated files + +on: workflow_dispatch + +jobs: + update: + runs-on: ubuntu-latest + + # TODO update once 25-ea is available + strategy: + max-parallel: 1 + matrix: + java-version: [ '17', '21' ] + + steps: + - name: Checkout source + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + - name: Set up JDK ${{ matrix.java-version }} + uses: actions/setup-java@0ab4596768b603586c0de567f2430c30f5b0d2b0 # v3.13.0 + with: + java-version: ${{ matrix.java-version }} + distribution: 'temurin' + cache: maven + - name: Checkout branch + id: checkout + run: .github/scripts/checkout.sh update-generated-files-${{ github.sha }} + - name: Generate signatures + run: mvn package -Psignature-generation --file tck/pom.xml + ## Add any other automated update steps here + - name: Needs updates + id: update + run: echo "update_count=$(git status -s -uno | wc -l)" >> $GITHUB_OUTPUT + - name: Create commit + if: steps.update.outputs.update_count > 0 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + git config user.email "41898282+github-actions[bot]@users.noreply.github.com" + git config user.name "github-actions[bot]" + + git add tck/src/main/resources/ + git commit -m "Update generated files ${{ matrix.java-version }}" + git push origin update-generated-files-${{ github.sha }} + + pull-request: + needs: [update] + uses: ./.github/workflows/pull-request.yml + with: + branch: 'update-generated-files-${{ github.sha }}' + title: 'Update generated files' + body: 'generated pull request' From b844220b0a66ba314444bdc3ae7cb2e09fcc0cc4 Mon Sep 17 00:00:00 2001 From: Kyle Aure Date: Tue, 28 Nov 2023 08:09:16 -0600 Subject: [PATCH 2/4] cleanup issue templates --- .github/ISSUE_TEMPLATE/bug-report.yml | 6 +++--- .github/ISSUE_TEMPLATE/certification.yml | 8 +++----- .github/ISSUE_TEMPLATE/clarification.yml | 6 +++--- .github/ISSUE_TEMPLATE/release.yml | 4 ++-- .github/ISSUE_TEMPLATE/tck-challenge.yml | 16 +++++++--------- .github/ISSUE_TEMPLATE/use-case.yml | 8 ++++---- 6 files changed, 22 insertions(+), 26 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug-report.yml b/.github/ISSUE_TEMPLATE/bug-report.yml index 1a19f1a3..18ff410d 100644 --- a/.github/ISSUE_TEMPLATE/bug-report.yml +++ b/.github/ISSUE_TEMPLATE/bug-report.yml @@ -17,16 +17,16 @@ body: description: What version of the Concurrency Spec are you running using? options: - 1.0.0-M1 - - 1.0.0-SNAPSHOT (Locally built) + - SNAPSHOT (Locally built) - type: textarea validations: required: true attributes: label: Bug report - value: | + placeholder: | > Description of the bug found. - type: textarea attributes: label: Additional information - value: | + placeholder: | > Proposed solutions, code examples, ect. diff --git a/.github/ISSUE_TEMPLATE/certification.yml b/.github/ISSUE_TEMPLATE/certification.yml index 098df29a..61e5bf85 100644 --- a/.github/ISSUE_TEMPLATE/certification.yml +++ b/.github/ISSUE_TEMPLATE/certification.yml @@ -1,15 +1,13 @@ name: Platform Certification description: Jakarta Data Platform Certification title: "[Certification]: " -labels: ["certification"] #TODO need to add this label +labels: ["certification"] #Verified - label exists body: - type: markdown attributes: value: | - Before submitting a Platform Certification to the Jakarta Data community - please read and be familiar with the - [TCK Process document](https://jakarta.ee/committees/specification/tckprocess) - which may be updated occasionally. + > Before submitting a Platform Certification to the Jakarta Data community please read and be familiar with the + > [TCK Process document](https://jakarta.ee/committees/specification/tckprocess) which may be updated occasionally. - type: input id: organization validations: diff --git a/.github/ISSUE_TEMPLATE/clarification.yml b/.github/ISSUE_TEMPLATE/clarification.yml index 849f25b9..dfa720b7 100644 --- a/.github/ISSUE_TEMPLATE/clarification.yml +++ b/.github/ISSUE_TEMPLATE/clarification.yml @@ -1,6 +1,6 @@ name: Clarification description: Request that some aspect of the specification be clarified. -title: "[Clarification]: " +title: "[clarification]: " labels: ["question"] #Verified - label exists body: - type: markdown @@ -21,10 +21,10 @@ body: required: true attributes: label: I need clarification on ... - value: | + placeholder: | > Description of the clarification needed. - type: textarea attributes: label: Additional information - value: | + placeholder: | > Proposed solutions, code examples, ect. \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/release.yml b/.github/ISSUE_TEMPLATE/release.yml index fbd7f8a6..eb491d42 100644 --- a/.github/ISSUE_TEMPLATE/release.yml +++ b/.github/ISSUE_TEMPLATE/release.yml @@ -1,5 +1,5 @@ name: Release -description: Propose a new minor/major release +description: Propose a new major/minor/milestone release title: "[Release]: " labels: ["release"] #Verified - label exists body: @@ -20,7 +20,7 @@ body: label: Outstanding work description: | Issues / pulls to finish before this release can become generally available. - placeholder: | + value: | - [ ] validations: required: false diff --git a/.github/ISSUE_TEMPLATE/tck-challenge.yml b/.github/ISSUE_TEMPLATE/tck-challenge.yml index dee6e4db..4f684fb7 100644 --- a/.github/ISSUE_TEMPLATE/tck-challenge.yml +++ b/.github/ISSUE_TEMPLATE/tck-challenge.yml @@ -1,15 +1,13 @@ name: TCK Challenge description: Jakarta Data TCK Challenge title: "[TCK Challenge]: " -labels: ["challenge"] #TODO need to add this label +labels: ["challenge"] #Verified - label exists body: - type: markdown attributes: value: | - Before submitting a TCK Challenge to the Jakarta Data community - please read and be familiar with the - [TCK Process document](https://jakarta.ee/committees/specification/tckprocess) - which may be updated occasionally. + > Before submitting a TCK Challenge to the Jakarta Data community please read and be familiar with the + > [TCK Process document](https://jakarta.ee/committees/specification/tckprocess) which may be updated occasionally. - type: input id: specification validations: @@ -35,9 +33,9 @@ body: attributes: label: TCK Version description: What version of the TCK are you running against? - options: #TODO need to update this list per release - - 1.0.0-M1 (Generally available) - - 1.0.0-SNAPSHOT (Locally built) + options: + - 1.0.0-M1 + - SNAPSHOT (Locally built) - type: input id: implementation validations: @@ -69,7 +67,7 @@ body: description: | Describe the challenge in full detail including logs. Tip: You can attach images or log files by clicking this area to highlight it and then dragging files in. - value: | + placeholder: | > Description of issue using markdown syntax - type: textarea id: additionalContext diff --git a/.github/ISSUE_TEMPLATE/use-case.yml b/.github/ISSUE_TEMPLATE/use-case.yml index 0af0328a..aa387276 100644 --- a/.github/ISSUE_TEMPLATE/use-case.yml +++ b/.github/ISSUE_TEMPLATE/use-case.yml @@ -6,7 +6,7 @@ body: - type: markdown attributes: value: | - Describe a new use case for the specification. + > Describe a new use case for the specification. - type: checkboxes attributes: label: As a ... @@ -20,17 +20,17 @@ body: required: true attributes: label: I need to be able to ... - value: | + placeholder: | > Description of the new or different use case - type: textarea validations: required: true attributes: label: Which enables me to ... - value: | + placeholder: | > Description of the added value of this use case - type: textarea attributes: label: Additional information - value: | + placeholder: | > Proposed solutions, code examples, ect. From 0b6850a9b67b1b9f378a3c5e5ec29ebf1ee7a283 Mon Sep 17 00:00:00 2001 From: Kyle Aure Date: Tue, 28 Nov 2023 08:11:08 -0600 Subject: [PATCH 3/4] Add M2 to issues --- .github/ISSUE_TEMPLATE/bug-report.yml | 1 + .github/ISSUE_TEMPLATE/tck-challenge.yml | 1 + 2 files changed, 2 insertions(+) diff --git a/.github/ISSUE_TEMPLATE/bug-report.yml b/.github/ISSUE_TEMPLATE/bug-report.yml index 18ff410d..6bd82de1 100644 --- a/.github/ISSUE_TEMPLATE/bug-report.yml +++ b/.github/ISSUE_TEMPLATE/bug-report.yml @@ -16,6 +16,7 @@ body: label: Specification Version description: What version of the Concurrency Spec are you running using? options: + - 1.0.0-M2 - 1.0.0-M1 - SNAPSHOT (Locally built) - type: textarea diff --git a/.github/ISSUE_TEMPLATE/tck-challenge.yml b/.github/ISSUE_TEMPLATE/tck-challenge.yml index 4f684fb7..4f2e09d8 100644 --- a/.github/ISSUE_TEMPLATE/tck-challenge.yml +++ b/.github/ISSUE_TEMPLATE/tck-challenge.yml @@ -34,6 +34,7 @@ body: label: TCK Version description: What version of the TCK are you running against? options: + - 1.0.0-M2 - 1.0.0-M1 - SNAPSHOT (Locally built) - type: input From 11d2a04e47e1b68ca038ffdacbe5c3c6faa3a67b Mon Sep 17 00:00:00 2001 From: Kyle Aure Date: Tue, 28 Nov 2023 08:16:31 -0600 Subject: [PATCH 4/4] Update link to release.yml workflow --- .github/ISSUE_TEMPLATE/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE/release.yml b/.github/ISSUE_TEMPLATE/release.yml index eb491d42..a416916a 100644 --- a/.github/ISSUE_TEMPLATE/release.yml +++ b/.github/ISSUE_TEMPLATE/release.yml @@ -34,7 +34,7 @@ body: #### Prepare - [X] Open this issue. - [ ] Complete outstanding work - - [ ] (Update TCK Signatures to capture API changes)[https://github.com/jakartaee/data/blob/main/tck/src/main/java/ee/jakarta/tck/data/framework/signature/README.md#generating-the-signature-file] + - [ ] (Update TCK Signatures to capture API changes)[https://github.com/jakartaee/data/actions/workflows/release.yml] #### Stage release - [ ] [Update the CHANGELOG.adoc file to reflect the changes put into the new release](https://github.com/jakartaee/data/blob/main/CHANGELOG.adoc) - [ ] [Build and stage artifacts to staging repository](https://ci.eclipse.org/data/view/Release%20Builds/job/jakarta-data-build-and-stage/)