From 74444cd216ecfae50ca14b39db86695d7e4e6fc9 Mon Sep 17 00:00:00 2001 From: Yuvraj Date: Sat, 5 Jun 2021 00:26:55 +0530 Subject: [PATCH] Init boilerplate (#21) Signed-off-by: Yuvraj --- .circleci/config.yml | 49 ------------- .github/config.yml | 15 ++++ .github/workflows/boilerplate-automation.yml | 36 +++++++++ Makefile | 10 +++ PULL_REQUEST_TEMPLATE.md | 34 ++++++++- .../flyte/pull_request_template/Readme.rst | 8 ++ .../pull_request_template.md | 32 ++++++++ .../flyte/pull_request_template/update.sh | 12 +++ boilerplate/flyte/welcome_bot/Readme.rst | 8 ++ boilerplate/flyte/welcome_bot/config.yml | 15 ++++ boilerplate/flyte/welcome_bot/update.sh | 15 ++++ boilerplate/update.cfg | 3 + boilerplate/update.sh | 73 +++++++++++++++++++ 13 files changed, 258 insertions(+), 52 deletions(-) delete mode 100644 .circleci/config.yml create mode 100644 .github/config.yml create mode 100644 .github/workflows/boilerplate-automation.yml create mode 100644 Makefile create mode 100644 boilerplate/flyte/pull_request_template/Readme.rst create mode 100644 boilerplate/flyte/pull_request_template/pull_request_template.md create mode 100755 boilerplate/flyte/pull_request_template/update.sh create mode 100644 boilerplate/flyte/welcome_bot/Readme.rst create mode 100644 boilerplate/flyte/welcome_bot/config.yml create mode 100755 boilerplate/flyte/welcome_bot/update.sh create mode 100755 boilerplate/update.cfg create mode 100755 boilerplate/update.sh diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index 3460d1971..000000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,49 +0,0 @@ -version: 2 - -jobs: - build: - - working_directory: ~/flytekit-java - - docker: - - image: circleci/openjdk:8-jdk-stretch - auth: - username: spotifyci - password: $DOCKERHUB_TOKEN - - steps: - - - checkout - - - run: - name: Generate cumulative pom.xml checksum - command: sha256sum pom.xml */pom.xml | sort > ~/pom-checksum - when: always - - - restore_cache: - keys: - - flytekit-java-{{ checksum "~/pom-checksum" }} - - flytekit-java- - - - run: mvn dependency:go-offline compile - - # run static checks first for faster feedback - - run: mvn spotless:check checkstyle:check - - run: mvn -Ddockerfile.skip verify - - - run: - name: Save test results - command: | - mkdir -p ~/test-results/junit/ - find . -type f -regex ".*/target/surefire-reports/.*xml" -exec cp {} ~/test-results/junit/ \; - when: always - - - store_test_results: - path: ~/test-results - - - save_cache: - paths: - - ~/.m2 - - ~/.sbt - key: flytekit-java-{{ checksum "~/pom-checksum" }} - diff --git a/.github/config.yml b/.github/config.yml new file mode 100644 index 000000000..f99bcd78f --- /dev/null +++ b/.github/config.yml @@ -0,0 +1,15 @@ +# Comment to be posted on PRs from first-time contributors in your repository +newPRWelcomeComment: > + Thank you for opening this pull request! 🙌 + + These tips will help get your PR across the finish line: + - Most of the repos have a PR template; if not, fill it out to the best of your knowledge. + - Sign off your commits (Reference: [DCO Guide](https://github.com/src-d/guide/blob/master/developer-community/fix-DCO.md)). + +# Comment to be posted to on pull requests merged by a first time user +firstPRMergeComment: > + Congrats on merging your first pull request! 🎉 + +# Comment to be posted on first-time issues +newIssueWelcomeComment: > + Thank you for opening your first issue here! 🛠 diff --git a/.github/workflows/boilerplate-automation.yml b/.github/workflows/boilerplate-automation.yml new file mode 100644 index 000000000..c6c8a2a53 --- /dev/null +++ b/.github/workflows/boilerplate-automation.yml @@ -0,0 +1,36 @@ +name: Update Boilerplate Automation +on: + workflow_dispatch: + +jobs: + update-boilerplate: + name: Update Boilerplate + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: "0" + - name: Update Boilerplate + run: | + make update_boilerplate + - name: Create Pull Request + id: cpr + uses: peter-evans/create-pull-request@v3 + with: + token: ${{ secrets.FLYTE_BOT_PAT }} + commit-message: Update Boilerplate + committer: Flyte-Bot + author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com> + signoff: true + branch: flyte-bot-update-boilerplate + delete-branch: true + title: 'Update Boilerplate' + body: | + Update Boilerplate + - Auto-generated by [flyte-bot] + labels: | + boilerplate + team-reviewers: | + owners + maintainers + draft: false \ No newline at end of file diff --git a/Makefile b/Makefile new file mode 100644 index 000000000..227027585 --- /dev/null +++ b/Makefile @@ -0,0 +1,10 @@ +export REPOSITORY=flytekit-java + +GIT_VERSION := $(shell git describe --always --tags) +GIT_HASH := $(shell git rev-parse --short HEAD) +TIMESTAMP := $(shell date '+%Y-%m-%d') + +.PHONY: update_boilerplate +update_boilerplate: + @curl https://raw.githubusercontent.com/flyteorg/boilerplate/master/boilerplate/update.sh -o boilerplate/update.sh + @boilerplate/update.sh \ No newline at end of file diff --git a/PULL_REQUEST_TEMPLATE.md b/PULL_REQUEST_TEMPLATE.md index 60a55ec13..d7699558b 100644 --- a/PULL_REQUEST_TEMPLATE.md +++ b/PULL_REQUEST_TEMPLATE.md @@ -1,4 +1,32 @@ -We are not currently accepting external code contributions to this project. -Please feel free to file bugs and feature requests using GitHub's issue tracker. +## Read then delete -See [CONTRIBUTING.md](https://github.com/spotify/flytekit-java/blob/master/CONTRIBUTING.md). +- Make sure to use a concise title for the pull-request. +- Use #patch, #minor or #major in the pull-request title to bump the corresponding version. Otherwise, the patch version +will be bumped. [More details](https://github.com/marketplace/actions/github-tag-bump) + +# TL;DR +_Please replace this text with a description of what this PR accomplishes._ + +## Type + - [ ] Bug Fix + - [ ] Feature + - [ ] Plugin + +## Are all requirements met? + + - [ ] Code completed + - [ ] Smoke tested + - [ ] Unit tests added + - [ ] Code documentation added + - [ ] Any pending items have an associated Issue + +## Complete description + _How did you fix the bug, make the feature etc. Link to any design docs etc_ + +## Tracking Issue +https://github.com/flyteorg/flyte/issues/ + +## Follow-up issue +_NA_ +OR +_https://github.com/flyteorg/flyte/issues/_ diff --git a/boilerplate/flyte/pull_request_template/Readme.rst b/boilerplate/flyte/pull_request_template/Readme.rst new file mode 100644 index 000000000..ee5443725 --- /dev/null +++ b/boilerplate/flyte/pull_request_template/Readme.rst @@ -0,0 +1,8 @@ +Pull Request Template +~~~~~~~~~~~~~~~~~~~~~ + +Provides a Pull Request template. + +**To Enable:** + +Add ``flyteorg/golang_test_targets`` to your ``boilerplate/update.cfg`` file. diff --git a/boilerplate/flyte/pull_request_template/pull_request_template.md b/boilerplate/flyte/pull_request_template/pull_request_template.md new file mode 100644 index 000000000..d7699558b --- /dev/null +++ b/boilerplate/flyte/pull_request_template/pull_request_template.md @@ -0,0 +1,32 @@ +## Read then delete + +- Make sure to use a concise title for the pull-request. +- Use #patch, #minor or #major in the pull-request title to bump the corresponding version. Otherwise, the patch version +will be bumped. [More details](https://github.com/marketplace/actions/github-tag-bump) + +# TL;DR +_Please replace this text with a description of what this PR accomplishes._ + +## Type + - [ ] Bug Fix + - [ ] Feature + - [ ] Plugin + +## Are all requirements met? + + - [ ] Code completed + - [ ] Smoke tested + - [ ] Unit tests added + - [ ] Code documentation added + - [ ] Any pending items have an associated Issue + +## Complete description + _How did you fix the bug, make the feature etc. Link to any design docs etc_ + +## Tracking Issue +https://github.com/flyteorg/flyte/issues/ + +## Follow-up issue +_NA_ +OR +_https://github.com/flyteorg/flyte/issues/_ diff --git a/boilerplate/flyte/pull_request_template/update.sh b/boilerplate/flyte/pull_request_template/update.sh new file mode 100755 index 000000000..051e9dbce --- /dev/null +++ b/boilerplate/flyte/pull_request_template/update.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash + +# WARNING: THIS FILE IS MANAGED IN THE 'BOILERPLATE' REPO AND COPIED TO OTHER REPOSITORIES. +# ONLY EDIT THIS FILE FROM WITHIN THE 'FLYTEORG/BOILERPLATE' REPOSITORY: +# +# TO OPT OUT OF UPDATES, SEE https://github.com/flyteorg/boilerplate/blob/master/Readme.rst + +set -e + +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )" + +cp ${DIR}/pull_request_template.md ${DIR}/../../../pull_request_template.md diff --git a/boilerplate/flyte/welcome_bot/Readme.rst b/boilerplate/flyte/welcome_bot/Readme.rst new file mode 100644 index 000000000..ea1878118 --- /dev/null +++ b/boilerplate/flyte/welcome_bot/Readme.rst @@ -0,0 +1,8 @@ +Config File -- Welcome Bot +~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Provides a ``config.yml`` file. + +**To Enable:** + +Add ``flyte/config.yml`` to your ``boilerplate/update.cfg`` file. \ No newline at end of file diff --git a/boilerplate/flyte/welcome_bot/config.yml b/boilerplate/flyte/welcome_bot/config.yml new file mode 100644 index 000000000..f99bcd78f --- /dev/null +++ b/boilerplate/flyte/welcome_bot/config.yml @@ -0,0 +1,15 @@ +# Comment to be posted on PRs from first-time contributors in your repository +newPRWelcomeComment: > + Thank you for opening this pull request! 🙌 + + These tips will help get your PR across the finish line: + - Most of the repos have a PR template; if not, fill it out to the best of your knowledge. + - Sign off your commits (Reference: [DCO Guide](https://github.com/src-d/guide/blob/master/developer-community/fix-DCO.md)). + +# Comment to be posted to on pull requests merged by a first time user +firstPRMergeComment: > + Congrats on merging your first pull request! 🎉 + +# Comment to be posted on first-time issues +newIssueWelcomeComment: > + Thank you for opening your first issue here! 🛠 diff --git a/boilerplate/flyte/welcome_bot/update.sh b/boilerplate/flyte/welcome_bot/update.sh new file mode 100755 index 000000000..2db64ac3f --- /dev/null +++ b/boilerplate/flyte/welcome_bot/update.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash + +# WARNING: THIS FILE IS MANAGED IN THE 'BOILERPLATE' REPO AND COPIED TO OTHER REPOSITORIES. +# ONLY EDIT THIS FILE FROM WITHIN THE 'FLYTEORG/BOILERPLATE' REPOSITORY: +# +# TO OPT OUT OF UPDATES, SEE https://github.com/flyteorg/boilerplate/blob/master/Readme.rst + +set -e + +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )" + +# Clone the config.yml file +echo " - copying ${DIR}/config.yml to the root directory." +cp "${DIR}"/config.yml "${DIR}"/../../../.github/config.yml + diff --git a/boilerplate/update.cfg b/boilerplate/update.cfg new file mode 100755 index 000000000..d55a8e706 --- /dev/null +++ b/boilerplate/update.cfg @@ -0,0 +1,3 @@ +flyte/welcome_bot +flyte/pull_request_template + diff --git a/boilerplate/update.sh b/boilerplate/update.sh new file mode 100755 index 000000000..9173b662d --- /dev/null +++ b/boilerplate/update.sh @@ -0,0 +1,73 @@ +#!/usr/bin/env bash + +# WARNING: THIS FILE IS MANAGED IN THE 'BOILERPLATE' REPO AND COPIED TO OTHER REPOSITORIES. +# ONLY EDIT THIS FILE FROM WITHIN THE 'FLYTEORG/BOILERPLATE' REPOSITORY: +# +# TO OPT OUT OF UPDATES, SEE https://github.com/flyteorg/boilerplate/blob/master/Readme.rst + +set -e + +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )" + +OUT="$(mktemp -d)" +trap 'rm -fr $OUT' EXIT + +git clone https://github.com/flyteorg/boilerplate.git "${OUT}" + +echo "Updating the update.sh script." +cp "${OUT}/boilerplate/update.sh" "${DIR}/update.sh" + +CONFIG_FILE="${DIR}/update.cfg" +README="https://github.com/flyteorg/boilerplate/blob/master/Readme.rst" + +if [ ! -f "$CONFIG_FILE" ]; then + echo "$CONFIG_FILE not found." + echo "This file is required in order to select which features to include." + echo "See $README for more details." + exit 1 +fi + +if [ -z "$REPOSITORY" ]; then + echo "$REPOSITORY is required to run this script" + echo "See $README for more details." + exit 1 +fi + +while read -r directory junk; do + # Skip comment lines (which can have leading whitespace) + if [[ "$directory" == '#'* ]]; then + continue + fi + # Skip blank or whitespace-only lines + if [[ "$directory" == "" ]]; then + continue + fi + # Lines like + # valid/path other_junk + # are not acceptable, unless `other_junk` is a comment + if [[ "$junk" != "" ]] && [[ "$junk" != '#'* ]]; then + echo "Invalid config! Only one directory is allowed per line. Found '$junk'" + exit 1 + fi + + dir_path="${OUT}/boilerplate/${directory}" + # Make sure the directory exists + if ! [[ -d "$dir_path" ]]; then + echo "Invalid boilerplate directory: '$directory'" + exit 1 + fi + + echo "***********************************************************************************" + echo "$directory is configured in update.cfg." + echo "-----------------------------------------------------------------------------------" + echo "syncing files from source." + rm -rf "${DIR:?}/${directory}" + mkdir -p "$(dirname "${DIR}"/"${directory}")" + cp -r "$dir_path" "${DIR}/${directory}" + if [ -f "${DIR}/${directory}/update.sh" ]; then + echo "executing ${DIR}/${directory}/update.sh" + "${DIR}/${directory}/update.sh" + fi + echo "***********************************************************************************" + echo "" +done < "$CONFIG_FILE" \ No newline at end of file