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

[BOP-54] Run CI on a PR #6

Merged
merged 4 commits into from
Nov 2, 2023
Merged
Show file tree
Hide file tree
Changes from 2 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
3 changes: 3 additions & 0 deletions .github/development.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
GO_VERSION=1.21.3

UNIT_TEST_SCOPE=./cmd/... ./pkg/...
17 changes: 17 additions & 0 deletions .github/workflows/PR.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: PR

on:
pull_request:
types: ['opened', 'reopened', 'synchronize']
branches: [ "main" ]
paths:
- '**' # all files otherwise excludes wont work
- '!**/**/*.md' # ignore markdown files
nwneisen marked this conversation as resolved.
Show resolved Hide resolved

jobs:
vet:
uses: ./.github/workflows/vet.yml
unit-test:
uses: ./.github/workflows/unit.yml
build:
uses: ./.github/workflows/build.yml
11 changes: 11 additions & 0 deletions .github/workflows/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Workflows

There are two types of workflows in this directory. I would put them in subfolders but GitHub doesn't support that.

## Callers

These are the high level workflows that can be associated with what triggers them. PRs, releases, nightlys, merges, etc. These are made up of jobs that are defined the the other workflows. These are the workflows that you will see in the Actions tab of the repo. By grouping these tasks into parent workflows, the jobs are grouped under one action in the actions tab. They share the smaller 'job' workflows so that they always run the same way.

## Jobs

These are the smaller individual tasks that are used to build up the larger parent workflows. They can be thought of as running unit tests, building the binaries, or linting the code. When you open one of the parent caller actions in the actions tab, they will show these individual jobs.
4 changes: 1 addition & 3 deletions .github/workflows/build.yaml → .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
name: Build Docker Image

on:
pull_request:
types: [ opened, synchronize, reopened ]
branches: [ "main" ]
workflow_call:

jobs:
build:
Expand Down
25 changes: 25 additions & 0 deletions .github/workflows/unit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Run Unit Tests

on:
workflow_call:

jobs:
unit-tests:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Load environment
uses: c-py/action-dotenv-to-setenv@v4
with:
env-file: .github/development.env

- name: Setup Go ${{ env.GO_VERSION }}
uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}

- name: Run Unit Tests
working-directory: .
run: make test
25 changes: 25 additions & 0 deletions .github/workflows/vet.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Vet Go Code

on:
workflow_call:

jobs:
vet:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Load environment
uses: c-py/action-dotenv-to-setenv@v4
with:
env-file: .github/development.env

- name: Setup Go ${{ env.GO_VERSION }}
uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}

- name: Vet Go Code
working-directory: .
run: make vet