Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
MSevey committed May 22, 2024
0 parents commit 4b9fff7
Show file tree
Hide file tree
Showing 241 changed files with 37,995 additions and 0 deletions.
15 changes: 15 additions & 0 deletions .github/auto_request_review.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
reviewers:
defaults:
- rollkit
groups:
rollkit:
- team:core
files:
".github/**":
- MSevey
- rollkit
options:
ignore_draft: true
ignored_keywords:
- WIP
number_of_reviewers: 3
23 changes: 23 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
version: 2
updates:
- package-ecosystem: github-actions
directory: "/"
schedule:
interval: daily
open-pull-requests-limit: 10
labels:
- T:dependencies
- package-ecosystem: gomod
directory: "/"
schedule:
interval: weekly
open-pull-requests-limit: 10
labels:
- T:dependencies
- package-ecosystem: docker
directory: "/docker"
schedule:
interval: weekly
open-pull-requests-limit: 10
labels:
- T:dependencies
9 changes: 9 additions & 0 deletions .github/mergify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
pull_request_rules:
- name: backport patches to v0.10.x branch
conditions:
- base=main
- label=backport:v0.10.x
actions:
backport:
branches:
- v0.10.x
18 changes: 18 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<!--
Please read and fill out this form before submitting your PR.
Please make sure you have reviewed our contributors guide before submitting your
first PR.
NOTE: PR titles should follow semantic commits: https://www.conventionalcommits.org/en/v1.0.0/
-->

## Overview

<!--
Please provide an explanation of the PR, including the appropriate context,
background, goal, and rationale. If there is an issue with this information,
please provide a tl;dr and link the issue.
Ex: Closes #<issue number>
-->
95 changes: 95 additions & 0 deletions .github/workflows/ci_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
name: CI and Release
on:
push:
branches:
- main
# Trigger on version tags
tags:
- "v*"
pull_request:
merge_group:
workflow_dispatch:
# Inputs the workflow accepts.
inputs:
version:
# Friendly description to be shown in the UI instead of 'name'
description: "Semver type of new version (major / minor / patch)"
# Input has to be provided for the workflow to run
required: true
type: choice
options:
- patch
- minor
- major

jobs:
setup:
runs-on: ubuntu-latest
env:
# use consistent go version throughout pipeline here
GO_VERSION: "1.22"
outputs:
go-version: ${{ steps.set-vars.outputs.go-version }}
steps:
- name: Set go version
id: set-vars
run: echo "go-version=${{env.GO_VERSION}}" >> "$GITHUB_OUTPUT"

lint:
needs: [setup]
uses: ./.github/workflows/lint.yml
with:
go-version: ${{ needs.setup.outputs.go-version }}

test:
needs: [setup]
uses: ./.github/workflows/test.yml
with:
go-version: ${{ needs.setup.outputs.go-version }}

proto:
uses: ./.github/workflows/proto.yml

cli:
name: Test CLI
needs: [setup]
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- uses: actions/checkout@v4
- name: set up go
uses: actions/setup-go@v5
with:
go-version: ${{ needs.setup.outputs.go-version }}
- name: Build cli
run: make install
- name: Run cli
run: rollkit start --ci

# branch_name trims ref/heads/ from github.ref to access a clean branch name
branch_name:
runs-on: ubuntu-latest
outputs:
branch: ${{ steps.trim_ref.outputs.branch }}
steps:
- name: Trim branch name
id: trim_ref
run: |
echo "branch=$(${${{ github.ref }}:11})" >> $GITHUB_OUTPUT
# Make a release if this is a manually trigger job, i.e. workflow_dispatch
release:
needs: [lint, test, proto, branch_name]
runs-on: ubuntu-latest
if: ${{ github.event_name == 'workflow_dispatch' }}
permissions: "write-all"
steps:
- uses: actions/checkout@v4
- name: Version Release
uses: rollkit/.github/.github/actions/[email protected]
with:
github-token: ${{secrets.GITHUB_TOKEN}}
version-bump: ${{inputs.version}}
release-branch: ${{needs.branch_name.outputs.branch}}
20 changes: 20 additions & 0 deletions .github/workflows/docker-build-da-mockserv.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: mockserv Docker Build & Publish

# Trigger on all push events, new semantic version tags, and all PRs
on:
push:
branches:
- "**"
tags:
- "v*"
pull_request:

