Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup workflow files #140

Merged
merged 7 commits into from
May 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 0 additions & 47 deletions .github/workflows/build.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: docker-build
name: Docker Build

on:
pull_request:
Expand Down
16 changes: 10 additions & 6 deletions .github/workflows/gosec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@ on:
push:
branches:
- main
- release/*
pull_request:
branches:
- main
- release/*
jobs:
tests:
runs-on: ubuntu-latest
Expand All @@ -14,14 +16,16 @@ jobs:
steps:
- name: Checkout Source
uses: actions/checkout@v3
- uses: technote-space/get-diff-action@v3

- uses: technote-space/get-diff-action@v6
with:
SUFFIX_FILTER: |
.go
.mod
.sum
PATTERNS: |
**.go
**.mod
**.sum

- name: Run Gosec Security Scanner
uses: informalsystems/gosec@master
with:
args: ./...
if: "env.GIT_DIFF != ''"
if: env.GIT_DIFF
12 changes: 8 additions & 4 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,37 @@ name: Lint
# Lint runs golangci-lint over the entire Gaia repository
# This workflow is run on every pull request and push to main
# The `golangci` job will pass without running if no *.{go, mod, sum} files have been modified.

on:
pull_request:
push:
branches:
- main
- master
- "release/*"

jobs:
golangci:
name: golangci-lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: 1.20.0
- uses: actions/checkout@v3
- uses: technote-space/get-diff-action@v4

- uses: technote-space/get-diff-action@v6
with:
PATTERNS: |
**/**.go
go.mod
go.sum

- uses: golangci/golangci-lint-action@v3
with:
# Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version.
version: v1.51.2
args: --timeout 10m
github-token: ${{ secrets.github_token }}
if: "env.GIT_DIFF != ''"
if: env.GIT_DIFF
25 changes: 15 additions & 10 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,40 +1,44 @@
name: Build & Test
name: Test

on:
pull_request:
push:
branches:
- main
- master
- "release/*"
- release/*

jobs:
cleanup-runs:
runs-on: ubuntu-latest
steps:
- uses: rokroskar/workflow-run-cleanup-action@master
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
if: "!startsWith(github.ref, 'refs/tags/') && github.ref != 'refs/heads/main'"

test-coverage-upload:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: 1.20.0
- uses: actions/checkout@v3
- uses: technote-space/get-diff-action@v4

- uses: technote-space/get-diff-action@v6
id: get-diff
with:
PATTERNS: |
**/**.go
go.mod
go.sum

- name: build
run: |
make build

- name: test & coverage report creation
run: |
go test ./... -mod=readonly -timeout 12m -race -coverprofile=coverage.txt -covermode=atomic -tags='ledger test_ledger_mock'
if: "env.GIT_DIFF != ''"
if: env.GIT_DIFF

- name: filter out DONTCOVER
run: |
excludelist="$(find ./ -type f -name '*.go' | xargs grep -l 'DONTCOVER')"
Expand All @@ -44,12 +48,13 @@ jobs:
echo "Excluding ${filename} from coverage report..."
sed -i.bak "/$(echo $filename | sed 's/\//\\\//g')/d" coverage.txt
done
if: "env.GIT_DIFF != ''"
if: env.GIT_DIFF

- uses: codecov/codecov-action@v1
with:
file: ./coverage.txt # optional
fail_ci_if_error: true
if: "env.GIT_DIFF != ''"
if: env.GIT_DIFF

test-simulation:
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ build/linux/amd64:
GOOS=linux GOARCH=amd64 go build -mod=readonly $(BUILD_FLAGS) -o "$@/terrad" ./cmd/terrad

build/linux/arm64:
GOOS=linux GOARCH=arm64 go build -mod=readonly $(BUILD_FLAGS) -o "$@/terrad"./cmd/terrad
GOOS=linux GOARCH=arm64 go build -mod=readonly $(BUILD_FLAGS) -o "$@/terrad" ./cmd/terrad

build/darwin/amd64:
GOOS=darwin GOARCH=amd64 go build -mod=readonly $(BUILD_FLAGS) -o "$@/terrad" ./cmd/terrad
Expand Down