forked from opentdf/platform
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5f7b18e
commit 127d1cb
Showing
64 changed files
with
485 additions
and
2,249 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
# This GitHub action will check that the developer tools are run | ||
# This checks code quality | ||
# https://github.com/golangci/golangci-lint-action | ||
# act --secret-file act.env --container-architecture linux/amd64 --workflows .github/workflows/analyze.yaml | ||
name: analyze | ||
on: | ||
push: | ||
permissions: | ||
contents: read | ||
jobs: | ||
lint: | ||
name: lint | ||
strategy: | ||
matrix: | ||
go: ['1.22'] | ||
os: [ubuntu-latest] | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-go@v4 | ||
with: | ||
go-version: ${{ matrix.go }} | ||
# Run golangci-lint tool against configuration .golangci.yaml | ||
# https://github.com/marketplace/actions/run-golangci-lint | ||
- name: golangci-lint | ||
uses: golangci/golangci-lint-action@v3 | ||
with: | ||
version: latest | ||
# This job will build the run go test with coverage | ||
coverage: | ||
name: coverage | ||
strategy: | ||
matrix: | ||
go: ['1.22'] | ||
os: [ubuntu-latest] | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-go@v4 | ||
with: | ||
go-version: ${{ matrix.go }} | ||
# Run go test with coverage | ||
- name: coverprofile | ||
run: go test ./... -coverprofile=./cover.out | ||
# Run go test with coverage | ||
# https://github.com/marketplace/actions/go-test-coverage | ||
- name: go-test-coverage | ||
uses: vladopajic/go-test-coverage@v2 | ||
with: | ||
# Configure action by specifying input parameters individually (option 2) | ||
profile: cover.out | ||
local-prefix: ${{ github.repository }} | ||
threshold-file: 0 | ||
threshold-package: 20 | ||
threshold-total: 25 | ||
|
||
# TODO | ||
# # test and benchmark | ||
# RUN go test -bench=. -benchmem ./... | ||
# # race condition | ||
# RUN CGO_ENABLED=1 GOOS=linux go build -v -a -race -installsuffix cgo -o . ./... |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
# This GitHub action will check the developer process | ||
# act --secret-file act.env --container-architecture linux/amd64 --workflows .github/workflows/process.yaml | ||
name: process | ||
on: | ||
pull_request: | ||
branches: [ main ] | ||
|
||
jobs: | ||
check-version: | ||
runs-on: ubuntu-latest | ||
steps: | ||
# This step will checkout the source code of the pull request branch | ||
- name: Checkout source code | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 # Fetch all history for all branches and tags | ||
# This step will read the version number from the VERSION file in the pull request branch | ||
# and store it as an output variable named version | ||
- name: Read VERSION file from pull request branch | ||
id: version-pr | ||
run: echo "::set-output name=version::$(cat VERSION)" | ||
# This step will read the version number from the VERSION file in the base branch | ||
# and store it as an output variable named version | ||
- name: Read VERSION file from base branch | ||
id: version-base | ||
run: | | ||
git checkout ${{ github.base_ref }} | ||
echo "::set-output name=version::$(cat VERSION)" | ||
- name: View context attributes | ||
uses: actions/github-script@v6 | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
script: console.log(context) | ||
- run: npm install semver | ||
# This step will compare the version numbers using a semantic versioning library | ||
# and set the action status to failed if the version number in the pull request branch | ||
# is not valid or not greater than the one in the base branch | ||
- name: Compare version numbers | ||
uses: actions/github-script@v6 | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
script: | | ||
const semver = require('semver') | ||
const versionPr = '${{ steps.version-pr.outputs.version }}' | ||
const versionBase = '${{ steps.version-base.outputs.version }}' | ||
if (!semver.valid(versionPr)) { | ||
const reason = `Invalid version number: ${versionPr}` | ||
// requires authorization | ||
// github.rest.pulls.createReviewComment({ | ||
// owner: context.repo.owner, | ||
// repo: context.repo.repo, | ||
// pull_number: context.runId, | ||
// body: reason, | ||
// commit_id: context.sha, | ||
// path: "VERSION", | ||
// line: 1 | ||
// }); | ||
core.setFailed(reason) | ||
} else if (!semver.gt(versionPr, versionBase)) { | ||
const reason = `Version number not incremented: ${versionPr} <= ${versionBase}` | ||
// github.rest.pulls.createReviewComment({ | ||
// owner: context.repo.owner, | ||
// repo: context.repo.repo, | ||
// pull_number: context.runId, | ||
// body: reason, | ||
// commit_id: context.sha, | ||
// path: "VERSION", | ||
// line: 1 | ||
// }); | ||
core.setFailed(reason) | ||
} else { | ||
console.log(`Version number OK: ${versionPr} > ${versionBase}`) | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.