Skip to content

Commit

Permalink
chore: start migration to magefiles
Browse files Browse the repository at this point in the history
  • Loading branch information
fallion committed Jun 19, 2020
1 parent 14815cc commit fff164e
Show file tree
Hide file tree
Showing 6 changed files with 77 additions and 22 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/linters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ jobs:
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
- uses: actions/cache@v2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- run: go mod download
- name: Run Commitsar
run: go run main.go
Expand Down
40 changes: 36 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,51 @@ name: Test
on: [pull_request]

jobs:
go:
go-test:
name: "Go Test"
runs-on: ubuntu-latest

strategy:
matrix:
go-version: [1.13.x]
go-version: [1.13.x, 1.14.x]

steps:
- name: Install Go
uses: actions/setup-go@v1
with:
go-version: ${{ matrix.go-version }}
- name: Check out code into the Go module directory
uses: actions/checkout@v1
uses: actions/checkout@v2
- uses: actions/cache@v2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Test
run: make ci
run: |
export PATH=${PATH}:`go env GOPATH`/bin
go install github.com/magefile/mage
mage test
go-mod-tidy:
name: "Go mod tidy"
runs-on: ubuntu-latest
steps:
- name: Install Go
uses: actions/setup-go@v1
with:
go-version: 1.14.x
- name: Check out code into the Go module directory
uses: actions/checkout@v2
- uses: actions/cache@v2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Tidy check
run: |
export PATH=${PATH}:`go env GOPATH`/bin
go install github.com/magefile/mage
mage gomodtidy
18 changes: 0 additions & 18 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,21 +1,3 @@
install_deps:
go mod download

# Standard go test
test:
go test ./... -v -race

setup-tests:
- sh ./testdata/setup-test-repos.sh

# Make sure no unnecessary dependecies are present
go-mod-tidy:
go mod tidy -v
git diff-index --quiet HEAD

# Run all tests & linters in CI
ci: setup-tests test go-mod-tidy

define prepare_build_vars
$(eval DATE_FLAG := -X 'main.date=$(shell date)')
$(eval VERSION_FLAG=-X 'main.version=$(shell git name-rev --tags --name-only $(shell git rev-parse HEAD))')
Expand Down
2 changes: 2 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@ go 1.13
require (
github.com/aevea/git/v2 v2.2.0
github.com/aevea/integrations v0.4.0
github.com/aevea/magefiles v0.0.0-20200424121010-0004d5a7a2fe
github.com/aevea/quoad v0.4.0
github.com/go-git/go-git/v5 v5.1.0
github.com/go-openapi/strfmt v0.19.5 // indirect
github.com/google/go-github/v32 v32.0.0
github.com/jedib0t/go-pretty v4.3.0+incompatible
github.com/logrusorgru/aurora v0.0.0-20200102142835-e9ef32dff381
github.com/magefile/mage v1.9.0
github.com/mattn/go-runewidth v0.0.9 // indirect
github.com/spf13/cobra v1.0.0
github.com/spf13/viper v1.7.0
Expand Down
22 changes: 22 additions & 0 deletions mage.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
//+build mage

package main

import (
"github.com/aevea/magefiles"
"github.com/magefile/mage/sh"
)

func Test() error {
err := sh.RunV("sh", "./testdata/setup-test-repos.sh")

if err != nil {
return err
}

return magefiles.Test()
}

func GoModTidy() error {
return magefiles.GoModTidy()
}
11 changes: 11 additions & 0 deletions tools.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// +build tools

package tools

import (
_ "github.com/magefile/mage"
)

func main() {

}

1 comment on commit fff164e

@vercel
Copy link

@vercel vercel bot commented on fff164e Jun 19, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.