Skip to content

Commit

Permalink
chore: fix gh actions ci names and triggers
Browse files Browse the repository at this point in the history
  • Loading branch information
AaronCQL committed Aug 12, 2023
1 parent 0b15d11 commit cc4a644
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 44 deletions.
60 changes: 32 additions & 28 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,30 @@
on: [push, pull_request]
name: every commit
name: Build
on:
push:
branches: [main]
pull_request:
types: [opened, synchronize, reopened]

jobs:
# Use --check or --exit-code when available (Go 1.19?)
# https://github.com/golang/go/issues/27005
tidy:
runs-on: ubuntu-latest
name: tidy
steps:
- uses: actions/checkout@v3
- name: Setup go
uses: actions/setup-go@v4
with:
go-version: 1.20.0
- run: |
go mod tidy
CHANGES_IN_REPO=$(git status --porcelain)
if [[ -n "$CHANGES_IN_REPO" ]]; then
echo "Repository is dirty. Showing 'git status' and 'git --no-pager diff' for debugging now:"
git status && git --no-pager diff
exit 1
fi
build:
runs-on: ubuntu-latest
Expand All @@ -13,35 +37,15 @@ jobs:
go-version: 1.20.0
- run: go build ./...

test:
unit-test:
runs-on: ubuntu-latest
name: test
steps:
- name: Install Go
uses: actions/setup-go@v4
with:
go-version: 1.20.0
- name: Checkout code
uses: actions/checkout@v3
- name: Test
run: go test ./...

# Use --check or --exit-code when available (Go 1.19?)
# https://github.com/golang/go/issues/27005
tidy:
runs-on: ubuntu-latest
name: tidy
steps:
- uses: actions/checkout@v3
- name: Setup go
- name: Install Go
uses: actions/setup-go@v4
with:
go-version: 1.20.0
- run: |
go mod tidy
CHANGES_IN_REPO=$(git status --porcelain)
if [[ -n "$CHANGES_IN_REPO" ]]; then
echo "Repository is dirty. Showing 'git status' and 'git --no-pager diff' for debugging now:"
git status && git --no-pager diff
exit 1
fi
- name: Checkout code
uses: actions/checkout@v3
- name: Test
run: go test ./...
11 changes: 5 additions & 6 deletions .github/workflows/gosec.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
name: Run Gosec
name: Gosec
on:
push:
branches:
- main
branches: [main]
pull_request:
branches:
- main
types: [opened, synchronize, reopened]

jobs:
tests:
scan:
runs-on: ubuntu-latest
env:
GO111MODULE: on
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ name: Lint
# 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
branches: [main]
pull_request:
types: [opened, synchronize, reopened]

jobs:
golangci:
name: golangci-lint
lint:
runs-on: ubuntu-latest
steps:
- name: Setup Go
Expand Down
9 changes: 4 additions & 5 deletions .github/workflows/simulation-test.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
name: Simulation Test

name: Simulation
on:
# Triggers the workflow on pull request events but only for the 'main' branch
push:
branches: [main]
pull_request:
branches: ["main"]
workflow_dispatch:
types: [opened, synchronize, reopened]

jobs:
simulation-test:
Expand Down

0 comments on commit cc4a644

Please sign in to comment.