|
| 1 | +name: SAST and Linting |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + - master |
| 8 | + |
| 9 | +jobs: |
| 10 | + huskyci: |
| 11 | + name: HuskyCI Security Check |
| 12 | + runs-on: [self-hosted] |
| 13 | + env: |
| 14 | + HUSKYCI_CLIENT_API_ADDR: "${{ secrets.HUSKYCI_CLIENT_API_ADDR }}" |
| 15 | + HUSKYCI_CLIENT_API_USE_HTTPS: false |
| 16 | + HUSKYCI_CLIENT_REPO_URL: git@github.com:${{ github.repository }}.git |
| 17 | + HUSKYCI_CLIENT_REPO_BRANCH: "master" |
| 18 | + HUSKYCI_CLIENT_TOKEN: "${{ secrets.HUSKYCI_CLIENT_TOKEN }}" |
| 19 | + HUSKYCI_CLIENT_URL: "git@github.com/githubanotaai/huskyci-api.git" |
| 20 | + |
| 21 | + steps: |
| 22 | + - name: Checkout repository |
| 23 | + uses: actions/checkout@v4 |
| 24 | + with: |
| 25 | + fetch-depth: 0 |
| 26 | + |
| 27 | + - name: Set up Go |
| 28 | + uses: actions/setup-go@v5 |
| 29 | + with: |
| 30 | + go-version: '^1.19' |
| 31 | + |
| 32 | + - run: go version |
| 33 | + |
| 34 | + - name: Downloading and installing tools |
| 35 | + run: | |
| 36 | + sudo apt-get update && sudo apt-get install -y --no-install-recommends make tcl-dev gettext libcurl4-openssl-dev openssh-client git |
| 37 | + sudo curl -SL https://github.com/docker/compose/releases/download/v2.32.0/docker-compose-linux-x86_64 -o /usr/local/bin/docker-compose |
| 38 | + sudo chmod +x /usr/local/bin/docker-compose |
| 39 | +
|
| 40 | + - name: HuskyCI Client Download, Build and Run |
| 41 | + run: | |
| 42 | + wget -O - https://github.com/githubanotaai/huskyci-api/archive/main.tar.gz | tar xz --strip=1 |
| 43 | + cd client/cmd |
| 44 | + go build -ldflags "-s -w" -o huskyci-client main.go |
| 45 | + git config --global --add safe.directory /__w/huskyci-api/huskyci-api |
| 46 | + chmod +x huskyci-client |
| 47 | + ./huskyci-client |
| 48 | +
|
| 49 | + - name: Debug SonarQube JSON File |
| 50 | + if: ${{ !cancelled() }} |
| 51 | + run: cat client/cmd/huskyCI/sonarqube.json |
| 52 | + |
| 53 | + - name: Upload SonarQube Artifact |
| 54 | + if: ${{ !cancelled() }} |
| 55 | + uses: actions/upload-artifact@v4 |
| 56 | + with: |
| 57 | + name: sonarqube |
| 58 | + path: client/cmd/huskyCI/sonarqube.json |
| 59 | + |
| 60 | + sonarqube: |
| 61 | + name: Sonarqube Check |
| 62 | + if: ${{ !cancelled() }} |
| 63 | + needs: huskyci |
| 64 | + runs-on: [self-hosted] |
| 65 | + env: {} |
| 66 | + |
| 67 | + steps: |
| 68 | + - name: Checkout repository |
| 69 | + uses: actions/checkout@v4 |
| 70 | + with: |
| 71 | + fetch-depth: 0 |
| 72 | + |
| 73 | + - name: Download SonarQube Artifact |
| 74 | + uses: actions/download-artifact@v4 |
| 75 | + with: |
| 76 | + name: sonarqube |
| 77 | + |
| 78 | + - name: Debug SonarQube JSON File |
| 79 | + if: ${{ !cancelled() }} |
| 80 | + run: cat ./sonarqube.json |
| 81 | + |
| 82 | + - name: Run SonarQube Scan |
| 83 | + uses: sonarsource/sonarqube-scan-action@v3 |
| 84 | + env: |
| 85 | + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} |
| 86 | + SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }} |
| 87 | + with: |
| 88 | + args: > |
| 89 | + -Dsonar.externalIssuesReportPaths=sonarqube.json |
0 commit comments