Skip to content

Commit

Permalink
feat: add some CI and github improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
smlx committed Feb 8, 2021
1 parent e7d9d06 commit f100fa3
Show file tree
Hide file tree
Showing 6 changed files with 84 additions and 5 deletions.
6 changes: 6 additions & 0 deletions .github/dependabot.yml
@@ -0,0 +1,6 @@
version: 2
updates:
- package-ecosystem: github-actions
directory: /
schedule:
interval: daily
8 changes: 8 additions & 0 deletions .github/pull_request_template.md
@@ -0,0 +1,8 @@
<!--
IMPORTANT NOTE: Commits must adhere to the conventional commits specification:
https://www.conventionalcommits.org/en/v1.0.0/
-->

Explain the **details** for making this change. What existing problem does the pull request solve?

Put `Closes: #XXXX` in your comment to auto-close the issue that your PR fixes (if such).
11 changes: 11 additions & 0 deletions .github/workflows/lint-commit-messages.yaml
@@ -0,0 +1,11 @@
name: Lint Commit Messages
on: pull_request

jobs:
commitlint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: wagoid/commitlint-github-action@v2
40 changes: 40 additions & 0 deletions .github/workflows/tag-release.yaml
@@ -0,0 +1,40 @@
name: Tag and Release

on:
push:
branches:
- main

jobs:
tag:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Configure Git
run: |
git config --global user.name "$GITHUB_ACTOR"
git config --global user.email "$GITHUB_ACTOR@users.noreply.github.com"
- uses: actions/setup-go@v2
with:
go-version: "^1.15"
- name: Install ccv
run: go get github.com/smlx/ccv
- name: Bump tag if necessary
id: tag
run: |
if [ -z $(git tag -l $(ccv)) ]; then
git tag $(ccv)
git push --tags
echo "::set-output name=new::true"
fi
- name: Run GoReleaser
if: steps.tag.outputs.new == 'true'
uses: goreleaser/goreleaser-action@v2
with:
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
17 changes: 17 additions & 0 deletions .github/workflows/test.yaml
@@ -0,0 +1,17 @@
name: Test Suite
on: pull_request

jobs:
go-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Configure Git
run: |
git config --global user.name "$GITHUB_ACTOR"
git config --global user.email "$GITHUB_ACTOR@users.noreply.github.com"
echo $GITHUB_ACTOR
- uses: actions/setup-go@v2
with:
go-version: "^1.15"
- run: go test -v .
7 changes: 2 additions & 5 deletions main_test.go
@@ -1,7 +1,6 @@
package main_test

import (
"fmt"
"io/ioutil"
"os/exec"
"testing"
Expand Down Expand Up @@ -50,16 +49,14 @@ func TestNextVersion(t *testing.T) {
// init git repo
initCmd := exec.Command("git", "init")
initCmd.Dir = dir
initCmd.Env = []string{fmt.Sprintf("HOME=%s", dir)}
if err = initCmd.Run(); err != nil {
tt.Fatalf("couldn't git init: %v", err)
}
for _, c := range tc.gitCmds {
cmd := exec.Command("git", c...)
cmd.Dir = dir
cmd.Env = []string{fmt.Sprintf("HOME=%s", dir)}
if err = cmd.Run(); err != nil {
tt.Fatalf("couldn't run git command `%s`: %v", c, err)
if output, err := cmd.CombinedOutput(); err != nil {
tt.Fatalf("couldn't run git %v: %v (%s)", c, err, output)
}
}
tt.Log(dir)
Expand Down

0 comments on commit f100fa3

Please sign in to comment.