CI #1156
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
# vim: expandtab tabstop=2 shiftwidth=2 | |
name: CI | |
on: | |
workflow_dispatch: | |
inputs: | |
unk: | |
push: | |
branches: [ master ] | |
pull_request: | |
branches: [ master ] | |
schedule: | |
# Daily | |
- cron: '0 8 * * *' | |
# Every 3 days | |
#- cron: '0 0 */3 * *' | |
env: | |
GRADLE_VERSION: 7.5.1 | |
JAVA_VERSION: '17' | |
jobs: | |
build: | |
name: 'Build Ghidra - ${{ matrix.platform.os }} - ${{ matrix.ghidra.version }}' | |
strategy: | |
fail-fast: false | |
matrix: | |
platform: | |
- os: 'ubuntu-latest' | |
dependency_script: "sudo apt-get update && sudo apt-get install -y bison flex" | |
- os: 'macos-latest' | |
dependency_script: "brew install bison flex curl" | |
- os: 'windows-latest' | |
dependency_script: | | |
choco install visualstudio2017buildtools | |
choco install winflexbison | |
ren "C:\ProgramData\chocolatey\bin\win_bison.exe" "bison.exe" | |
ren "C:\ProgramData\chocolatey\bin\win_flex.exe" "flex.exe" | |
ghidra: | |
- version: 'dev' | |
ref: 'master' | |
- version: 'stable' | |
ref: 'stable' | |
runs-on: "${{ matrix.platform.os }}" | |
steps: | |
- uses: actions/checkout@v2 | |
- name: 'Set up JDK' | |
uses: actions/setup-java@v1 | |
with: | |
java-version: ${{ env.JAVA_VERSION }} | |
java-package: 'jdk' | |
- name: "Install dependencies" | |
run: "${{ matrix.platform.dependency_script }}" | |
- name: "Clone Ghidra" | |
run: git clone -b "${{ matrix.ghidra.ref }}" "https://github.com/NationalSecurityAgency/ghidra.git" ghidra | |
#- name: "Apply patches" | |
# run: git apply ../patches/* | |
# working-directory: ./ghidra | |
- name: "Recent history" | |
run: git log --oneline -n 15 | |
working-directory: ./ghidra | |
#- name: Setup tmate session | |
# uses: mxschmitt/action-tmate@v3 | |
# Cache dependencies' downloading | |
- name: "Precreate download dir" | |
run: mkdir -p ghidra/dependencies/downloads | |
- name: "Restore Dependencies Cache" | |
uses: actions/cache@v2.1.5 | |
with: | |
# A list of files, directories, and wildcard patterns to cache and restore | |
path: ./ghidra/dependencies/downloads | |
# An explicit key for restoring and saving the cache | |
key: "${{ matrix.ghidra.version }}-${{ matrix.platform.os }}-ghdepends" | |
- name: "Fetch dependencies" | |
uses: eskatos/gradle-command-action@v1 | |
with: | |
build-root-directory: ghidra | |
gradle-version: ${{ env.GRADLE_VERSION }} | |
arguments: --console plain --quiet --init-script gradle/support/fetchDependencies.gradle init | |
- name: "Building Ghidra ${{ matrix.ghidra.version }} from ${{ matrix.ghidra.ref }}" | |
uses: eskatos/gradle-command-action@v1 | |
with: | |
build-root-directory: ghidra | |
gradle-version: ${{ env.GRADLE_VERSION }} | |
arguments: --console plain --quiet buildGhidra | |
- name: "Upload package" | |
uses: NyaMisty/upload-artifact@nightly | |
with: | |
name: "Ghidra_${{ matrix.ghidra.version }}_${{ matrix.platform.os }}" | |
path: "ghidra/build/dist/*.zip" | |
#- name: "Upload package" | |
# uses: NyaMisty/upload-artifact-as-is@nightly | |
# with: | |
# path: ghidra/build/dist/ | |
deploy: | |
name: 'Push to Release' | |
if: always() | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- run: mkdir dist | |
- name: Download built artifacts | |
uses: actions/download-artifact@master | |
with: | |
path: dist | |
- name: Rearrange artifacts | |
run: | | |
mkdir dist1 | |
find dist -type f -name "*" -exec sh -c 'mv "{}" "dist1/$( basename "$( dirname "{}" )" )_$( basename "{}" )"' \; | |
- name: Get current date | |
id: date | |
run: echo "::set-output name=date::$(date +'%Y-%m-%d')" | |
- name: Pushing to release | |
uses: ncipollo/release-action@v1 | |
with: | |
name: "GhidraNightlyBuild-${{ steps.date.outputs.date }}" | |
commit: ${{ github.sha }} | |
tag: "GhidraNightlyBuild-${{ steps.date.outputs.date }}" | |
artifacts: "dist1/*.zip" | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- uses: gautamkrishnar/keepalive-workflow@master # using the workflow with default settings |