chore(deps): lock file maintenance #243
Workflow file for this run
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: build | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
#-------------------------------------------------- | |
# Build and Tests the project on Linux | |
#-------------------------------------------------- | |
tests: | |
name: tests | |
runs-on: ubuntu-latest | |
timeout-minutes: 20 | |
steps: | |
- name: 'Setup: checkout project' | |
uses: actions/checkout@v4 | |
- name: 'Setup: environment' | |
id: setup | |
uses: ./.github/actions/setup | |
- name: 'Init: cache local Maven repository' | |
uses: actions/cache@v4 | |
with: | |
path: ~/.m2/repository | |
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | |
restore-keys: | | |
${{ runner.os }}-maven- | |
- name: 'Init: install Node.js packages' | |
run: npm ci | |
- name: 'Prettier: check' | |
run: npm run prettier:check | |
- name: 'Start local Sonar' | |
run: docker compose -f src/main/docker/sonar.yml up -d | |
- name: 'Wait for SonarQube to be ready' | |
run: | | |
echo 'Waiting for SonarQube to start...' | |
for attempt in {1..30}; do | |
if [ "$(curl -s -o /dev/null -w '%{http_code}' http://localhost:9001/api/system/status)" -eq 200 ] && \ | |
curl -s http://localhost:9001/api/system/status | jq -e '.status == "UP"' > /dev/null; then | |
echo "SonarQube is UP" | |
break | |
fi | |
echo "Waiting for SonarQube... ($attempt/30)" | |
sleep 10 | |
done | |
if [ $attempt -eq 30 ]; then | |
echo 'SonarQube did not become ready in time. Exiting.' | |
exit 1 | |
fi | |
- name: 'Test: run tests' | |
run: | | |
chmod +x mvnw | |
./mvnw clean verify -Dsonar.qualitygate.wait=true sonar:sonar | |
- name: 'Analysis: local Sonar' | |
run: | | |
chmod +x tests-ci/sonar.sh | |
./tests-ci/sonar.sh | |
- name: 'Analysis: SonarCloud' | |
if: github.repository == 'jhipster/jhipster-lite-extension' && github.ref == 'refs/heads/main' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
run: ./mvnw initialize sonar:sonar -Dsonar.host.url=https://sonarcloud.io -Dsonar.projectKey=jhipster_jhipster-lite-extension -Dsonar.organization=jhipster -Dsonar.login= -Dsonar.password= | |
- name: 'Test: generate sample app' | |
run: | | |
./tests-ci/start.sh | |
./tests-ci/generate.sh fullapp maven yaml | |
./tests-ci/stop.sh | |
- name: 'Test: verify generated sample app' | |
working-directory: /tmp/jhlite/fullapp/ | |
run: | | |
if [ -f 'mvnw' ]; then | |
./mvnw clean verify | |
elif [ -f 'gradlew' ]; then | |
./gradlew clean build --no-daemon --info | |
else | |
npm install | |
npm test | |
fi |