Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improvements to GitHub Actions #1714

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
76 changes: 50 additions & 26 deletions .github/workflows/build-and-scan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
branches:
- master

pull_request:
types: [opened, synchronize, reopened, labeled, unlabeled]
branches:
Expand All @@ -12,50 +13,73 @@ on:
jobs:
unit_tests:
name: Unit Tests

runs-on: ubuntu-latest

env:
RUNNER_IMAGE: "constellationapplication/netbeans-runner:12.0.4"
RUNNER_IMAGE: constellationapplication/netbeans-runner:12.0.4
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
# Checkout this commit
- name: Checkout Branch
uses: actions/checkout@v1

# Set the verbose flag as a variable
uses: actions/checkout@v3
with:
repository: constellation-app/constellation
path: constellation
fetch-depth: 0

# Set the verbose flag as a variable
- name: Set Verbosity
id: 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
# Cache the ivy dependencies
- name: Restore Ivy Cache
id: cache-dependencies
uses: actions/cache@v2
env:
cache-name: cache-dependencies
uses: actions/cache@v3
with:
path: ${HOME}/.ivy2/cache
key: ${{ runner.os }}-dependencies-${{ env.cache-name }}-${{ hashFiles('CoreDependencies/src/ivy.xml') }}
path: ~/.ivy2
key: ${{ runner.os }}-ivy-${{ hashFiles('constellation/CoreDependencies/src/ivy.xml') }}

# Update the project dependencies and run tests
- name: Run Tests
- name: Create Ivy Cache
if: steps.cache-dependencies.outputs.cache-hit != 'true'
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 }}
mkdir ~/.ivy2

- name: Run Sonar
- name: Add Execute Privilege to Scripts
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}"
chmod +x constellation/.githubutilities/run-tests.sh
chmod +x constellation/.githubutilities/sonar.sh

- name: Run Tests
uses: addnab/docker-run-action@v3
with:
image: ${{ env.RUNNER_IMAGE }}
options: |
--mount type=bind,source=${{ github.workspace }},target=/code
--mount type=bind,source=/home/runner/.ivy2,target=/root/.ivy2
--workdir /code/constellation
run: |
.githubutilities/run-tests.sh ${{ steps.verbosity.outputs.VERBOSITY }}

- name: Run Sonar
uses: addnab/docker-run-action@v3
with:
image: ${{ env.RUNNER_IMAGE }}
options: |
--mount type=bind,source=${{ github.workspace }},target=/code
--workdir /code/constellation
run: |
.githubutilities/sonar.sh
"${GITHUB_REPOSITORY}"
"${PULL_REQUEST_NUMBER}"
"${DESTINATION_BRANCH}"
"${SOURCE_BRANCH}"
"${SONAR_TOKEN}"
6 changes: 4 additions & 2 deletions .github/workflows/documentation_update_trigger.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: GH Pages to Update Docs
name: GitHub Pages to Update Docs
# When documentation needs an update, a push to documentation_update branch will
# trigger this action to send a request to the constellation-app.github.io to
# update the online documentation.
Expand All @@ -14,9 +14,11 @@ on:

jobs:
trigger-doco-update:

runs-on: ubuntu-latest

steps:
- name: trigger repository event
- name: Trigger Repository Event
if: github.event.action != 'pong'
run: |
curl -X POST https://api.github.com/repos/constellation-app/constellation-app.github.io/dispatches \
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/greetings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ on: [pull_request, issues]

jobs:
greeting:

runs-on: ubuntu-latest

steps:
- uses: actions/first-interaction@v1
with:
Expand All @@ -27,4 +29,3 @@ jobs:
We are working on a new version so just bear that in mind.

**PS:** _I'm just an automated script, not a human being._

77 changes: 45 additions & 32 deletions .github/workflows/nightly-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,67 +6,80 @@ on:
- cron: '0 20 * * 1-5'
release:
types: [prereleased, released]

jobs:
create-nightly-build:

runs-on: ubuntu-latest

