-
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
fab35dc
commit 0cd339f
Showing
62 changed files
with
839 additions
and
2,294 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 |
---|---|---|
@@ -1 +1,3 @@ | ||
tests | ||
build | ||
.github |
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,38 @@ | ||
name: Build | ||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
types: [opened, synchronize, reopened] | ||
jobs: | ||
build: | ||
name: Build | ||
runs-on: ubuntu-22.04 | ||
permissions: | ||
id-token: write | ||
contents: read | ||
steps: | ||
- id: secrets | ||
uses: SonarSource/vault-action-wrapper@d0877ce7085bc313bd7a7b99c4e4489d42fb40e1 # 3.0.0 | ||
with: | ||
secrets: | | ||
development/kv/data/sonarcloud token | sonarcloud_token; | ||
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | ||
with: | ||
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis | ||
- name: Set up Python | ||
uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # v5.0.0 | ||
with: | ||
python-version: "3.10" | ||
- name: Build | ||
working-directory: . | ||
run: | | ||
python -m pip install --upgrade pip pipenv | ||
make test | ||
sed -i "s|<source>${GITHUB_WORKSPACE}|<source>/github/workspace|g" "${GITHUB_WORKSPACE}/build/coverage.xml" | ||
- name: SonarCloud Scan | ||
uses: SonarSource/sonarcloud-github-action@49e6cd3b187936a73b8280d59ffd9da69df63ec9 # v2.1.1 | ||
env: | ||
SONAR_TOKEN: ${{ fromJSON(steps.secrets.outputs.vault).sonarcloud_token }} | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any |
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,65 @@ | ||
on: | ||
pull_request: | ||
push: | ||
branches: [master] | ||
|
||
permissions: | ||
id-token: write | ||
|
||
jobs: | ||
it-tests-use-unknown-version-values-output: | ||
name: "IT Test - releasability checks should fail on sonar-dummy with a wrong version" | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | ||
- name: Given the gh-action is used with default values | ||
id: test-data | ||
uses: ./ | ||
with: | ||
organization: "SonarSource" | ||
repository: "sonar-dummy" | ||
branch: "master" | ||
version: "4242.42.42.43" | ||
commit-sha: "e01f0f6545c31755d6ca128c5a3a14f6bf" | ||
ignore-failure: true | ||
- uses: nick-fields/assert-action@aa0067e01f0f6545c31755d6ca128c5a3a14f6bf # v2 | ||
name: Then outputs.status value must be 1 as there is no way this version exists within Jira | ||
with: | ||
expected: 1 | ||
actual: ${{ steps.test-data.outputs.status }} | ||
comparison: exact | ||
|
||
it-tests-use-unknown-version-values-logs: | ||
name: "IT Test - releasability checks should print failing Jira checks on sonar-dummy with a wrong version" | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | ||
- name: Given the gh-action is used with default values | ||
id: test-data | ||
uses: ./ | ||
with: | ||
organization: "SonarSource" | ||
repository: "sonar-dummy" | ||
branch: "master" | ||
version: "4242.42.42.43" | ||
commit-sha: "e01f0f6545c31755d6ca128c5a3a14f6bf" | ||
ignore-failure: true | ||
- uses: nick-fields/assert-action@aa0067e01f0f6545c31755d6ca128c5a3a14f6bf # v2 | ||
name: Then outputs.logs value must contains a Jira failing check | ||
with: | ||
expected: "❌ Jira - version not found in Jira" | ||
actual: ${{ steps.test-data.outputs.logs }} | ||
comparison: contains | ||
|
||
it-tests: | ||
name: "All IT Tests have to pass" | ||
runs-on: ubuntu-latest | ||
if: always() | ||
needs: | ||
# Add your tests here so that they prevent the merge of broken changes | ||
- it-tests-use-unknown-version-values-output | ||
- it-tests-use-unknown-version-values-logs | ||
steps: | ||
- uses: re-actors/alls-green@05ac9388f0aebcb5727afa17fcccfecd6f8ec5fe # v1.2.2 | ||
with: | ||
jobs: ${{ toJSON(needs) }} |
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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
.vscode | ||
__pycache__ | ||
.idea/ | ||
*.iml | ||
src/.coverage | ||
src/build/ | ||
out/ | ||
coverage.xml |
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,42 @@ | ||
# Developer notes | ||
|
||
> You want to contribute to this project ? Please read the following | ||
## IT Tests | ||
|
||
This project define integrations tests in `.github/workflows/it-test.yml`. | ||
|
||
Test assertions are done using [nick-fields/assert-action](https://github.com/nick-fields/assert-action). | ||
|
||
### Side note | ||
|
||
At the moment, GitHub branch protection do not allow to define checks based | ||
on a REGEX as we can find in other CI tools such as Jenkins. | ||
|
||
In order to work around this limitation this project make | ||
use of [re-actors/alls-green](https://github.com/re-actors/alls-green). | ||
|
||
All tests have to be declared in `.github/workflows/it-test.yml` | ||
the job called `it-tests` declares a list of needs: | ||
|
||
```yaml | ||
... | ||
needs: | ||
... | ||
- it-tests-output-logs-failure | ||
- it-tests-output-logs-success | ||
- < your new test > <-------------- Add your tests here | ||
``` | ||
## PyCharm users | ||
There is currently a bug in pycharm to support pytest properly. | ||
To run the tests locally either comment the line: | ||
```ini | ||
addopts = --cov=src --cov-report html:build/coverage-html \ | ||
--cov-report xml:build/coverage.xml \ | ||
--cov-report term | ||
``` | ||
|
||
in pytest.ini or delete pytest.ini locally |
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,3 +1,64 @@ | ||
# gh-action_releasability | ||
# SonarSource GitHub Action for releasability checks | ||
|
||
SonarSource GitHub releasability action | ||
 | ||
[](https://sonarcloud.io/summary/new_code?id=SonarSource_gh-action_releasability) | ||
[](https://github.com/SonarSource/gh-action_releasability/actions/workflows/it-test.yml) | ||
|
||
Trigger [ops-releasability checks](https://github.com/SonarSource/ops-releasability) and collect results. | ||
|
||
## Usage | ||
|
||
### Verify that all releasability checks pass before actually doing a new release | ||
|
||
Trigger manually: | ||
[releasability_checks.yml](https://github.com/SonarSource/gh-action_releasability/actions/workflows/releasability_checks.yml) | ||
|
||
 | ||
|
||
### Use as a step in another workflow | ||
|
||
Within an existing GitHub workflow: | ||
|
||
```yaml | ||
|
||
... | ||
steps: | ||
- uses: SonarSource/gh-action_releasability@0.0.1 <--- replace with last tag | ||
id: releasability-checks | ||
with: | ||
organization: | ||
repository: | ||
branch: | ||
version: | ||
commit-sha: | ||
``` | ||
The following permission is required: | ||
```yaml | ||
permissions: | ||
id-token: write | ||
``` | ||
## Options | ||
| Option name | Description | Default | | ||
|------------------|---------------------------------------------------------------------------------------------------------|---------| | ||
| `organization` | Used to specify the GitHub organization used (i.e: SonarSource) | - | | ||
| `repository` | Used to specify the GitHub repository name | - | | ||
| `branch` | Used to specify the GitHub repository branch name | - | | ||
| `version` | Used to specify the version to check (Using Sonar org format: `x.x.x.x` `major.minor.patch.build_number`) | - | | ||
| `commit-sha` | Used to specify the GitHub commit sha to use | - | | ||
| `ignore-failure` | Used to not fail the gh-action in case of releasability check failure | `false` | | ||
|
||
## Versioning | ||
|
||
This project is using [Semantic Versioning](https://semver.org/). | ||
|
||
The `master` branch shall not be referenced by end-users, | ||
please use tags instead and [Renovate](https://docs.renovatebot.com/) or | ||
[Dependabot](https://docs.github.com/en/code-security/dependabot) to stay up to date. | ||
|
||
## Contribute | ||
|
||
Contributions are welcome, please have a look at [DEV.md](./DEV.md) |
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,5 @@ | ||
[pytest] | ||
minversion = 6.0 | ||
addopts = --cov=src --cov-report html:build/coverage-html --cov-report xml:build/coverage.xml --cov-report term | ||
pythonpath = src | ||
testpaths = tests |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.