From 8856e45ecf6c6f15236feb15692b64d3e7049d2e Mon Sep 17 00:00:00 2001 From: Joshua Li Date: Thu, 27 Apr 2023 15:35:30 -0700 Subject: [PATCH] Add github workflows (#35) * Add github workflows Signed-off-by: Joshua Li * Fix env name Signed-off-by: Joshua Li --------- Signed-off-by: Joshua Li --- .github/CODEOWNERS | 2 + .github/ISSUE_TEMPLATE/bug_report.md | 31 ++++++++ .github/ISSUE_TEMPLATE/config.yml | 7 ++ .github/ISSUE_TEMPLATE/feature_request.md | 18 +++++ .github/PULL_REQUEST_TEMPLATE.md | 16 ++++ .github/draft-release-notes-config.yml | 45 +++++++++++ .github/workflows/backport.yml | 28 +++++++ .github/workflows/dco.yml | 18 +++++ .github/workflows/delete_backport_branch.yml | 15 ++++ .../draft-release-notes-workflow.yml | 21 +++++ .github/workflows/link-checker.yml | 24 ++++++ .../sql-workbench-test-build-workflow.yml | 79 +++++++++++++++++++ 12 files changed, 304 insertions(+) create mode 100644 .github/CODEOWNERS create mode 100644 .github/ISSUE_TEMPLATE/bug_report.md create mode 100644 .github/ISSUE_TEMPLATE/config.yml create mode 100644 .github/ISSUE_TEMPLATE/feature_request.md create mode 100644 .github/PULL_REQUEST_TEMPLATE.md create mode 100644 .github/draft-release-notes-config.yml create mode 100644 .github/workflows/backport.yml create mode 100644 .github/workflows/dco.yml create mode 100644 .github/workflows/delete_backport_branch.yml create mode 100644 .github/workflows/draft-release-notes-workflow.yml create mode 100644 .github/workflows/link-checker.yml create mode 100644 .github/workflows/sql-workbench-test-build-workflow.yml diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 00000000..7f92a3c6 --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1,2 @@ +# This should match the owning team set up in https://github.com/orgs/opensearch-project/teams +* @opensearch-project/sql \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 00000000..29eddb95 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,31 @@ +--- +name: 🐛 Bug report +about: Create a report to help us improve +title: '[BUG]' +labels: 'bug, untriaged' +assignees: '' +--- + +**What is the bug?** +A clear and concise description of the bug. + +**How can one reproduce the bug?** +Steps to reproduce the behavior: +1. Go to '...' +2. Click on '....' +3. Scroll down to '....' +4. See error + +**What is the expected behavior?** +A clear and concise description of what you expected to happen. + +**What is your host/environment?** + - OS: [e.g. iOS] + - Version [e.g. 22] + - Plugins + +**Do you have any screenshots?** +If applicable, add screenshots to help explain your problem. + +**Do you have any additional context?** +Add any other context about the problem. diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 00000000..a8199a10 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,7 @@ +contact_links: + - name: OpenSearch Community Support + url: https://discuss.opendistrocommunity.dev/ + about: Please ask and answer questions here. + - name: AWS/Amazon Security + url: https://aws.amazon.com/security/vulnerability-reporting/ + about: Please report security vulnerabilities here. \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 00000000..6198f338 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,18 @@ +--- +name: 🎆 Feature request +about: Request a feature in this project +title: '[FEATURE]' +labels: 'enhancement, untriaged' +assignees: '' +--- +**Is your feature request related to a problem?** +A clear and concise description of what the problem is, e.g. _I'm always frustrated when [...]_ + +**What solution would you like?** +A clear and concise description of what you want to happen. + +**What alternatives have you considered?** +A clear and concise description of any alternative solutions or features you've considered. + +**Do you have any additional context?** +Add any other context or screenshots about the feature request here. \ No newline at end of file diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 00000000..2e325678 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,16 @@ +### Description +[Describe what this change achieves] + +### Issues Resolved +[List any issues this PR will resolve] + +### Check List +- [ ] New functionality includes testing. + - [ ] All tests pass, including unit test, integration test and doctest +- [ ] New functionality has been documented. + - [ ] New functionality has javadoc added + - [ ] New functionality has user manual doc added +- [ ] Commits are signed per the DCO using --signoff + +By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license. +For more information on following Developer Certificate of Origin and signing off your commits, please check [here](https://github.com/opensearch-project/OpenSearch/blob/main/CONTRIBUTING.md#developer-certificate-of-origin). \ No newline at end of file diff --git a/.github/draft-release-notes-config.yml b/.github/draft-release-notes-config.yml new file mode 100644 index 00000000..45ab4a08 --- /dev/null +++ b/.github/draft-release-notes-config.yml @@ -0,0 +1,45 @@ +# The overall template of the release notes +template: | + Compatible with OpenSearch and OpenSearch Dashboards Version $RESOLVED_VERSION + $CHANGES + +# Setting the formatting and sorting for the release notes body +name-template: Version $RESOLVED_VERSION +change-template: "* $TITLE ([#$NUMBER](https://github.com/opensearch-project/dashboards-query-workbench/pull/$NUMBER))" +sort-by: merged_at +sort-direction: ascending +replacers: + - search: '##' + replace: '###' + +# Organizing the tagged PRs into unified ODFE categories +categories: + - title: 'Breaking Changes' + labels: + - 'Breaking Changes' + - title: 'Features' + labels: + - 'feature' + - title: 'Enhancements' + labels: + - 'enhancement' + - title: 'Bug Fixes' + labels: + - 'bug' + - title: 'Infrastructure' + labels: + - 'infra' + - 'test' + - 'dependencies' + - 'github actions' + - title: 'Documentation' + labels: + - 'documentation' + - title: 'Maintenance' + labels: + - "version compatibility" + - "maintenance" + - title: 'Refactoring' + labels: + - 'refactor' + - 'code quality' diff --git a/.github/workflows/backport.yml b/.github/workflows/backport.yml new file mode 100644 index 00000000..e47d8d88 --- /dev/null +++ b/.github/workflows/backport.yml @@ -0,0 +1,28 @@ +name: Backport +on: + pull_request_target: + types: + - closed + - labeled + +jobs: + backport: + runs-on: ubuntu-latest + permissions: + contents: write + pull-requests: write + name: Backport + steps: + - name: GitHub App token + id: github_app_token + uses: tibdex/github-app-token@v1.5.0 + with: + app_id: ${{ secrets.APP_ID }} + private_key: ${{ secrets.APP_PRIVATE_KEY }} + installation_id: 22958780 + + - name: Backport + uses: VachaShah/backport@v1.1.4 + with: + github_token: ${{ steps.github_app_token.outputs.token }} + branch_name: backport/backport-${{ github.event.number }} diff --git a/.github/workflows/dco.yml b/.github/workflows/dco.yml new file mode 100644 index 00000000..cf30ea89 --- /dev/null +++ b/.github/workflows/dco.yml @@ -0,0 +1,18 @@ +name: Developer Certificate of Origin Check + +on: [pull_request] + +jobs: + check: + runs-on: ubuntu-latest + + steps: + - name: Get PR Commits + id: 'get-pr-commits' + uses: tim-actions/get-pr-commits@v1.1.0 + with: + token: ${{ secrets.GITHUB_TOKEN }} + - name: DCO Check + uses: tim-actions/dco@v1.1.0 + with: + commits: ${{ steps.get-pr-commits.outputs.commits }} diff --git a/.github/workflows/delete_backport_branch.yml b/.github/workflows/delete_backport_branch.yml new file mode 100644 index 00000000..387a124b --- /dev/null +++ b/.github/workflows/delete_backport_branch.yml @@ -0,0 +1,15 @@ +name: Delete merged branch of the backport PRs +on: + pull_request: + types: + - closed + +jobs: + delete-branch: + runs-on: ubuntu-latest + if: startsWith(github.event.pull_request.head.ref,'backport/') + steps: + - name: Delete merged branch + uses: SvanBoxel/delete-merged-branch@main + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/draft-release-notes-workflow.yml b/.github/workflows/draft-release-notes-workflow.yml new file mode 100644 index 00000000..2c4567d3 --- /dev/null +++ b/.github/workflows/draft-release-notes-workflow.yml @@ -0,0 +1,21 @@ +name: Release Drafter + +on: + push: + branches: + - main + +jobs: + update_release_draft: + name: Update draft release notes + runs-on: ubuntu-latest + steps: + # Drafts your next Release notes as Pull Requests are merged into "main" + - name: Update draft release notes + uses: release-drafter/release-drafter@v5 + with: + config-name: draft-release-notes-config.yml + tag: (None) + version: x.x.0.0 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/link-checker.yml b/.github/workflows/link-checker.yml new file mode 100644 index 00000000..ed4ce699 --- /dev/null +++ b/.github/workflows/link-checker.yml @@ -0,0 +1,24 @@ +name: Link Checker +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +jobs: + linkchecker: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: lychee Link Checker + id: lychee + uses: lycheeverse/lychee-action@master + with: + args: --accept=200,403,429 "./**/*.html" "./**/*.md" "./**/*.txt" + env: + GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} + - name: Fail if there were link errors + run: exit ${{ steps.lychee.outputs.exit_code }} + diff --git a/.github/workflows/sql-workbench-test-build-workflow.yml b/.github/workflows/sql-workbench-test-build-workflow.yml new file mode 100644 index 00000000..bf5cacdd --- /dev/null +++ b/.github/workflows/sql-workbench-test-build-workflow.yml @@ -0,0 +1,79 @@ +name: Dashboards SQL Query Workbench Test & Build + +on: + pull_request: + push: + branches-ignore: + - 'dependabot/**' + paths: + - '.' + - '.github/workflows/sql-workbench-test-build-workflow.yml' + +env: + PLUGIN_NAME: dashboards-query-workbench + OPENSEARCH_DASHBOARDS_VERSION: '1.3' + OPENSEARCH_PLUGIN_VERSION: 1.3.8.0 + +jobs: + tests: + name: Run unit tests + strategy: + matrix: + os: [ ubuntu-latest, macos-latest, windows-latest ] + runs-on: ${{ matrix.os }} + steps: + # Enable longer filenames for windows + - name: Enable longer filenames + if: ${{ matrix.os == 'windows-latest' }} + run: git config --system core.longpaths true + - name: Checkout OpenSearch Dashboards + uses: actions/checkout@v2 + with: + repository: opensearch-project/OpenSearch-Dashboards + ref: ${{ env.OPENSEARCH_DASHBOARDS_VERSION }} + path: OpenSearch-Dashboards + - name: Get node and yarn versions + id: versions_step + run: | + echo "::set-output name=node_version::$(node -p "(require('./OpenSearch-Dashboards/package.json').engines.node).match(/[.0-9]+/)[0]")" + echo "::set-output name=yarn_version::$(node -p "(require('./OpenSearch-Dashboards/package.json').engines.yarn).match(/[.0-9]+/)[0]")" + - name: Setup node + uses: actions/setup-node@v1 + with: + node-version: ${{ steps.versions_step.outputs.node_version }} + registry-url: 'https://registry.npmjs.org' + - name: Install correct yarn version for OpenSearch Dashboards + run: | + npm uninstall -g yarn + echo "Installing yarn ${{ steps.versions_step.outputs.yarn_version }}" + npm i -g yarn@${{ steps.versions_step.outputs.yarn_version }} + - name: Checkout workbench OpenSearch Dashboards plugin + uses: actions/checkout@v2 + with: + path: OpenSearch-Dashboards/plugins/dashboards-query-workbench + - name: Bootstrap plugin/opensearch-dashboards + run: | + cd OpenSearch-Dashboards/plugins/dashboards-query-workbench + yarn osd bootstrap + - name: Test + run: | + cd OpenSearch-Dashboards/plugins/dashboards-query-workbench + yarn test:jest --coverage + - name: Upload coverage + if: ${{ always() && matrix.os == 'ubuntu-latest' }} + uses: codecov/codecov-action@v3 + with: + flags: dashboards-query-workbench + directory: OpenSearch-Dashboards/plugins/dashboards-query-workbench + token: ${{ secrets.CODECOV_TOKEN }} + - name: Build Artifact + run: | + cd OpenSearch-Dashboards/plugins/dashboards-query-workbench + yarn build + mv ./build/*.zip ./build/${{ env.PLUGIN_NAME }}-${{ env.OPENSEARCH_PLUGIN_VERSION }}.zip + - name: Upload Artifact + if: always() + uses: actions/upload-artifact@v1 # can't update to v3 because upload fails + with: + name: dashboards-query-workbench-${{ matrix.os }} + path: OpenSearch-Dashboards/plugins/dashboards-query-workbench/build