env:
RUNNER_IMAGE: "constellationapplication/netbeans-runner:12.0.4"
container:
image: docker://pandoc/latex:2.9
options: --entrypoint=bash
RUNNER_IMAGE: constellationapplication/netbeans-runner:12.0.4

steps:
- name: Update GH Actions Tools
run: |
apk update
apk upgrade
apk add --no-cache coreutils
apk add bash docker git
- name: Create Workspace Dir for operations
run: |
mkdir -p ./workspace
- name: Checkout Constellation repository
- name: Checkout Constellation Repository
uses: actions/checkout@v2
with:
repository: constellation-app/constellation
path: ./workspace/constellation
- name: Checkout Constellation Adaptors repository
path: constellation

- name: Checkout Constellation Adaptors Repository
uses: actions/checkout@v2
with:
repository: constellation-app/constellation-adaptors
path: ./workspace/constellation-adaptors
- name: Checkout Constellation Applications repository
path: constellation-adaptors

- name: Checkout Constellation Applications Repository
uses: actions/checkout@v2
with:
repository: constellation-app/constellation-applications
path: ./workspace/constellation-applications
- name: Add Execute Privilege to Scripts
path: constellation-applications

# Cache the ivy dependencies
- name: Restore Ivy Cache
id: cache-dependencies
uses: actions/cache@v3
with:
path: ~/.ivy2
key: ${{ runner.os }}-ivy-${{ hashFiles('constellation/CoreDependencies/src/ivy.xml') }}

- name: Create Ivy Cache
if: steps.cache-dependencies.outputs.cache-hit != 'true'
run: |
chmod +x ./workspace/constellation-applications/build-zip.sh
chmod +x ./workspace/constellation-applications/functions.sh
- name: Run build process within Docker container
mkdir ~/.ivy2

- name: Add Execute Privilege to Scripts
run: |
docker pull "${RUNNER_IMAGE}"
docker run -e GIT_DISCOVERY_ACROSS_FILESYSTEM=1 \
--mount "type=bind,source=/,target=/home/runner/work/constellation" \
--workdir /home/runner/work/constellation/home/runner/work/constellation/constellation/workspace/constellation-applications \
"${RUNNER_IMAGE}" \
chmod +x constellation-applications/build-zip.sh
chmod +x constellation-applications/functions.sh

- name: Build Zips
uses: addnab/docker-run-action@v3
with:
image: ${{ env.RUNNER_IMAGE }}
options: |
--volume ${{ github.workspace }}:/code
--volume /home/runner/.ivy2:/root/.ivy2
--workdir /code/constellation-applications
run: |
./build-zip.sh -a constellation -m "constellation constellation-adaptors"

- name: Upload Linux Build
uses: actions/[email protected]
with:
name: Linux Nightly Build
path: ./workspace/constellation-applications/constellation/dist/constellation-linux**
path: constellation-applications/constellation/dist/constellation-linux**
retention-days: 2

- name: Upload MacOS Build
uses: actions/[email protected]
with:
name: MacOSX Nightly Build
path: ./workspace/constellation-applications/constellation/dist/constellation-macosx**
path: constellation-applications/constellation/dist/constellation-macosx**
retention-days: 2

- name: Upload Windows Build
uses: actions/[email protected]
with:
name: Windows Nightly Build
path: ./workspace/constellation-applications/constellation/dist/constellation-win**.zip
path: constellation-applications/constellation/dist/constellation-win**.zip
retention-days: 2
76 changes: 45 additions & 31 deletions .github/workflows/release-build.yml
Original file line number Diff line number Diff line change
@@ -1,71 +1,85 @@
name: Create Release Build

on: workflow_dispatch

jobs:
create-release-build:

runs-on: ubuntu-latest

env:
RUNNER_IMAGE: "constellationapplication/netbeans-runner:12.0.4"
ADAPTORS_VERSION: "v2.8.0"
container:
image: docker://pandoc/latex:2.9
options: --entrypoint=bash
VERSION: "v2.8.0"
RUNNER_IMAGE: constellationapplication/netbeans-runner:12.0.4

