Test #133
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
name: Test | |
on: | |
pull_request: | |
push: | |
branches: | |
- main | |
- releases/* | |
schedule: | |
- cron: '55 23 * * 5' # Runs at 23:55 every Friday | |
jobs: | |
sonarless-cli-test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Sonarless install test - from internet | |
run: | | |
cp ./install.sh /tmp | |
cd /tmp | |
cat ./install.sh | bash | |
- name: Check Install | |
run: | | |
grep "sonarless" ~/.bashrc | |
ls -lah $HOME/.sonarless/makefile.sh | |
$HOME/.sonarless/makefile.sh help | |
sonarless-cli-test-from-git: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Sonarless install test - from git | |
run: | | |
cat ./install.sh | bash | |
- name: Check Install | |
run: | | |
grep "sonarless" ~/.bashrc | |
ls -lah $HOME/.sonarless/makefile.sh | |
$HOME/.sonarless/makefile.sh help | |
- name: Sonarless uninstall test | |
run: | | |
$HOME/.sonarless/makefile.sh uninstall | |
- name: Check Uninstall | |
run: | | |
if [[ -d "$HOME/.sonarless" ]]; then | |
echo "sonarless scriptlet is not uninstalled - bad" | |
exit 1 | |
else | |
echo "sonarless scriptlet removed - good" | |
fi | |
sonarless-action-test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Sonarless Scan | |
uses: ./ | |
with: | |
sonar-source-path: '.' | |
sonar-metrics-path: './blahblah.json' | |
sonar-instance-port: '9999' | |
- name: Check Sonar Metrics | |
run: | | |
echo "Checking for 0 vulnerabilities in Sonar Metrics JSON" | |
VULN=$(cat ./blahblah.json | jq -r '.component.measures[] | select(.metric == "vulnerabilities").value') | |
echo "# of vulnerabilities = ${VULN}" | |
[ "${VULN}" -eq "0" ] | |
echo "Checking for any issues <= 3 in Sonar Metrics JSON" | |
ISSUES=$(cat ./blahblah.json | jq -r '.component.measures[] | select(.metric == "open_issues").value') | |
echo "# of issues = ${ISSUES}" | |
[ "${ISSUES}" -le 3 ] |