jobs:
docker-security-build:
permissions:
contents: write
packages: write
uses: rollkit/.github/.github/workflows/[email protected] # yamllint disable-line rule:line-length
with:
dockerfile: docker/mockserv.Dockerfile
packageName: mockserv
35 changes: 35 additions & 0 deletions .github/workflows/goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: goreleaser
on:
push:
tags:
- "v*"

jobs:
# Checks that the .goreleaser.yaml file is valid
goreleaser-check:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v4
- uses: goreleaser/goreleaser-action@v5
with:
version: latest
args: check

goreleaser:
needs: goreleaser-check
runs-on: ubuntu-latest
permissions: write-all
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- run: git fetch --force --tags
- uses: actions/setup-go@v5
with:
go-version-file: "go.mod"
- name: Create .release-env file
run: |-
echo 'GITHUB_TOKEN=${{secrets.GORELEASER_TOKEN}}' >> .release-env
- name: Create prebuilt binaries and attach them to the GitHub release
run: make prebuilt-binary
66 changes: 66 additions & 0 deletions .github/workflows/housekeeping.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: Housekeeping

on:
issues:
types: [opened]
pull_request_target:
types: [opened, ready_for_review]

jobs:
issue-management:
if: ${{ github.event.issue }}
name: Add issues to project and add triage label
uses: rollkit/.github/.github/workflows/[email protected]
secrets: inherit
permissions:
issues: write
pull-requests: write
with:
run-labels: true
labels-to-add: "needs-triage"
run-projects: true
project-url: https://github.com/orgs/rollkit/projects/7

add-pr-to-project:
# ignore dependabot PRs
if: ${{ github.event.pull_request && github.actor != 'dependabot[bot]' }}
name: Add PRs to project
uses: rollkit/.github/.github/workflows/[email protected]
secrets: inherit
permissions:
issues: write
pull-requests: write
with:
run-projects: true
project-url: https://github.com/orgs/rollkit/projects/7

auto-add-reviewer:
name: Auto add reviewer to PR
if: github.event.pull_request
uses: rollkit/.github/.github/workflows/[email protected]
secrets: inherit
permissions:
issues: write
pull-requests: write
with:
run-auto-request-review: true

auto-add-assignee:
# ignore dependabot PRs
if: ${{ github.event.pull_request && github.actor != 'dependabot[bot]' }}
name: Assign issue and PR to creator
runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: write
steps:
- name: Set pull_request url and creator login
# yamllint disable rule:line-length
run: |
echo "PR=${{ github.event.pull_request.html_url }}" >> $GITHUB_ENV
echo "CREATOR=${{ github.event.pull_request.user.login }}" >> $GITHUB_ENV
# yamllint enable rule:line-length
- name: Assign PR to creator
run: gh pr edit ${{ env.PR }} --add-assignee ${{ env.CREATOR }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
83 changes: 83 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
# lint runs all linters in this repository
# This workflow is triggered by ci_release.yml workflow
name: lint
on:
workflow_call:
inputs:
go-version:
description: "Go version to use"
type: string
required: true

jobs:
golangci-lint:
name: golangci-lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: ${{ inputs.go-version }}
# This steps sets the GIT_DIFF environment variable to true
# if files defined in PATTERS changed
- uses: technote-space/[email protected]
with:
# This job will pass without running if go.mod, go.sum, and *.go
# wasn't modified.
PATTERNS: |
**/**.go
go.mod
go.sum
- uses: golangci/[email protected]
with:
version: latest
args: --timeout 10m
github-token: ${{ secrets.github_token }}
if: env.GIT_DIFF

# hadolint lints the Dockerfile
hadolint:
uses: rollkit/.github/.github/workflows/[email protected] # yamllint disable-line rule:line-length
with:
dockerfile: test/docker/mockserv.Dockerfile

yamllint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: rollkit/.github/.github/actions/[email protected]

markdown-lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: rollkit/.github/.github/actions/[email protected]

protobuf-lint:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
- run: make proto-gen
- run: make proto-lint

cli-docs-lint:
name: Lint CLI Docs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: set up go
uses: actions/setup-go@v5
with:
go-version: ${{ inputs.go-version }}
- name: install rollkit cli
run: make install
- name: Generate Docs
run: rollkit docs-gen
- name: Verify no diff
run: |
DIFF=$(git diff)
if [[ -n "$DIFF" ]]; then
echo "$DIFF"
exit 1
fi
Loading

0 comments on commit 4b9fff7

Please sign in to comment.