steps:
- name: Update GH Actions Tools
run: |
apk update
apk upgrade
apk add --no-cache coreutils
apk add bash docker git sed
- name: Create Workspace Dir for operations
run: |
mkdir -p ./workspace
- name: Checkout Constellation repository
uses: actions/checkout@v2
with:
repository: constellation-app/constellation
path: ./workspace/constellation
path: constellation

- name: Checkout Constellation Adaptors repository
uses: actions/checkout@v2
with:
repository: constellation-app/constellation-adaptors
path: ./workspace/constellation-adaptors
path: constellation-adaptors

- name: Checkout Constellation Applications repository
uses: actions/checkout@v2
with:
repository: constellation-app/constellation-applications
path: ./workspace/constellation-applications
path: constellation-applications

- name: Update Version Number
run: |
sed -i "s/(under development)/$ADAPTORS_VERSION/" ./workspace/constellation/CoreFunctionality/src/au/gov/asd/tac/constellation/functionality/startup/Startup.java
- name: Add Execute Privilege to Scripts
sed -i "s/(under development)/$VERSION/" constellation/CoreFunctionality/src/au/gov/asd/tac/constellation/functionality/startup/Startup.java

# Cache the ivy dependencies
- name: Restore Ivy Cache
id: cache-dependencies
uses: actions/cache@v3
with:
path: ~/.ivy2
key: ${{ runner.os }}-ivy-${{ hashFiles('constellation/CoreDependencies/src/ivy.xml') }}

- name: Create Ivy Cache
if: steps.cache-dependencies.outputs.cache-hit != 'true'
run: |
chmod +x ./workspace/constellation-applications/build-zip.sh
chmod +x ./workspace/constellation-applications/functions.sh
- name: Run build process within Docker container
mkdir ~/.ivy2

- name: Add Execute Privilege to Scripts
run: |
docker pull "${RUNNER_IMAGE}"
docker run -e GIT_DISCOVERY_ACROSS_FILESYSTEM=1 \
--mount "type=bind,source=/,target=/home/runner/work/constellation" \
--workdir /home/runner/work/constellation/home/runner/work/constellation/constellation/workspace/constellation-applications \
constellationapplication/netbeans-runner:12 \
chmod +x constellation-applications/build-zip.sh
chmod +x constellation-applications/functions.sh

- name: Build Zips
uses: addnab/docker-run-action@v3
with:
image: ${{ env.RUNNER_IMAGE }}
options: |
--volume ${{ github.workspace }}:/code
--volume /home/runner/.ivy2:/root/.ivy2
--workdir /code/constellation-applications
run: |
./build-zip.sh -a constellation -m "constellation constellation-adaptors"

- name: Upload Linux Build
uses: actions/[email protected]
with:
name: Linux Release Build
path: ./workspace/constellation-applications/constellation/dist/constellation-linux**
path: constellation-applications/constellation/dist/constellation-linux**
retention-days: 2

- name: Upload MacOS Build
uses: actions/[email protected]
with:
name: MacOSX Release Build
path: ./workspace/constellation-applications/constellation/dist/constellation-macosx**
path: constellation-applications/constellation/dist/constellation-macosx**
retention-days: 2

- name: Upload Windows Build
uses: actions/[email protected]
with:
name: Windows Release Build
path: ./workspace/constellation-applications/constellation/dist/constellation-win**.zip
path: constellation-applications/constellation/dist/constellation-win**.zip
retention-days: 2
6 changes: 5 additions & 1 deletion .github/workflows/stale.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Mark stale issues and pull requests
name: Mark Stale Issues and Pull Requests

on:
schedule:
Expand All @@ -12,6 +12,7 @@ jobs:
- uses: actions/stale@v3
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}

stale-issue-message: >
This issue is stale because it has been open for 6 months with no activity.
Consider reviewing and taking an action on this issue.
Expand All @@ -21,6 +22,9 @@ jobs:
Consider reviewing and taking an action on this pull request.

stale-issue-label: 'no-issue-activity'

stale-pr-label: 'no-pr-activity'

days-before-stale: 180

days-before-close: -1
Loading