Skip to content

Commit

Permalink
Update codeql.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
SashaXser authored Oct 13, 2024
1 parent 1d64eda commit 2d687d2
Showing 1 changed file with 57 additions and 95 deletions.
152 changes: 57 additions & 95 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -1,106 +1,68 @@
name: Build GoodbyeDPI with CodeQL
name: "CodeQL Advanced"

on:
push:
paths:
- 'src/**'
branches: [ "fix" ]
pull_request:
paths:
- 'src/**'
workflow_dispatch:

env:
WINDIVERT_URL: https://reqrypt.org/download/WinDivert-2.2.0-D.zip
WINDIVERT_NAME: WinDivert-2.2.0-D.zip
WINDIVERT_BASENAME: WinDivert-2.2.0-D
WINDIVERT_SHA256: 1d461cfdfa7ba88ebcfbb3603b71b703e9f72aba8aeff99a75ce293e6f89d2ba
branches: [ "fix" ]
schedule:
- cron: '16 3 * * 6'

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Declare short commit variable
id: vars
run: |
echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- name: Install MinGW-w64
run: >
sudo rm /var/lib/man-db/auto-update &&
sudo DEBIAN_FRONTEND=noninteractive XZ_DEFAULTS="-T0" XZ_OPT="-T0" eatmydata
apt install -y --no-install-recommends gcc-mingw-w64
- name: Download WinDivert from cache
id: windivert-cache
uses: actions/cache@v4
with:
path: ${{ env.WINDIVERT_NAME }}
key: ${{ env.WINDIVERT_SHA256 }}

- name: Download WinDivert from the website
if: steps.windivert-cache.outputs.cache-hit != 'true'
run: >
wget ${{ env.WINDIVERT_URL }} &&
(echo ${{ env.WINDIVERT_SHA256 }} ${{ env.WINDIVERT_NAME }} | sha256sum -c)
- name: Unpack WinDivert
run: unzip ${{ env.WINDIVERT_NAME }}

- name: Compile x86_64
run: >
cd src && make clean &&
make CPREFIX=x86_64-w64-mingw32- BIT64=1 WINDIVERTHEADERS=../${{ env.WINDIVERT_BASENAME }}/include WINDIVERTLIBS=../${{ env.WINDIVERT_BASENAME }}/x64 -j4
- name: Prepare x86_64 directory
run: |
mkdir goodbyedpi_x86_64_${{ steps.vars.outputs.sha_short }}
cp src/goodbyedpi.exe ${{ env.WINDIVERT_BASENAME }}/x64/*.{dll,sys} goodbyedpi_x86_64_${{ steps.vars.outputs.sha_short }}
- name: Upload output file x86_64
uses: actions/upload-artifact@v4
with:
name: goodbyedpi_x86_64_${{ steps.vars.outputs.sha_short }}
path: goodbyedpi_x86_64_${{ steps.vars.outputs.sha_short }}

- name: Compile i686
run: >
cd src && make clean &&
make CPREFIX=i686-w64-mingw32- WINDIVERTHEADERS=../${{ env.WINDIVERT_BASENAME }}/include WINDIVERTLIBS=../${{ env.WINDIVERT_BASENAME }}/x86 -j4
- name: Prepare x86 directory
run: |
mkdir goodbyedpi_x86_${{ steps.vars.outputs.sha_short }}
cp src/goodbyedpi.exe ${{ env.WINDIVERT_BASENAME }}/x86/*.{dll,sys} goodbyedpi_x86_${{ steps.vars.outputs.sha_short }}
- name: Upload output file x86
uses: actions/upload-artifact@v4
with:
name: goodbyedpi_x86_${{ steps.vars.outputs.sha_short }}
path: goodbyedpi_x86_${{ steps.vars.outputs.sha_short }}

analyze:
name: Analyze with CodeQL
name: Analyze (${{ matrix.language }})
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout repository
uses: actions/checkout@v4
permissions:
security-events: write
packages: read
actions: read
contents: read

- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: 'c-cpp'
build-mode: 'autobuild'
strategy:
matrix:
language: [c-cpp]
build-mode: [autobuild]

- name: Build project
run: |
cd src
make
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
with:
category: "/language:c-cpp"
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install MinGW-w64
run: |
sudo rm /var/lib/man-db/auto-update &&
sudo DEBIAN_FRONTEND=noninteractive XZ_DEFAULTS="-T0" XZ_OPT="-T0" eatmydata
apt install -y --no-install-recommends gcc-mingw-w64
- name: Download WinDivert from cache
id: windivert-cache
uses: actions/cache@v4
with:
path: ${{ env.WINDIVERT_NAME }}
key: ${{ env.WINDIVERT_SHA256 }}

- name: Download WinDivert from the website
if: steps.windivert-cache.outputs.cache-hit != 'true'
run: |
wget ${{ env.WINDIVERT_URL }} &&
(echo ${{ env.WINDIVERT_SHA256 }} ${{ env.WINDIVERT_NAME }} | sha256sum -c)
- name: Unpack WinDivert
run: unzip ${{ env.WINDIVERT_NAME }}

- name: Build project for analysis
run: |
cd src
make clean
make CPREFIX=x86_64-w64-mingw32- BIT64=1 WINDIVERTHEADERS=../${{ env.WINDIVERT_BASENAME }}/include WINDIVERTLIBS=../${{ env.WINDIVERT_BASENAME }}/x64 -j4
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
build-mode: ${{ matrix.build-mode }}

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
with:
category: "/language:${{matrix.language}}"

0 comments on commit 2d687d2

Please sign in to comment.