Browse Source

ci: only run when applicable (#4752)

- only run tests when .go, .mod, .sum files have been touched
- only run proto checks when .proto files have been touched

Signed-off-by: Marko Baricevic marbar3778@yahoo.com
pull/4764/head
Marko 4 years ago
committed by GitHub
parent
commit
7a87a784bf
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 40 additions and 5 deletions
  1. +8
    -1
      .github/workflows/proto.yml
  2. +32
    -4
      .github/workflows/tests.yml

+ 8
- 1
.github/workflows/proto.yml View File

@ -5,8 +5,15 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: docker-practice/actions-setup-docker@master
- uses: technote-space/get-diff-action@v1
id: git_diff
with:
SUFFIX_FILTER: .proto
SET_ENV_NAME_INSERTIONS: 1
SET_ENV_NAME_LINES: 1
- name: lint
run: make proto-lint
if: "env.GIT_DIFF != ''"
- name: check-breakage
run: make proto-check-breaking-ci
if: "env.GIT_DIFF != ''"

+ 32
- 4
.github/workflows/tests.yml View File

@ -7,6 +7,23 @@ on:
- release/**
jobs:
Diff:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: technote-space/get-diff-action@v1
id: git_diff
with:
SUFFIX_FILTER: |
.go
.mod
.sum
SET_ENV_NAME_INSERTIONS: 1
SET_ENV_NAME_LINES: 1
- name: test
run: exit 1
if: "env.GIT_DIFF == ''"
cleanup-runs:
runs-on: ubuntu-latest
steps:
@ -14,6 +31,7 @@ jobs:
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
if: "!startsWith(github.ref, 'refs/tags/') && github.ref != 'refs/heads/master'"
build:
name: Build
runs-on: ubuntu-latest
@ -33,7 +51,7 @@ jobs:
test_abci_apps:
runs-on: ubuntu-latest
needs: Build
needs: [Build, Diff]
steps:
- uses: actions/setup-go@v2-beta
- name: Set GOBIN
@ -50,7 +68,7 @@ jobs:
test_abci_cli:
runs-on: ubuntu-latest
needs: Build
needs: [Build, Diff]
steps:
- uses: actions/setup-go@v2-beta
- name: Set GOBIN
@ -68,15 +86,25 @@ jobs:
runs-on: ubuntu-latest
needs: Build
steps:
- uses: actions/setup-go@v2-beta
- uses: actions/checkout@v2
- uses: technote-space/get-diff-action@v1
id: git_diff
with:
SUFFIX_FILTER: |
.go
.mod
.sum
SET_ENV_NAME_INSERTIONS: 1
SET_ENV_NAME_LINES: 1
- name: Set GOBIN
run: |
echo "::add-path::$(go env GOPATH)/bin"
- uses: actions/checkout@v2
- uses: actions/cache@v1
with:
path: ~/go/bin
key: ${{ runner.os }}-go-tm-binary
if: "env.GIT_DIFF != ''"
- name: test_apps
run: test/app/test.sh
shell: bash
if: "env.GIT_DIFF != ''"

Loading…
Cancel
Save