2929 with :
3030 egress-policy : audit
3131 - uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
32+ - name : Cache yara-x-capi installation
33+ id : yara-x-capi
34+ uses : actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3
35+ with :
36+ path : yara-x-install
37+ key : yara-x-capi-v1.12.0-${{ runner.os }}
3238 - name : Checkout virusTotal/yara-x
39+ if : steps.yara-x-capi.outputs.cache-hit != 'true'
3340 uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
3441 with :
3542 fetch-depth : 0
@@ -38,23 +45,32 @@ jobs:
3845 path : yara-x
3946 ref : refs/tags/v1.12.0
4047 - name : Install Rust for yara-x-capi
48+ if : steps.yara-x-capi.outputs.cache-hit != 'true'
4149 uses : dtolnay/rust-toolchain@e97e2d8cc328f1b50210efc529dca0028893a2d9
4250 with :
4351 toolchain : stable
44- - name : Install cargo-c and yara-x-capi
52+ - name : Cache Rust dependencies
53+ if : steps.yara-x-capi.outputs.cache-hit != 'true'
54+ uses : actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3
55+ with :
56+ path : |
57+ ~/.cargo/registry/
58+ ~/.cargo/git/
59+ key : rust-cargo-v1.12.0-${{ runner.os }}
60+ restore-keys : rust-cargo-
61+ - name : Build yara-x-capi
62+ if : steps.yara-x-capi.outputs.cache-hit != 'true'
4563 run : |
64+ command -v cargo-cinstall || cargo install cargo-c --locked
4665 cd ${{ github.workspace }}/yara-x
47- cargo install cargo-c --locked
48- sudo -E env "PATH=$PATH" cargo cinstall -p yara-x-capi --features=native-code-serialization --release
49- sudo ldconfig -v
50- cd ${{ github.workspace }}
51- sudo rm -rf ${{ github.workspace }}/yara-x
66+ cargo cinstall -p yara-x-capi --features=native-code-serialization --release --pkgconfigdir=${{ github.workspace }}/yara-x-install --includedir=${{ github.workspace }}/yara-x-install --libdir=${{ github.workspace }}/yara-x-install
67+ rm -rf ${{ github.workspace }}/yara-x
5268 - name : Set up Go
5369 uses : actions/setup-go@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5 # v6.2.0
5470 with :
5571 go-version-file : " go.mod"
5672 check-latest : true
57- cache : false
73+ cache : true
5874 - name : Initialize CodeQL
5975 uses : github/codeql-action/init@45cbd0c69e560cd9e7cd7f8c32362050c9b7ded2 # v4.32.2
6076 with :
@@ -63,12 +79,15 @@ jobs:
6379 - run : |
6480 go build -o /dev/null ./...
6581 go test -o /dev/null -c ./...
82+ env:
83+ PKG_CONFIG_PATH: ${{ github.workspace }}/yara-x-install
84+ LD_LIBRARY_PATH: ${{ github.workspace }}/yara-x-install
6685 - name : Perform CodeQL Analysis
6786 uses : github/codeql-action/analyze@45cbd0c69e560cd9e7cd7f8c32362050c9b7ded2 # v4.32.2
6887 with :
6988 category : " /language:go"
7089 analyze-actions :
71- if : ${{ github.repository }} == 'chainguard-dev/malcontent'
90+ if : ${{ github.repository == 'chainguard-dev/malcontent' }}
7291 runs-on : ubuntu-latest
7392 permissions :
7493 actions : read
0 commit comments