glowing-fiesta/.github/workflows/sonar.yml
Liviu Burcusel 47b3d73870
Some checks failed
Sonar / SonarQube (push) Successful in 52s
Sonar / Docker stuff (push) Failing after 46s
Test
2025-12-10 12:06:19 +01:00

100 lines
2.6 KiB
YAML

name: Sonar
permissions:
contents: read
pull-requests: write
on:
push:
branches:
- production
pull_request:
branches:
- production
types: [opened, synchronize, reopened]
env:
FORGEJO_HOST: git.burcusel.nl
CONTAINER_NAME: glowing-fiesta
jobs:
sonarqube:
name: SonarQube
runs-on: node24
steps:
- name: Setup Node environment
uses: actions/setup-node@v4
with:
node-version: "24"
- name: Code checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install dependencies
run: npm ci
- name: Run tests and generate coverage
run: npm run coverage
# continue-on-error: true
env:
CI: true
- name: Build site
env:
NODE_ENV: production
NITRO_PRESET: node_cluster
NITRO_CLUSTER_WORKERS: 4
run: npm run build
- name: Upload build artifacts
uses: actions/upload-artifact@v3
with:
name: output
path: .output/
overwrite: true
include-hidden-files: true
#- name: SonarQube Scan
# uses: SonarSource/sonarqube-scan-action@v6
# env:
# SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
#
docker-work:
name: Docker stuff
needs: sonarqube
runs-on: docker
steps:
- name: Prepare environment variables
run: |
echo REGISTRY=${{ env.FORGEJO_HOST }} >> $GITHUB_ENV
- name: Setup Node environment
run: |
apk add --update nodejs npm
node --version
npm --version
- name: Code checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Download build artifacts
uses: actions/download-artifact@v3
with:
name: output
path: ./output
- name: Login to the registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.PACKAGING_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v6
with:
context: context
push: true
provenance: false
tags: ${{ env.REGISTRY }}/${{ github.actor }}/${{ env.CONTAINER_NAME }}:latest
# - name: check docker
# run: |
# docker --version
# docker info
# - name: Build Docker image (pray)
# run: |
# docker build -f ./devops/Dockerfile -t glowing-fiesta:latest .
# - name: List Docker images (for verification)
# run: docker images
####