Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
ArthurHlt committed Oct 29, 2021
0 parents commit 2aa666a
Show file tree
Hide file tree
Showing 17 changed files with 1,937 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .github/auto-merge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
- match:
dependency_type: all
update_type: "semver:minor"
11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "gomod" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "daily"
57 changes: 57 additions & 0 deletions .github/workflows/after-merge-dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: after-merge-dependabot

on:
pull_request_target:
types: [closed]

jobs:
check:
if: github.event.pull_request.merged && github.actor == 'dependabot[bot]'
runs-on: ubuntu-latest
concurrency:
group: dependabot-after-merge
cancel-in-progress: true
steps:
- name: Fetch dependabot metadata
id: dependabot-metadata
uses: dependabot/fetch-metadata@v1.1.1
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"

- uses: oprypin/find-latest-tag@v1
id: octokit
with:
repository: ${{ github.repository }}
prefix: v

- name: Parse last release
id: semver_parser
uses: booxmedialtd/ws-action-parse-semver@v1
with:
input_string: '${{ steps.octokit.outputs.tag }}'
version_extractor_regex: 'v(.*)$'

- name: Compute tag
id: compte_tag
run: |
major=${{ steps.semver_parser.outputs.major }}
minor=${{ steps.semver_parser.outputs.minor }}
patch=${{ steps.semver_parser.outputs.patch }}
if [ "${{ steps.dependabot-metadata.outputs.update-type }}" == "version-update:semver-minor" ]; then
minor=$((minor+1))
patch=0
echo "::warning::bumping minor version"
elif [ "${{ steps.dependabot-metadata.outputs.update-type }}" == "version-update:semver-patch" ]; then
patch=$((patch+1))
echo "::warning::bumping patch version"
fi
tag="v${major}.${minor}.${patch}"
echo "::set-output name=tag::${tag}"
echo "::warning::tag == ${tag}"
- name: Create tag
uses: tvdias/github-tagger@v0.0.1
if: steps.compte_tag.outputs.tag != steps.semver_parser.outputs.fullversion
with:
repo-token: "${{ secrets.AUTO_MERGE_TOKEN }}"
tag: "${{ steps.compte_tag.outputs.tag }}"
20 changes: 20 additions & 0 deletions .github/workflows/auto-accept-dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: auto-accept-dependabot

on:
pull_request_target:

jobs:
auto-merge:
if: github.actor == 'dependabot[bot]'
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v2
with:
fetch-depth: 0

- uses: ahmadnassri/action-dependabot-auto-merge@v2
with:
config: .github/auto-merge.yml
command: "squash and merge"
github-token: ${{ secrets.AUTO_MERGE_TOKEN }}
61 changes: 61 additions & 0 deletions .github/workflows/goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: goreleaser

on:
push:
# not not consider simplec commit
branches:
- '!*'
# consider only release and pre-release tags
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
- 'v[0-9]+.[0-9]+.[0-9]+-rc[0-9]+'

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: set up go
uses: actions/setup-go@v2
with:
go-version: 1.17

- name: cache go modules
uses: actions/cache@v1
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: tests modules
run: |
go mod vendor
if [ ! -z "$(git status --porcelain)" ]; then
echo "::error::vendor directory if not synched with go.mod, please run go mod vendor"
exit 1
fi
go mod tidy
if [ ! -z "$(git status --porcelain)" ]; then
echo "::error::modules are not tidy, please run go mod tidy"
exit 1
fi
- name: tests
run: |
go test -v ./...
- name: run goreleaser
uses: goreleaser/goreleaser-action@v2
if: success() && startsWith(github.ref, 'refs/tags/')
with:
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
USER: github-actions
35 changes: 35 additions & 0 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: unit-tests

on:
pull_request:

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: set up go
uses: actions/setup-go@v2
with:
go-version: 1.17

- name: cache go modules
uses: actions/cache@v1
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: tests
run: |
go test -v ./...
- name: gitleaks
uses: zricethezav/gitleaks-action@master
with:
config-path: /github/workspace/.gitleaks.toml
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/varsgen
Loading

0 comments on commit 2aa666a

Please sign in to comment.