diff --git a/.github/workflows/community-build.yml b/.github/workflows/community-build.yml new file mode 100644 index 000000000..bfcacd3bc --- /dev/null +++ b/.github/workflows/community-build.yml @@ -0,0 +1,33 @@ +name: community-plugins-build + +on: + push: + paths: + - 'community/**' + pull_request: + paths: + - 'community/**' + +jobs: + build: + strategy: + matrix: + os: [ ubuntu-latest, macos-latest ] + java: [ 8, 11 ] + runs-on: ${{ matrix.os }} + name: 'Build Community plugins on ${{ matrix.os }} using Java ${{ matrix.java }}' + steps: + - name: 'Check out repository' + uses: actions/checkout@v2 + - name: 'Set up JDK ${{ matrix.java }}' + uses: actions/setup-java@v1 + with: + java-version: ${{ matrix.java }} + - name: 'Cache Gradle resources' + uses: actions/cache@v2 + with: + path: ~/.gradle/caches + key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }} + restore-keys: ${{ runner.os }}-gradle + - name: 'Build Community plugins' + run: ./community/build_all.sh diff --git a/community/README.md b/community/README.md new file mode 100644 index 000000000..c80a84e82 --- /dev/null +++ b/community/README.md @@ -0,0 +1,7 @@ +# Tsunami Plugins by Community Members + +This directory contains plugins contributed by community members. + +## Currently released plugins + +### Detectors diff --git a/community/build_all.sh b/community/build_all.sh new file mode 100755 index 000000000..a0bccaa4e --- /dev/null +++ b/community/build_all.sh @@ -0,0 +1,35 @@ +#!/bin/bash +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +set -eu + +SCRIPT_PATH="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )" +GENERATED_PLUGINS_PATH="${SCRIPT_PATH}/build/plugins" +mkdir -p "${GENERATED_PLUGINS_PATH}" + +# For each community plugin, build the jar file and copy it to build/plugins +# folder. +for plugin_dir in $(find "${SCRIPT_PATH}" -name 'gradlew' -print0 | xargs -0 -n1 dirname | sort -u); do + plugin_name="${plugin_dir##*"${SCRIPT_PATH}/"}" + printf "\nBuilding ${plugin_name}...\n" + + pushd "${plugin_dir}" >/dev/null + + ./gradlew build + cp ./build/libs/*.jar "${GENERATED_PLUGINS_PATH}" + + popd >/dev/null +done +