Skip to content

Modernize the RACK cli packaging (#993) #2210

Modernize the RACK cli packaging (#993)

Modernize the RACK cli packaging (#993) #2210

Workflow file for this run

# Runs after every push (except tag-only pushes)
name: RACK Continuous Integration Workflow
on:
push:
branches: [ '*' ]
tags-ignore: [ '*' ]
jobs:
# lint job:
# - Lints RACK CLI, RACK Ontology, and shell scripts
lint:
runs-on: ubuntu-22.04
steps:
- name: Check out RACK source
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- 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('cli/pyproject.toml') }}
restore-keys: |
${{ runner.os }}-pip-
${{ runner.os }}-
- name: Install RACK CLI development dependencies
run: |
pip3 install "cli/[dev]"
- name: Lint RACK CLI
run: |
cd cli
pylint rack
mypy rack
- name: Lint RACK Ontology
run: |
sudo apt-get install -qq --yes swi-prolog
./assist/bin/check
- name: Lint shell scripts
uses: ludeeus/[email protected]
env:
SHELLCHECK_OPTS: -x -P assist/databin -e SC1008
# assemble-files job:
# - Assembles files for rack-box builds
assemble-files:
uses: ./.github/workflows/assemble-files.yml
# test job:
# - Downloads rack-box files from artifacts
# - Installs rack-box on runner
# - Runs rack-box tests
test:
needs: assemble-files
runs-on: ubuntu-22.04
steps:
- name: Check out RACK source
uses: actions/checkout@v3
with:
repository: ge-high-assurance/RACK
path: RACK
- name: Download rack-box files from artifacts
uses: actions/download-artifact@v3
with:
name: rack-box-files
path: RACK/rack-box/files
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- 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/tests/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
${{ runner.os }}-
- name: Install rack-box on runner
run: |
mkdir -p /tmp/files
for f in RACK/rack-box/files/*; do
ln -s $(realpath $f) /tmp/files/$(basename $f)
done
python3 -m pip install --upgrade pip setuptools wheel
sudo bash RACK/rack-box/scripts/install.sh $USER
- name: Run rack-box tests
run: |
cd RACK
pip3 install cli/
pip3 install -r tests/requirements.txt
python3 -m pytest tests
# build-docker-image job:
# - Builds rack-box docker image
# - Pushes docker image to Docker Hub
build-docker-image:
needs: assemble-files
uses: ./.github/workflows/build-docker-image.yml
secrets: inherit
with:
push: ${{ github.ref == 'refs/heads/master' || github.ref == 'refs/heads/dev-test' }}
version: ${{ (github.ref == 'refs/heads/master' && 'dev') || 'dev-test' }}