Skip to content

Commit

Permalink
Merge branch 'master' of github.com:ge-high-assurance/RACK
Browse files Browse the repository at this point in the history
  • Loading branch information
kityansiu committed Dec 13, 2022
2 parents ecc4b27 + 93c82cd commit 096749f
Show file tree
Hide file tree
Showing 99 changed files with 2,355 additions and 921 deletions.
14 changes: 14 additions & 0 deletions .github/dependabot.yml
@@ -0,0 +1,14 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:

# Maintain dependencies for GitHub Actions
- package-ecosystem: "github-actions"
# Location of .github/workflows
directory: "/"
schedule:
interval: "daily"
@@ -1,43 +1,91 @@
# Download action:
# - Downloads rack-box files
# - Packages rack-box files
# Assembles files for rack-box builds (reusable workflow)

name: 'Download rack-box files'
description: 'Download files into rack-box/files'
on:
workflow_call:

# Assumes the following actions have already been called:
# - Check out RACK source
# - Check out RACK wiki
# - Set up Python
# - Cache Python dependencies
jobs:

# These actions can't be moved here because a composite action can
# hold only run steps, not calls to other actions.
# cache-files job:
# - Asks cache for rack-box files

runs:
using: 'composite'
cache-files:
runs-on: ubuntu-20.04
outputs:
cache-hit: ${{ steps.cache.outputs.cache-hit }}

steps:
- name: Start rack-box container asynchronously
steps:
- name: Ask cache for rack-box files
uses: actions/cache@v3
id: cache
with:
path: RACK/rack-box/files
key: files-${{ github.sha }}

# download-files job:
# - Downloads files for rack-box builds
# - Packages files for rack-box builds

download-files:
needs: cache-files
runs-on: ubuntu-20.04
if: needs.cache-files.outputs.cache-hit == false

steps:
- name: Start rack-box container (needed for CDR files)
shell: bash
run: |
docker pull gehighassurance/rack-box:dev
docker run --rm --detach -p 80:80 -p 12050-12092:12050-12092 -p 3030:3030 gehighassurance/rack-box:dev
- name: Download Fuseki release
docker run --rm --detach -p 3030:3030 -p 12050-12091:12050-12091 gehighassurance/rack-box:dev
- name: Check out RACK source
uses: actions/checkout@v3
with:
repository: ge-high-assurance/RACK
path: RACK

- name: Check out RACK wiki
uses: actions/checkout@v3
with:
repository: ge-high-assurance/RACK.wiki
path: RACK.wiki

- name: Prepare to cache rack-box files
uses: actions/cache@v3
id: cache
with:
path: RACK/rack-box/files
key: files-${{ github.sha }}

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.8

