Skip to content

Commit

Permalink
⏰ Eventually initial release.
Browse files Browse the repository at this point in the history
[major]

Signed-off-by: Ahmed Kamal <[email protected]>
  • Loading branch information
architeacher committed Apr 21, 2021
0 parents commit fee31eb
Show file tree
Hide file tree
Showing 63 changed files with 6,202 additions and 0 deletions.
126 changes: 126 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
version: 2.1

alias:
default: &default
environment:
PROJECT_NAME: "Eventually"
COVERAGE: true
VALIDATE: true
working_directory: /go/src/github.com/ahmedkamals/eventually
docker:
- image: circleci/golang:1.16.3
environment:
GOPATH: "/go"
GO111MODULE: "on"
REPO_NAME: "ahmedkamals"
IMAGE_NAME: "eventually"
GITHUB_API: "https://api.github.com/"
DOCKER_USER: "ahmedkamals"
setup_remote_docker: &setup_remote_docker
version: 19.03.12-ce
docker_layer_caching: true

jobs:
linting:
<<: *default
steps:
- checkout
- restore_cache:
keys:
- go-cache-{{ .Branch }}-{{ checksum "go.sum" }}-{{ .Revision }}
- go-cache-{{ .Branch }}-{{ checksum "go.sum" }}
- go-cache-{{ .Branch }}
- go-cache
- run:
name: Vendor dependencies
command: |
go mod download
- run:
name: Validation tests
command: |
if [ "$VALIDATE" == true ]; then make get-deps validate; else echo 'skipping validation.'; fi
- save_cache:
key: go-cache-{{ .Branch }}-{{ checksum "go.sum" }}-{{ .Revision }}
paths:
- ./vendor

