-
Notifications
You must be signed in to change notification settings - Fork 9
41 lines (40 loc) · 1.34 KB
/
quality-gate-test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
name: Validate
on:
pull_request:
branches:
- '**'
- '!test-sonar/**'
jobs:
sonar:
runs-on: ubuntu-latest
name: Test sonarqube
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Create and populate .Renviron file
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GIT_URL: "https://api.github.com"
GIT_TOKEN: ${{ secrets.GIT_TOKEN }}
SONAR_URL: ${{ secrets.SONAR_URL }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_PROJECT_KEY: ${{ secrets.SONAR_PROJECT_KEY }}
run: |
cat <<EOF > docker.env
GITHUB_TOKEN="$GITHUB_TOKEN"
GIT_URL="$GIT_URL"
GIT_TOKEN="$GIT_TOKEN"
SONAR_TOKEN="$SONAR_TOKEN"
SONAR_PROJECT_KEY="$SONAR_PROJECT_KEY"
GITHUB_REPOSITORY="$GITHUB_REPOSITORY"
GITHUB_EVENT_PATH="$GITHUB_EVENT_PATH"
EOF
echo $PWD
- name: Build docker images
run: |
docker build -t dieuhd/sonar-quality-gate .
docker build -t sonar-quality-gate action/
- name: Run tests
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: docker run -i -v "$PWD:/srv" --env-file docker.env -w /srv sonar-quality-gate -D sonar.login=$SONAR_TOKEN --git.merge_id="${{ github.event.number }}"