Skip to content

support for policy_must_match (#30) #11

support for policy_must_match (#30)

support for policy_must_match (#30) #11

Workflow file for this run

name: CI
on:
pull_request:
push:
branches:
- 'main'
- 'release/*'
tags:
- '**'
jobs:
build-test:
runs-on: [ ubuntu-20.04 ]
env:
http_proxy: ${{ secrets.HTTP_PROXY }}
https_proxy: ${{ secrets.HTTPS_PROXY }}
no_proxy: ${{ secrets.NO_PROXY }}
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Setup Java JDK
uses: actions/setup-java@v4.0.0
with:
distribution: 'temurin'
java-version: '17'
- name: Install Maven manually
run: |
curl -LO https://archive.apache.org/dist/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.tar.gz
tar -xzf apache-maven-3.6.3-bin.tar.gz
- name: Update Maven proxy settings
run: |
# Fetch MAVEN_PROXY_HOST and MAVEN_PROXY_PORT from secrets.HTTP_PROXY
export HTTP_PROXY_VALUE=$(echo "${{ secrets.HTTP_PROXY }}" | sed 's|^http://||;s|^https://||')
export MAVEN_PROXY_HOST=$(echo $HTTP_PROXY_VALUE | cut -d':' -f1)
export MAVEN_PROXY_PORT=$(echo $HTTP_PROXY_VALUE | cut -d':' -f2 | sed 's/\///')
# Update Maven with the proxy settings
if [ -n "${MAVEN_PROXY_HOST}" -a -n "${MAVEN_PROXY_PORT}" ]; then \
mkdir -p ~/.m2 && \
echo "<settings><proxies><proxy><id>example-proxy</id><active>true</active><protocol>http</protocol><host>${MAVEN_PROXY_HOST}</host><port>${MAVEN_PROXY_PORT}</port></proxy></proxies></settings>" > ~/.m2/settings.xml; \
fi
- name: Unit Test Coverage
run: |
# Add maven binary location to PATH
export PATH="$PWD/apache-maven-3.6.3/bin:$PATH"
# Compile, build and install the package
# This also runs the unit tests internally
test=$(mvn -X -e clean compile install package)
if [ $? -ne 0 ]; then
echo "Build failed..."
exit 1
fi
# Fetch coverage for unit tests
COVERAGE=$(cd connector && \
awk -F, \
'{ instructions += $4 + $5; covered += $5 } END \
{ print covered, "/", instructions, " instructions covered"; \
print 100*covered/instructions, "% covered" }' \
target/site/jacoco/jacoco.csv)
result=$(echo "$COVERAGE" | grep -oE "[0-9]+\.[0-9]+")
echo "Unit test coverage for Client is - $result%"
if (( $(echo "$result < 80" | bc -l) )); then
echo "Unit test coverage must be above 80%"
exit 1
fi