mirror of
https://github.com/github/codeql.git
synced 2025-12-24 12:46:34 +01:00
77 lines
2.6 KiB
YAML
77 lines
2.6 KiB
YAML
name: Diff generated Models as Data
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
workflow_dispatch:
|
|
inputs:
|
|
projects:
|
|
description: "The projects to generate models for"
|
|
required: true
|
|
default: '["netty/netty"]'
|
|
pull_request:
|
|
branches:
|
|
- main
|
|
paths:
|
|
- "java/ql/src/utils/model-generator/**/*.*"
|
|
|
|
jobs:
|
|
model-diff:
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
matrix:
|
|
# large
|
|
# ["google/guava", "spring-projects/spring-framework", "apache/poi"]
|
|
# others
|
|
# ["FasterXML/jackson-core", "FasterXML/jackson-databind", "google/gson", "JodaOrg/joda-time"
|
|
slugs: ${{fromJson(github.event.inputs.projects || '["apache/commons-codec", "apache/commons-io", "apache/commons-beanutils", "apache/commons-logging", "apache/commons-fileupload", "apache/commons-lang", "apache/commons-validator", "apache/commons-csv", "apache/dubbo"]' )}}
|
|
steps:
|
|
- name: Clone self (github/codeql) for baseline
|
|
uses: actions/checkout@v2
|
|
with:
|
|
path: codeql-baseline
|
|
ref: ${{ github.base_ref }}
|
|
- name: Clone self (github/codeql) with new generator
|
|
uses: actions/checkout@v2
|
|
with:
|
|
path: codeql-head
|
|
ref: ${{ github.ref }}
|
|
- uses: ./codeql-baseline/.github/actions/fetch-codeql
|
|
- name: Download database
|
|
env:
|
|
SLUG: ${{ matrix.slugs }}
|
|
run: |
|
|
set -x
|
|
mkdir lib-dbs
|
|
SHORTNAME=${SLUG//[^a-zA-Z0-9_]/}
|
|
projectId=`curl -s https://lgtm.com/api/v1.0/projects/g/$SLUG | jq .id`
|
|
curl -L "https://lgtm.com/api/v1.0/snapshots/$projectId/java" -o $SHORTNAME.zip
|
|
unzip -q -d $SHORTNAME-db $SHORTNAME.zip
|
|
mkdir lib-dbs/$SHORTNAME/
|
|
mv $SHORTNAME-db/`ls -1 $SHORTNAME-db`/* lib-dbs/$SHORTNAME/
|
|
- name: Generate Models (Baseline and HEAD)
|
|
run: |
|
|
set -x
|
|
mkdir tmp-models
|
|
MODELS=`pwd`/tmp-models
|
|
MODE="baseline"
|
|
DATABASES=`pwd`/lib-dbs
|
|
|
|
analyzeDatabaseWithCheckout() {
|
|
QL_VARIANT=$1
|
|
DATABASE=$2
|
|
cd codeql-$QL_VARIANT
|
|
SHORTNAME=`basename $DATABASE`
|
|
python java/ql/src/utils/model-generator/GenerateFlowModel.py $DATABASE $MODELS/${SHORTNAME}.qll
|
|
mv $MODELS/${SHORTNAME}.qll $MODELS/${SHORTNAME}_${QL_VARIANT}.qll
|
|
cd ..
|
|
}
|
|
|
|
for d in $DATABASES/*/ ; do
|
|
ls -1 "$d"
|
|
|
|
analyzeDatabaseWithCheckout "baseline" $d
|
|
analyzeDatabaseWithCheckout "head" $d
|
|
done
|