Skip to content

[pull] master from constellation-app:master #259

[pull] master from constellation-app:master

[pull] master from constellation-app:master #259

name: Build and Scan
on:
push:
branches:
- master
pull_request:
types: [opened, synchronize, reopened, labeled, unlabeled]
branches:
- master
jobs:
unit_tests:
name: Unit Tests
runs-on: ubuntu-latest
env:
RUNNER_IMAGE: "constellationapplication/netbeans-runner:21.0.2"
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
TRAVIS_REPO_SLUG: "${{ github.repository }}"
DESTINATION_BRANCH: "${{ github.base_ref }}"
PULL_REQUEST_NUMBER: "${{ github.event.number }}"
SOURCE_BRANCH: "${{ github.head_ref }}"
SONARCLOUD_URL: sonarcloud.io
steps:
# Checkout this commit
- name: Checkout Branch
uses: actions/checkout@v4
# Set the verbose flag as a variable
- name: Set Verbosity
run: |
if [[ ${{ contains(github.event.pull_request.labels.*.name, 'verbose-logging') }} = 'true' ]]; then echo '::set-output name=VERBOSITY::-v -verbose' && echo 'Verbose Logging Enabled'; else echo '::set-output name=VERBOSITY::-v " "' && echo 'Verbose Logging Disabled'; fi
id: verbosity
- name: Create Cache Folder
run: mkdir -p ${HOME}/.ivy2/cache
# Cache the ivy dependencies to the home directory.
- name: Initialise Cache
id: cache-dependencies
uses: actions/cache@v4
env:
cache-name: cache-dependencies
with:
path: ${HOME}/.ivy2/cache
key: ${{ runner.os }}-dependencies-${{ env.cache-name }}-${{ hashFiles('CoreDependencies/src/ivy.xml') }}
# Update the project dependencies and run tests
- name: Run Tests
run: |
chmod +x /home/runner/work/constellation/constellation/.githubutilities/run-tests.sh
docker pull "${RUNNER_IMAGE}"
docker run --mount "type=bind,source=/home/runner/work/constellation/constellation/,target=/home/runner/work/constellation/constellation/" --mount "type=bind,source=${HOME}/.ivy2/cache,target=/root/.ivy2/cache" --workdir /home/runner/work/constellation/constellation/ "${RUNNER_IMAGE}" .githubutilities/run-tests.sh ${{ steps.verbosity.outputs.VERBOSITY }}
- name: Run Sonar
run: |
chmod +x /home/runner/work/constellation/constellation/.githubutilities/sonar.sh
docker pull "${RUNNER_IMAGE}"
docker run --mount "type=bind,source=/home/runner/work/constellation/constellation/,target=/home/runner/work/constellation/constellation/" --mount "type=bind,source=${HOME}/.ivy2/cache,target=/root/.ivy2/cache" --workdir /home/runner/work/constellation/constellation/ "${RUNNER_IMAGE}" .githubutilities/sonar.sh "${GITHUB_REPOSITORY}" "${PULL_REQUEST_NUMBER}" "${DESTINATION_BRANCH}" "${SOURCE_BRANCH}" "${SONAR_TOKEN}"