- name: Cache Python dependencies
uses: actions/cache@v3
with:
# This path is specific to Ubuntu
path: ~/.cache/pip
# Look to see if there is a cache hit for the corresponding requirements file
key: ${{ runner.os }}-pip-${{ hashFiles('RACK/cli/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
${{ runner.os }}-
- name: Download Fuseki
shell: bash
run: |
curl -LSfs https://archive.apache.org/dist/jena/binaries/apache-jena-fuseki-4.6.1.tar.gz -o RACK/rack-box/files/fuseki.tar.gz
- name: Download Apache Jena libraries
- name: Download Apache Jena
shell: bash
run: |
curl -LSfs https://archive.apache.org/dist/jena/binaries/apache-jena-4.6.1.tar.gz -o RACK/rack-box/files/jena.tar.gz
- name: Download SemTK release
- name: Download SemTK
shell: bash
run: |
curl -LSfs https://github.com/ge-semtk/semtk/releases/download/v2.5.0-20221108/semtk-opensource-v2.5.0-20221108-dist.tar.gz -o RACK/rack-box/files/semtk.tar.gz
curl -LSfs https://github.com/ge-semtk/semtk/releases/download/v2.5.0-20221212/semtk-opensource-v2.5.0-20221212-dist.tar.gz -o RACK/rack-box/files/semtk.tar.gz
- name: Download CSS stylesheet
shell: bash
Expand All @@ -49,7 +97,7 @@ runs:
run: |
curl -LSfs https://github.com/gdraheim/docker-systemctl-replacement/raw/v1.5.4505/files/docker/systemctl3.py -o RACK/rack-box/files/systemctl3.py
- name: Generate OWL files
- name: Build OWL files using sadl-eclipse
shell: bash
run: |
RACK/cli/setup-owl.sh -b
Expand Down Expand Up @@ -97,8 +145,8 @@ runs:
run: |
tar cfz RACK/rack-box/files/rack.tar.gz --exclude=.git --exclude=.github --exclude=assist --exclude=cli --exclude=rack-box --exclude=rack-ui --exclude=tests --exclude=tools RACK
- name: Always stop rack-box container
- name: Stop rack-box container
if: ${{ always() }}
shell: bash
run: |
docker container stop $(docker container ps --filter ancestor=gehighassurance/rack-box:dev -q)
docker container stop $(docker container ls -qf ancestor=gehighassurance/rack-box:dev)
67 changes: 67 additions & 0 deletions .github/workflows/build-docker-image.yml
@@ -0,0 +1,67 @@
# Builds rack-box docker image (reusable workflow)

on:
workflow_call:
inputs:
push:
required: false
default: true
type: boolean
version:
required: false
default: 'dev'
type: string

jobs:

# build-docker-image job:
# - Builds rack-box docker image
# - Pushes docker image to Docker Hub

build-docker-image:
runs-on: ubuntu-20.04

steps:
- name: Check out RACK source
uses: actions/checkout@v3
with:
repository: ge-high-assurance/RACK
path: RACK

- name: Ask cache for rack-box files
uses: actions/cache@v3
id: cache
with:
path: RACK/rack-box/files
key: files-${{ github.sha }}

- name: We don't have rack-box files?
if: steps.cache.outputs.cache-hit == false
run: |
echo "::error rack-box files are missing"
exit 1
- name: Build rack-box docker image
run: |
cd RACK/rack-box
packer build -var version=${{ inputs.version }} rack-box-docker.json
- name: Login to Docker Hub
if: inputs.push == true
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Push rack-box docker image to Docker Hub
if: inputs.push == true
run: docker push gehighassurance/rack-box:${{ inputs.version }}

- name: Update description of rack-box docker image
if: inputs.push == true
uses: peter-evans/dockerhub-description@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
repository: gehighassurance/rack-box
readme-filepath: RACK/rack-box/Docker-Hub-README.md
79 changes: 79 additions & 0 deletions .github/workflows/build-virtual-machine.yml
@@ -0,0 +1,79 @@
# Builds rack-box virtual machine (reusable workflow)

on:
workflow_call:
inputs:
version:
required: false
default: 'dev'
type: string

jobs:

# build-virtual-machine job:
# - Builds rack-box virtual machine
# - Uploads virtual machine to workflow or release

build-virtual-machine:
runs-on: macos-12

steps:
- name: Check out RACK source
uses: actions/checkout@v3
with:
repository: ge-high-assurance/RACK
path: RACK

- name: Ask cache for rack-box files
uses: actions/cache@v3
id: cache
with:
path: RACK/rack-box/files
key: files-${{ github.sha }}

- name: We don't have rack-box files?
if: steps.cache.outputs.cache-hit == false
run: |
echo "::error rack-box files are missing"
exit 1
- name: Download base box for virtual machine
run: |
curl -LOSfs https://app.vagrantup.com/ubuntu/boxes/focal64/versions/20221115.1.0/providers/virtualbox.box
mkdir -p RACK/rack-box/focal64
tar -xf virtualbox.box -C RACK/rack-box/focal64
rm -f virtualbox.box
- name: Build rack-box virtual machine
run: |
cd RACK/rack-box
packer build -var headless=true -var version=${{ inputs.version }} rack-box-virtualbox.json
- name: Split rack-box virtual machine
run: |
cd RACK/rack-box
mv output-virtualbox-ovf rack-box-${{ inputs.version }}
zip -r rack-box-${{ inputs.version }}.zip rack-box-${{ inputs.version }}
split -b 1500m rack-box-${{ inputs.version }}.zip rack-box-${{ inputs.version }}.zip
rm rack-box-${{ inputs.version }}.zip
- name: Upload split virtual machine to workflow
uses: actions/upload-artifact@v3
if: github.event_name != 'release'
with:
name: rack-box-${{ inputs.version }}
path: |
RACK/rack-box/GitHub-Release-README.md
RACK/rack-box/rack-box-${{ inputs.version }}.zip*
# softprops/action-gh-release has many issues and PRs filed
# against it; replace it with "gh release upload" if CI fails
# run: gh release upload ${{ github.event.release.tag_name }} RACK/rack-box/GitHub-Release-README.md RACK/rack-box/rack-box-${{ inputs.version }}.zip* --clobber

- name: Upload split virtual machine to release
uses: softprops/action-gh-release@v1
if: github.event_name == 'release'
with:
files: |
RACK/rack-box/GitHub-Release-README.md
RACK/rack-box/rack-box-${{ inputs.version }}.zip*

0 comments on commit 096749f

Please sign in to comment.