unit:
<<: *default
steps:
- checkout
- restore_cache:
keys:
- go-cache-{{ .Branch }}-{{ checksum "go.sum" }}-{{ .Revision }}
- go-cache-{{ .Branch }}-{{ checksum "go.sum" }}
- go-cache-{{ .Branch }}
- go-cache
- run:
name: Unit tests
command: |
make unit coverage-html
if [ "$COVERAGE" == true ]; then bash <(curl -s https://codecov.io/bash) -f .go/tests/coverage/profile.out || true ; else echo 'skipping sending coverage.'; fi
- store_artifacts:
path: .go/tests/coverage/index.html
destination: coverage/profile.html

versioning:
<<: *default
steps:
- checkout
- run:
name: Versioning
command: |
bash ./.circleci/versionize.sh
make version
- persist_to_workspace:
root: .
paths:
- .

push:
<<: *default
steps:
- attach_workspace:
at: .
- run:
name: Push tag and check PR body
command: |
bash ./.circleci/push.sh
- persist_to_workspace:
root: .
paths:
- .

gh_release:
<<: *default
steps:
- attach_workspace:
at: .
- run:
name: Release
command: |
bash ./.circleci/release.sh
workflows:
version: 2
build:
jobs:
- linting
- unit
- versioning:
requires:
- linting
- unit
filters:
branches:
only: master
- push:
context:
- "Github"
requires:
- versioning
- gh_release:
context:
- "Github"
requires:
- push
15 changes: 15 additions & 0 deletions .circleci/push.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env bash

set -o errexit
set -o nounset
set -euo pipefail

mkdir -p "$HOME/.ssh/" && echo -e "Host github.com\n\tStrictHostKeyChecking no\n" > ~/.ssh/config

VERSION=$(cat .version 2> /dev/null)

if [ -n "$VERSION" ]; then
git tag "$VERSION"
echo "$VERSION -> $(git rev-parse --short=8 "$VERSION" 2> /dev/null)"
git push "https://${GITHUB_ACCESS_TOKEN}:[email protected]/${REPO_NAME}/${IMAGE_NAME}" --tags
fi
19 changes: 19 additions & 0 deletions .circleci/release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/env bash

set -o errexit
set -o nounset
set -euo pipefail

# curl -sL https://git.io/goreleaser | bash
mkdir -p "$HOME/.ssh/" && echo -e "Host github.com\n\tStrictHostKeyChecking no\n" > ~/.ssh/config

VERSION=$(cat ./.version)

if [ -n "$VERSION" ]; then
echo "Creating release: ${VERSION}"
curl -X POST \
-H "Accept: application/vnd.github.v3+json" \
-H "Authorization: token ${GITHUB_ACCESS_TOKEN}" \
-d "{\"tag_name\": \"${VERSION}\"}" \
"${GITHUB_API}repos/${REPO_NAME}/${IMAGE_NAME}/releases"
fi
41 changes: 41 additions & 0 deletions .circleci/versionize.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/usr/bin/env bash

set -o errexit
set -o nounset
set -euo pipefail

mkdir -p "$HOME/.ssh/" && echo -e "Host github.com\n\tStrictHostKeyChecking no\n" > ~/.ssh/config

LAST_COMMIT_MESSAGE=$(git log -1 --pretty=%B)
VERSION_FILE="./.version"
touch "$VERSION_FILE"

versionize() {
local commit_message="$1"
local major="$2"
local minor="$3"
local patch="$4"
local version_file="$5"

if echo "$commit_message" | grep -iqE "\[major\]"; then
major=$((major+1))
echo "v$major.0.0" > "$version_file"
elif echo "$commit_message" | grep -iqE "\[minor\]"; then
minor=$((minor+1))
echo "v$major.$minor.0" > "$version_file"
elif echo "$commit_message" | grep -iqE "\[patch\]"; then
patch=$((patch+1))
echo "v$major.$minor.$patch" > "$version_file"
fi
}

if VERSION=$(git describe --abbrev=0 --tags 2> /dev/null) && [[ (-n "$(git diff "$VERSION")") || (-z "$VERSION") ]]; then
VERSION=${VERSION:-'0.0.0'}; VERSION=${VERSION#"v"}
MAJOR=${VERSION%%.*}; VERSION=${VERSION#*.}
MINOR=${VERSION%%.*}; VERSION=${VERSION#*.}
PATCH=${VERSION%%.*}; VERSION=${VERSION#*.}

versionize "$LAST_COMMIT_MESSAGE" "$MAJOR" "$MINOR" "$PATCH" "$VERSION_FILE"
else
versionize "$LAST_COMMIT_MESSAGE" 0 0 0 "$VERSION_FILE"
fi
47 changes: 47 additions & 0 deletions .github/ISSUE_TEMPLATE/bug-report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
---
name: Bug Report
about: Report a bug encountered while operating Eventually
labels: kind/bug

---

<!--
Hi, thank you for opening an issue! We really appreciate you taking the time to
give us feedback. Before hitting the button...
Please make sure that we do not have any duplicates already open.
You can ensure this by searching the issue list for this repository.
Please use this template while reporting a bug and provide as much info as possible.
Not doing so may result in your bug not being addressed in a timely manner.
Thank you!
-->

## What happened

<!--
Error message, actual behaviour, etc. Full stack traces much appreciated.
-->

## What you expected to happen

<!-- Describe the results you expected. -->

## How to reproduce it (as minimally and precisely as possible)

<!-- Specific steps, as minimally and precisely as possible. -->

## Anything else we need to know

## Environment

- OS (e.g. from /etc/os-release)
- Kernel (e.g. `uname -a`)
- Install tools
- Others

<!--
Additional information you deem important
e.g. issue happens only occasionally, special hardware required?, ...etc.
-->
21 changes: 21 additions & 0 deletions .github/ISSUE_TEMPLATE/enhancement.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
name: Enhancement Request
about: Suggest an enhancement to the Eventually project
labels: kind/feature

---

<!--
Please search existing feature requests, and if you find a similar one,
up-vote it and/or add your comments to it instead.
Do not hesitate, when appropriate, to share the exact commands or API you would
like, and/or to share a diagram (e.g.: asciiflow.com, or draw.io):
"a picture is worth a thousand words".
Please only use this template for submitting enhancement requests.
-->

**What would you like to be added**:

**Why is this needed**:
20 changes: 20 additions & 0 deletions .github/ISSUE_TEMPLATE/failing-test.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name: Failing Test
about: Report continuously failing tests or jobs in Eventually CI
labels: kind/failing-test

---

<!-- Please only use this template for submitting reports about continuously failing tests or jobs in Eventually CI -->

**Which jobs are failing**:

**Which test(s) are failing**:

**Since when has it been failing**:

**Test grid link**:

**Reason for failure**:

**Anything else we need to know**:
18 changes: 18 additions & 0 deletions .github/ISSUE_TEMPLATE/flaking-test.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
name: Flaking Test
about: Report flaky tests or jobs in Eventually CI
labels: kind/flake

---

<!-- Please only use this template for submitting reports about flaky tests or jobs (pass or fail with no underlying change in code) in Eventually CI -->

**Which jobs are flaking**:

**Which test(s) are flaking**:

**Test grid link**:

**Reason for failure**:

**Anything else we need to know**:
12 changes: 12 additions & 0 deletions .github/ISSUE_TEMPLATE/support.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
name: Support Request
about: Support request or question relating to Eventually
labels: triage/support

---

<!--
STOP -- PLEASE READ!
GitHub is not the right place for support requests.
-->
47 changes: 47 additions & 0 deletions .github/PULL-REQUEST-TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<!--
Hi, thanks for this PR! We - as contributors/maintainers - are really grateful,
and deeply appreciate the work and effort involved.
It might take a little while for us to get around to reviewing it. Sorry for
the delay.
To help things go as quickly as possible, please:
- read CODE-OF-CONDUCT.md
- keep the PR as small and focused as you can
- follow the coding guidelines found in CONTRIBUTING.md
-->

# New changes are awesome

## What does this do

<!-- a brief explanation of the functionality this provides. -->

## Why is it a good idea

<!-- how does it help users / maintainers? -->

## How I did it

<!-- a brief explanation of the context. -->

## How to verify it

<!-- any background that might help the reviewer understand what's going on. -->

## Remarks

<!-- things you're uncertain about what you want the reviewer to focus on. -->

## Release note

<!-- Write your release note:
1. Enter your extended-release note in the below block. If the PR requires
additional action from users switching to the new release, include the string
"action required".
2. If no release note is required, just write "NONE".
-->

```release-note
```
10 changes: 10 additions & 0 deletions .github/dependabot.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version: 2
updates:
- package-ecosystem: "gomod"
directory: "/"
schedule:
interval: "daily"
open-pull-requests-limit: 10
commit-message:
prefix: ":arrow_upper_right: [patch]"
include: "scope"
Loading

0 comments on commit fee31eb

Please sign in to comment.