-
Notifications
You must be signed in to change notification settings - Fork 6
127 lines (104 loc) · 3.24 KB
/
continuous.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
# 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@v4
- name: Set up Python
uses: actions/setup-python@v5
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@v4
with:
repository: ge-high-assurance/RACK
path: RACK
- name: Download rack-box files from artifacts
uses: actions/download-artifact@v4
with:
name: rack-box-files
path: RACK/rack-box/files
- name: Set up Python
uses: actions/setup-python@v5
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' }}