static-analysis.yml (3343B)
1 name: static-analysis 2 3 on: 4 workflow_run: 5 # Perform static analysis together with build workflow. Build triggers of "build" workflow do not need to be repeated here. 6 workflows: 7 - build 8 types: 9 - requested 10 11 jobs: 12 PVS-Studio: 13 runs-on: ubuntu-18.04 14 steps: 15 - uses: actions/checkout@v1 16 with: 17 fetch-depth: 1 18 19 - name: Install Dependencies 20 env: 21 # The Secret variable setup in GitHub must be in format: "name_or_email key", on a single line 22 PVS_STUDIO_LICENSE: ${{ secrets.PVS_STUDIO_LICENSE }} 23 run: | 24 if [[ "$PVS_STUDIO_LICENSE" != "" ]]; 25 then 26 wget -q https://files.viva64.com/etc/pubkey.txt 27 sudo apt-key add pubkey.txt 28 sudo wget -O /etc/apt/sources.list.d/viva64.list https://files.viva64.com/etc/viva64.list 29 sudo apt-get update 30 sudo apt-get install -y pvs-studio 31 pvs-studio-analyzer credentials -o pvs-studio.lic $PVS_STUDIO_LICENSE 32 fi 33 34 - name: PVS-Studio static analysis 35 run: | 36 if [[ ! -f pvs-studio.lic ]]; 37 then 38 echo "PVS Studio license is missing. No analysis will be performed." 39 echo "If you have a PVS Studio license please create a project secret named PVS_STUDIO_LICENSE with your license." 40 echo "You may use a free license. More information at https://www.viva64.com/en/b/0457/" 41 exit 0 42 fi 43 cd examples/example_null 44 pvs-studio-analyzer trace -- make WITH_EXTRA_WARNINGS=1 45 pvs-studio-analyzer analyze -e ../../imstb_rectpack.h -e ../../imstb_textedit.h -e ../../imstb_truetype.h -l ../../pvs-studio.lic -o pvs-studio.log 46 plog-converter -a 'GA:1,2;OP:1' -t errorfile -w pvs-studio.log 47 48 Discord-CI: 49 runs-on: ubuntu-18.04 50 needs: [PVS-Studio] 51 if: always() 52 steps: 53 - uses: dearimgui/github_discord_notifier@latest 54 with: 55 discord-webhook: ${{ secrets.DISCORD_CI_WEBHOOK }} 56 github-token: ${{ github.token }} 57 action-task: discord-jobs 58 discord-filter: "'{{ github.branch }}'.match(/master|docking/g) != null && '{{ run.conclusion }}' != '{{ last_run.conclusion }}'" 59 discord-username: GitHub Actions 60 discord-job-new-failure-message: '' 61 discord-job-fixed-failure-message: '' 62 discord-job-new-failure-embed: | 63 { 64 "title": "`{{ job.name }}` job is failing on `{{ github.branch }}`!", 65 "description": "Commit [{{ github.context.payload.head_commit.title }}]({{ github.context.payload.head_commit.url }}) pushed to [{{ github.branch }}]({{ github.branch_url }}) broke static analysis [{{ job.name }}]({{ job.url }}) job.\nFailing steps: {{ failing_steps }}", 66 "url": "{{ job.url }}", 67 "color": "0xFF0000", 68 "timestamp": "{{ run.updated_at }}" 69 } 70 discord-job-fixed-failure-embed: | 71 { 72 "title": "`{{ github.branch }}` branch is no longer failing!", 73 "description": "Static analysis failures were fixed on [{{ github.branch }}]({{ github.branch_url }}) branch.", 74 "color": "0x00FF00", 75 "url": "{{ github.context.payload.head_commit.url }}", 76 "timestamp": "{{ run.completed_at }}" 77 }