Skip to content
This repository has been archived by the owner on Jun 12, 2024. It is now read-only.

Commit

Permalink
[ci] separate run and commit into jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
prince-chrismc authored Mar 18, 2021
1 parent 75e2744 commit 53ac897
Showing 1 changed file with 24 additions and 11 deletions.
35 changes: 24 additions & 11 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ on:
workflow_dispatch: {}

jobs:
run:
commit:
runs-on: ubuntu-latest
if: ${{ github.event_name == 'pull_request' || github.event_name == 'push' }}
steps:
- uses: actions/setup-go@v2
with:
Expand All @@ -21,23 +22,35 @@ jobs:
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
restore-keys: ${{ runner.os }}-go-
- run: go get -v -t -d ./...

- if: github.event_name != 'schedule'
run: go test -race -coverprofile=coverage.out -covermode=atomic -v ./...
- if: github.event_name != 'schedule'
uses: codecov/codecov-action@v1
- run: go test -race -coverprofile=coverage.out -covermode=atomic -v ./...
- uses: codecov/codecov-action@v1
with:
files: coverage.out

- run: go build -o cpr ./cmd
- if: github.event_name == 'pull_request'
run: ./cpr -d
- run: ./cpr -d
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- if: github.event_name != 'pull_request'
run: ./cpr

run:
runs-on: ubuntu-latest
if: ${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }}
steps:
- uses: actions/setup-go@v2
with:
go-version: ^1.15
- 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-
- run: go get -v -t -d ./...

- run: go build -o cpr ./cmd
- run: ./cpr
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit 53ac897

Please sign in to comment.