test: 🚧 check if work setting pool using forks #21
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: sonarcloud | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
tests-coverage: | |
name: Build code coverage | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: pnpm/action-setup@v3 | |
with: | |
version: latest | |
standalone: true | |
run_install: true | |
- name: Install tests/public/www.sat.gob.mx | |
run: | | |
if [ -z "$(which wget)" ]; then | |
apt-get -q update | |
apt-get -q install wget | |
fi | |
cd tests/public | |
rm -r -f www.sat.gob.mx | |
wget -q -r -i sat-urls.txt | |
find -type f -name "*.x*" -exec sed -i 's#http://www.sat.gob.mx/sitio_internet#http://localhost:8999/www.sat.gob.mx/sitio_internet#g' "{}" \; | |
- name: Create code coverage | |
run: pnpm run test:coverage | |
env: | |
CI: true | |
- name: Store code coverage | |
uses: actions/upload-artifact@v4 | |
with: | |
name: code-coverage | |
path: coverage | |
sonarcloud-secrets: | |
name: SonarCloud check secrets are present | |
runs-on: ubuntu-latest | |
outputs: | |
github: ${{ steps.check-secrets.outputs.github }} | |
sonar: ${{ steps.check-secrets.outputs.sonar }} | |
steps: | |
- name: Check secrets are present | |
id: check-secrets | |
run: | | |
if [ -n "${{ secrets.GITHUB_TOKEN }}" ]; then | |
echo "github=yes" >> $GITHUB_OUTPUT | |
else | |
echo "github=no" >> $GITHUB_OUTPUT | |
echo "::warning ::GITHUB_TOKEN non set" | |
fi | |
if [ -n "${{ secrets.SONAR_TOKEN }}" ]; then | |
echo "sonar=yes" >> $GITHUB_OUTPUT | |
else | |
echo "sonar=no" >> $GITHUB_OUTPUT | |
echo "::warning ::SONAR_TOKEN non set" | |
fi | |
sonarcloud: | |
name: SonarCloud Scan and Report | |
needs: ['tests-coverage', 'sonarcloud-secrets'] | |
if: ${{ needs.sonarcloud-secrets.outputs.github == 'yes' && needs.sonarcloud-secrets.outputs.sonar == 'yes' }} | |
runs-on: 'ubuntu-latest' | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Unshallow clone to provide blame information | |
run: git fetch --unshallow | |
- name: Obtain code coverage | |
uses: actions/download-artifact@v4 | |
with: | |
name: code-coverage | |
path: coverage | |
- name: SonarCloud Scan | |
uses: sonarsource/sonarcloud-github-action@master | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} |