Skip to content

Commit

Permalink
Create common workflow action (#96)
Browse files Browse the repository at this point in the history
* add reusable unit test action

* set a default

* add gosec

* edits

* add readme

* Update README.md
  • Loading branch information
shaynafinocchiaro authored Nov 5, 2024
1 parent 0a8c960 commit 9beeccb
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 0 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/go-common.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Copyright (c) 2024 Dell Inc., or its subsidiaries. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0

# Reusable workflow to run unit tests and gosec on Golang based projects
name: Common Workflows

on:
workflow_call:

env:
CODE_COVERAGE_TARGET: ${{ vars.CODE_COVERAGE_TARGET || 90 }}

jobs:
gocoverage:
name: Unit tests and package coverage
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Run unit tests and check package coverage
uses: dell/common-github-actions/go-code-tester@main
with:
threshold: ${{ env.CODE_COVERAGE_TARGET }}
test-folder: ${{ vars.CODE_COVERAGE_DIR }}

security:
name: GoSec
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: gosec
uses: dell/common-github-actions/gosec-runner@main
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,26 @@ jobs:
secrets: inherit
```
### go-common
This workflow runs unit tests, checks package coverage and runs gosec against repositories that utilize Golang as the primary development language.
```
name: Common Workflows
on: # yamllint disable-line rule:truthy
push:
branches: [main]
pull_request:
branches: ["**"]

jobs:

# unit tester and gosec runner
common:
name: Run gosec, unit tests, and check package coverage
uses: dell/common-github-actions/.github/workflows/go-common.yml@main
```
## Support
Don’t hesitate to ask! Contact the team and community on [our support](./docs/SUPPORT.md).
Expand Down

0 comments on commit 9beeccb

Please sign in to comment.