Skip to content

Commit

Permalink
Init boilerplate (#21)
Browse files Browse the repository at this point in the history
Signed-off-by: Yuvraj <[email protected]>
  • Loading branch information
yindia authored Jun 4, 2021
1 parent 1c6be62 commit 74444cd
Show file tree
Hide file tree
Showing 13 changed files with 258 additions and 52 deletions.
49 changes: 0 additions & 49 deletions .circleci/config.yml

This file was deleted.

15 changes: 15 additions & 0 deletions .github/config.yml
Original file line number Diff line number Diff line change
@@ -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! 🛠
36 changes: 36 additions & 0 deletions .github/workflows/boilerplate-automation.yml
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>
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
10 changes: 10 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -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
34 changes: 31 additions & 3 deletions PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -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/<number>

## Follow-up issue
_NA_
OR
_https://github.com/flyteorg/flyte/issues/<number>_
8 changes: 8 additions & 0 deletions boilerplate/flyte/pull_request_template/Readme.rst
Original file line number Diff line number Diff line change
@@ -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.
32 changes: 32 additions & 0 deletions boilerplate/flyte/pull_request_template/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -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/<number>

## Follow-up issue
_NA_
OR
_https://github.com/flyteorg/flyte/issues/<number>_
12 changes: 12 additions & 0 deletions boilerplate/flyte/pull_request_template/update.sh
Original file line number Diff line number Diff line change
@@ -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
8 changes: 8 additions & 0 deletions boilerplate/flyte/welcome_bot/Readme.rst
Original file line number Diff line number Diff line change
@@ -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.
15 changes: 15 additions & 0 deletions boilerplate/flyte/welcome_bot/config.yml
Original file line number Diff line number Diff line change
@@ -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! 🛠
15 changes: 15 additions & 0 deletions boilerplate/flyte/welcome_bot/update.sh
Original file line number Diff line number Diff line change
@@ -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

3 changes: 3 additions & 0 deletions boilerplate/update.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
flyte/welcome_bot
flyte/pull_request_template

73 changes: 73 additions & 0 deletions boilerplate/update.sh
Original file line number Diff line number Diff line change
@@ -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"

0 comments on commit 74444cd

Please sign in to comment.