Skip to content

Commit

Permalink
Merge pull request #38 from devlinjunker/release-0.5
Browse files Browse the repository at this point in the history
release-0.5
  • Loading branch information
devlinjunker authored Jul 24, 2021
2 parents abd1649 + 52486af commit b1a799e
Show file tree
Hide file tree
Showing 20 changed files with 64 additions and 8 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/auto-label.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@ jobs:

- name: Remove WIP Status Label
if: github.event.action == 'closed'
uses: actions-ecosystem/[email protected].0
uses: actions-ecosystem/[email protected].1
continue-on-error: true
with:
github_token: ${{ secrets.github_token }}
labels: "status: WIP"

- name: Remove Blocked Status Label
if: github.event.action == 'closed'
uses: actions-ecosystem/[email protected].0
uses: actions-ecosystem/[email protected].1
continue-on-error: true
with:
github_token: ${{ secrets.github_token }}
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/release-on-merge.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ on:
push:
branches:
- release-*
paths-ignore:
- 'README.md' # ignore changes to README as we edit this when creating release branch

jobs:
create-release-tag:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
Version: 0.4.0
Version: 0.5.0
---

# Example - CII 100%
Expand Down
14 changes: 14 additions & 0 deletions scripts/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Script Files
This directory contains script files to help with developer workflows, for now these are shell scripts. But if desired, we could replace these with node or python scripts instead.

## Conventions
- Add `set -eu` to top of shell scripts when possible
- `set -e` causes the script to exit if any errors occur
- `set -u` causes the script to error if any undeclared variables are encountered
- Linting with [Shellcheck] for ideal formatting to prevent errors
- Unit Testing with [BATS] (Bash Automatic Testing System)
- Ideally wrap code in `main` method and then invoke at the end of script


[ShellCheck]: https://www.shellcheck.net/
[BATS]: https://bats-core.readthedocs.io/
5 changes: 5 additions & 0 deletions scripts/bin/lint.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
#! /bin/bash

# cannot `set -u` here because `if [[ -z "$BATS_TMPDIR" ]];` errors
## if we enforce bash version 4.2 then we can use `if [ -v BATS_TMPDIR ]` to check
## and then can `set -u` here
set -e

DIR=$(dirname "$0")

lint_scripts() {
Expand Down
5 changes: 5 additions & 0 deletions scripts/bin/test.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
#! /bin/bash

# cannot `set -u` here because `if [[ -z "$BATS_TMPDIR" ]];` errors
## if we enforce bash version 4.2 then we can use `if [ -v BATS_TMPDIR ]` to check
## and then can `set -u` here
set -e

DIR=$(dirname "$0")

find_script_test() {
Expand Down
2 changes: 2 additions & 0 deletions scripts/hooks/commit-msg.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#! /bin/bash
# Script to verify that commit message matches conventions

set -eu

# set directory for calling other scripts
DIR=$(dirname "${BASH_SOURCE[0]}")
# if in hook, then prep PATH to find in repo `scripts/hooks/` dir
Expand Down
1 change: 1 addition & 0 deletions scripts/hooks/internal/branch-name.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#
# based on https://itnext.io/using-git-hooks-to-enforce-branch-naming-policy-ffd81fa01e5e

set -eu

# set directory for calling other scripts
# NOTE: expect this to be called in this directory
Expand Down
8 changes: 5 additions & 3 deletions scripts/hooks/internal/branch-protections.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#! /bin/bash
# Script to check github branch protections and prevent commits to protected branches

set -eu

BLOCKED_BRANCH=( main develop )
BLOCKED_PREFIX=( release )

Expand Down Expand Up @@ -39,9 +41,9 @@ github() {

main() {

# check github branch protections
github
# TODO: check github branch protections (skipping for now as it errors during testing)
# github

# compare against branch name/prefixes defined in here
if [[ "${BLOCKED_BRANCH[*]}" =~ $BRANCH ]]; then
return 1;
Expand Down
5 changes: 5 additions & 0 deletions scripts/hooks/internal/prefix-list.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
#! /bin/bash

# cannot `set -u` here because `if [ -z "$BATS_PREFIX_LIST" ];` errors
## if we enforce bash version 4.2 then we can use `if [ -v BATS_PREFIX_LIST ]` to check
## and then can `set -u` here
set -e

OTHER_TYPES=( 'feat' 'fix' 'bugfix' 'perf' 'test' )

# set directory for calling other scripts
Expand Down
1 change: 1 addition & 0 deletions scripts/hooks/post-commit.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#! /bin/bash
# Checks that the git diff is not getting to big and warns if it is

set -eu

# TODO: better way to determine the branch/commit we want to check against?
# for now look back until DIFF_BRANCH and find other merge commits -- those with (#..) in the commit message
Expand Down
2 changes: 2 additions & 0 deletions scripts/hooks/pre-commit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
# Pre-commit githook to run before every commit to validate it locally
# 1. Check that branch name matches conventions (branch-name.sh)

set -eu

# set directory for calling other scripts
DIR=$(dirname "${BASH_SOURCE[0]}")

Expand Down
2 changes: 2 additions & 0 deletions scripts/hooks/pre-push.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#! /bin/bash

set -eu

# set directory for calling other scripts
DIR=$(dirname "${BASH_SOURCE[0]}")

Expand Down
2 changes: 2 additions & 0 deletions scripts/release/patch-cut-check.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#! /bin/bash

set -eu

if [[ "$1" != "main" && "$1" != "release-"* ]]; then
echo "::error::Cannot Cut Patch off of non 'release-*' or 'main' branch";
exit 1
Expand Down
1 change: 1 addition & 0 deletions scripts/release/release-cut-check.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#! /bin/bash

set -eu

if git branch -a | grep "$RELEASE_BRANCH"; then
echo "::error::Release Branch Already Exists";
Expand Down
4 changes: 3 additions & 1 deletion scripts/release/release-prep-upmerge.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
#! /bin/bash

set -eu

git checkout develop;

# Get version in `develop` (We wantt this to be version in the final README)
# VERSION=$(less README.md | head -n 3);

# upmerge from branch input
git pull;
git merge "$1";
git merge "$1" 2>/dev/null; # ignore error we expect here

# TODO: Resolve conflicts better (maybe https://github.com/jakub-g/git-resolve-conflict)
git reset README.md;
Expand Down
5 changes: 4 additions & 1 deletion scripts/release/update-versions.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
#! /bin/bash
# Open Versioned files in repo and increment version

if [ -z "$1" ]; then
set -eu

# check number of arguments first so we don't access unset variable and error with set -u
if [[ $# == 0 || -z "$1" ]]; then
echo "Error: no version number"
exit 1;
fi;
Expand Down
3 changes: 3 additions & 0 deletions scripts/workflows/branch-match.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
#! /bin/bash

set -eu

## Verify that BRANCH matches regexp, else error
if [[ ! $BRANCH =~ $REGEXP ]]; then
exit 1;
Expand Down
2 changes: 2 additions & 0 deletions scripts/workflows/collect-wiki.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#! /bin/bash

set -eu

mkdir wiki

# create `.README` file with Table of Contents to link to each
Expand Down
2 changes: 2 additions & 0 deletions scripts/workflows/verify-merge.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#! /bin/bash
# Verify that a branch can be merged

set -eu

# check branch type prefix != "poc"

if [[ "$BRANCH" =~ "poc/" ]]; then
Expand Down

0 comments on commit b1a799e

Please sign in to comment.