Extract common API + comment #1083
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and Run Tests [gradle] | ||
on: | ||
push: | ||
branches: [ "main" ] | ||
pull_request: | ||
branches: [ "main" ] | ||
workflow_dispatch: | ||
jobs: | ||
build: | ||
strategy: | ||
matrix: | ||
java: [ '11' ] | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
with: | ||
submodules: "true" | ||
- name: Setup Java JDK | ||
uses: actions/[email protected] | ||
with: | ||
distribution: "zulu" | ||
java-version: ${{ matrix.java }} | ||
cache: "gradle" | ||
- name: Setup Gradle | ||
uses: gradle/gradle-build-action@v2 | ||
- name: Set up Node | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: '22' | ||
- name: Set up ArkAnalyzer | ||
run: | | ||
REPO_URL="https://gitee.com/Lipenx/arkanalyzer.git" | ||
DEST_DIR="arkanalyzer" | ||
MAX_RETRIES=10 | ||
RETRY_DELAY=3 # Delay between retries in seconds | ||
# Set the same as in jacodb/neo branch, since we get jacodb artifact from that branch. | ||
BRANCH="neo/2024-08-16" | ||
for ((i=1; i<=MAX_RETRIES; i++)); do | ||
git clone --depth=1 --branch $BRANCH $REPO_URL $DEST_DIR && break | ||
echo "Clone failed, retrying in $RETRY_DELAY seconds..." | ||
sleep "$RETRY_DELAY" | ||
done | ||
if [[ $i -gt $MAX_RETRIES ]]; then | ||
echo "Failed to clone the repository after $MAX_RETRIES attempts." | ||
exit 1 | ||
else | ||
echo "Repository cloned successfully." | ||
fi | ||
echo "ARKANALYZER_DIR=$(realpath $DEST_DIR)" >> $GITHUB_ENV | ||
cd $DEST_DIR | ||
npm install | ||
npm run build | ||
- name: Install CPython optional dependencies | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install -yq\ | ||
libssl-dev \ | ||
libffi-dev | ||
- name: Build and run tests | ||
run: | | ||
./gradlew build --no-daemon -PcpythonActivated=true | ||
- name: Run Detekt | ||
run: | | ||
./gradlew detektMain detektTest --no-daemon | ||
- name: Upload SARIF to GitHub | ||
uses: github/codeql-action/upload-sarif@v3 | ||
if: success() || failure() | ||
with: | ||
sarif_file: build/reports/detekt/detekt.sarif |