-
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.
* test: added test for health check * test: created db helper function * docs: fixed license headers * test: added CI test step * ci: added setup go-v5 * test: fixed test condition * fix: updated dependencies * chore: added test coverage * ci: updated action versions * ci: updated badge step * ci: updated badge action * ci: more ci testing * ci: with app * ci: option 1 * ci: more ci test * ci: more test * chore: Updated coverage badge. * ci: working logic * ci: ready for merge --------- Co-authored-by: GitHub Action <[email protected]>
- Loading branch information
1 parent
4d3aea0
commit 5d35b4b
Showing
23 changed files
with
874 additions
and
103 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,15 @@ | ||
schema_version = 1 | ||
|
||
project { | ||
copyright_holder = "Spectro Cloud" | ||
license = "MPL-2.0" | ||
copyright_year = 2024 | ||
|
||
# (OPTIONAL) A list of globs that should not have copyright/license headers. | ||
# Supports doublestar glob patterns for more flexibility in defining which | ||
# files or folders should be ignored | ||
header_ignore = [ | ||
# "vendors/**", | ||
# "**autogen**", | ||
] | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,9 +2,9 @@ name: Pull Request | |
|
||
on: | ||
pull_request: | ||
types: ['synchronize', 'opened', 'reopened', 'ready_for_review'] | ||
types: ["synchronize", "opened", "reopened", "ready_for_review"] | ||
branches: | ||
- main | ||
- main | ||
|
||
env: | ||
DB_VERSION: 1.0.0 | ||
|
@@ -21,58 +21,117 @@ jobs: | |
shell: bash | ||
if: ${{ !github.event.pull_request.draft }} | ||
steps: | ||
# If the condition above is not met, aka, the PR is not in draft status, then this step is skipped. | ||
# Because this step is part of the critical path, omission of this step will result in remaining CI steps not gettinge executed. | ||
# As of 8/8/2022 there is now way to enforce this beahvior in GitHub Actions CI. | ||
# If the condition above is not met, aka, the PR is not in draft status, then this step is skipped. | ||
# Because this step is part of the critical path, omission of this step will result in remaining CI steps not gettinge executed. | ||
# As of 8/8/2022 there is now way to enforce this beahvior in GitHub Actions CI. | ||
- run: exit 0 | ||
|
||
Docker: | ||
needs: [run-ci] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- uses: actions/setup-go@v3.1.0 | ||
with: | ||
go-version: '1.20' | ||
check-latest: true | ||
- uses: actions/setup-go@v5 | ||
with: | ||
go-version: "1.21" | ||
check-latest: true | ||
|
||
- name: Build | ||
run: | | ||
docker system prune -a -f | ||
docker build --no-cache -t api-server:test . | ||
- name: Build | ||
run: | | ||
docker system prune -a -f | ||
docker build --no-cache -t api-server:test . | ||
Linting: | ||
needs: [run-ci] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- uses: actions/setup-go@v3.1.0 | ||
with: | ||
go-version: '1.20' | ||
check-latest: true | ||
- uses: actions/setup-go@v5 | ||
with: | ||
go-version: "1.21" | ||
check-latest: true | ||
|
||
- name: Lint Internal Package | ||
uses: golangci/[email protected] | ||
with: | ||
args: --verbose --timeout 5m | ||
- name: Lint Internal Package | ||
uses: golangci/[email protected] | ||
with: | ||
args: --verbose --timeout 5m | ||
|
||
API-Test: | ||
Tests: | ||
runs-on: ubuntu-latest | ||
needs: [run-ci] | ||
permissions: | ||
contents: write | ||
pull-requests: write | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Retrieve Credentials | ||
id: import-secrets | ||
uses: hashicorp/vault-action@v2 | ||
with: | ||
url: https://vault.prism.spectrocloud.com | ||
method: approle | ||
roleId: ${{ secrets.VAULT_ROLE_ID }} | ||
secretId: ${{ secrets.VAULT_SECRET_ID }} | ||
secrets: /providers/github/organizations/spectrocloud/token?org_name=spectrocloud token | VAULT_GITHUB_TOKEN | ||
|
||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ github.head_ref }} | ||
fetch-depth: 0 | ||
token: ${{ steps.import-secrets.outputs.VAULT_GITHUB_TOKEN }} | ||
|
||
- name: Setup Nodejs | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18 | ||
|
||
- name: Install Dependencies | ||
run: make tests | ||
|
||
- name: Go Coverage Badge | ||
uses: tj-actions/coverage-badge-go@v2 | ||
with: | ||
filename: coverage.out | ||
|
||
- name: Verify Changed files | ||
uses: tj-actions/verify-changed-files@v18 | ||
id: verify-changed-files | ||
with: | ||
files: README.md | ||
|
||
- name: Setup Nodejs | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18 | ||
- name: Commit changes | ||
if: steps.verify-changed-files.outputs.files_changed == 'true' | ||
run: | | ||
git config --local user.email "[email protected]" | ||
git config --local user.name "GitHub Action" | ||
git add README.md | ||
git commit -m "chore: Updated coverage badge." | ||
- name: Push changes | ||
if: steps.verify-changed-files.outputs.files_changed == 'true' | ||
uses: ad-m/github-push-action@master | ||
with: | ||
github_token: ${{ steps.import-secrets.outputs.VAULT_GITHUB_TOKEN }} | ||
branch: ${{ github.GITHUB_REF }} # This also worked with GITHUB_BASE_REF | ||
repository: ${{ github.repository }} | ||
force_with_lease: true | ||
|
||
API-Test: | ||
runs-on: ubuntu-latest | ||
needs: [run-ci] | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: API Test | ||
run: | | ||
make ci-tests | ||
- uses: actions/setup-go@v5 | ||
with: | ||
go-version: "1.21" | ||
check-latest: true | ||
|
||
- name: API Test | ||
run: | | ||
make ci-tests |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,18 @@ | ||
/** | ||
* Copyright (c) HashiCorp, Inc. | ||
* Copyright (c) Spectro Cloud | ||
* SPDX-License-Identifier: MPL-2.0 | ||
*/ | ||
|
||
module.exports = { | ||
extends: [ | ||
'@commitlint/config-conventional' | ||
], | ||
rules: { | ||
'body-max-length': [0, 'always'], | ||
'body-max-line-length': [0, 'always'], | ||
'footer-max-length': [0, 'always'], | ||
'footer-max-line-length': [0, 'always'], | ||
'header-max-length': [0, 'always'], | ||
'scope-max-length': [0, 'always'], | ||
'subject-max-length': [0, 'always'], | ||
'type-max-length': [0, 'always'], | ||
}, | ||
} | ||
extends: ["@commitlint/config-conventional"], | ||
rules: { | ||
"body-max-length": [0, "always"], | ||
"body-max-line-length": [0, "always"], | ||
"footer-max-length": [0, "always"], | ||
"footer-max-line-length": [0, "always"], | ||
"header-max-length": [0, "always"], | ||
"scope-max-length": [0, "always"], | ||
"subject-max-length": [0, "always"], | ||
"type-max-length": [0, "always"], | ||
}, | ||
}; |
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.