-
Notifications
You must be signed in to change notification settings - Fork 0
/
ingen_kickoff.sh
executable file
·180 lines (129 loc) · 5.82 KB
/
ingen_kickoff.sh
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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
#!/bin/bash
##########################################################################################
# Quicklogic Symbiflow Package Installer Generator (InGen)
#
# Automated system to check for updates to all (relevant) components in the
# Quicklogic Symbiflow Package and generate an installer
#
# prerequisites to be installed:
# wget
# git
#
# inputs:
# ingen_package_spec.yml (package specification yaml file)
# outputs:
# ql_symbiflow_package_installer_%DATE%.gz.run
#
# README.md has detailed desciption of the ingen workflow.
##########################################################################################
# export the env variables that we want all the other scripts to use
# note that this won't work with scripts in the PATH, but that is not what we are going for, right?
export INGEN_ROOT_DIR=$(cd `dirname $0` && pwd)
export INGEN_SCRIPTS_DIR="$INGEN_ROOT_DIR"
export CURRENT_DATE=$(date +%d_%b_%Y)
export CURRENT_TIME=$(date +"%H_%M_%S")
# path to generate the Symbiflow Package Installer
export INGEN_SYMBIFLOW_INSTALLER_ARCHIVE_NAME="symbiflow_dailybuild_$CURRENT_DATE.gz.run"
export INGEN_SYMBIFLOW_INSTALLER_ARCHIVE="${INGEN_ROOT_DIR}/${INGEN_SYMBIFLOW_INSTALLER_ARCHIVE_NAME}"
export INGEN_PACKAGE_UPDATES_YAML="${INGEN_ROOT_DIR}/ingen_package_updates.yml"
export INGEN_PACKAGE_CURRENT_YAML="${INGEN_ROOT_DIR}/ingen_package_current.yml"
# publish path to keep final Symbiflow Package Installer after sanity
export INGEN_SYMBIFLOW_INSTALLER_ARCHIVE_PUBLISH_PATH="${INGEN_ROOT_DIR}/installers/dailybuild/symbiflow_dailybuild_$CURRENT_DATE.gz.run"
# testing area to use for Symbiflow Package Installation (using the installer)
INGEN_SYMBIFLOW_TESTING__INSTALL_DIR="${INGEN_ROOT_DIR}/symbiflow_install_dir"
# location of 'sanity' tests
INGEN_SYMBIFLOW_TESTING__TESTS_DIR="${INGEN_ROOT_DIR}/tests"
echo
echo "[>> INGEN : Quicklogic Symbiflow Package Installer Generator <<]"
echo
echo
echo "[>> INGEN <<] kickoff: ${CURRENT_DATE} ${CURRENT_TIME} HRS"
echo
# sanity check if we have already run the the ingen process today:
if [ -f "$INGEN_SYMBIFLOW_INSTALLER_ARCHIVE_PUBLISH_PATH" ] ; then
echo
echo "[>> INGEN <<] package installer already exists:"
echo " $INGEN_SYMBIFLOW_INSTALLER_ARCHIVE_PUBLISH_PATH"
echo " the ingen process has already run for this date, nothing to do."
echo
exit 0
fi
##########################################################################################
# PART A : Check for package updates, and generate a new Symbiflow Package Installer
##########################################################################################
echo
echo "[>> INGEN <<] generate package installer ... STARTED!"
echo
bash "${INGEN_ROOT_DIR}/ingen_generate_package_installer.sh"
INGEN_GENERATE_PACKAGE_INSTALLER_STATUS=$?
if [ $INGEN_GENERATE_PACKAGE_INSTALLER_STATUS == 0 ] ; then
echo
echo "[>> INGEN <<] generate package installer [OK]"
elif [ $INGEN_GENERATE_PACKAGE_INSTALLER_STATUS == 2 ] ; then
echo
echo "[>> INGEN <<] no new updates available, no need to generate package installer [OK]"
exit 0
else
echo
echo "[>> INGEN <<] generate package installer [FAILED!]"
exit 1
fi
##########################################################################################
# PART B : Use the Symbiflow Package Installer and run 'sanity' tests
##########################################################################################
# NOTE:The installation and tests of the package installer should be done in a new
# bash shell context, so it does not have stuff in the current shell by ingen!
echo
echo "[>> INGEN <<] test package installer ... STARTED!"
echo
bash "${INGEN_ROOT_DIR}/ingen_test_package_installer.sh" "$INGEN_SYMBIFLOW_INSTALLER_ARCHIVE" \
"$INGEN_SYMBIFLOW_TESTING__INSTALL_DIR" \
"$INGEN_SYMBIFLOW_TESTING__TESTS_DIR"
INGEN_TEST_PACKAGE_INSTALLER_STATUS=$?
if [ $INGEN_TEST_PACKAGE_INSTALLER_STATUS == 0 ] ; then
echo
echo "[>> INGEN <<] test package installer ... [OK]"
echo
else
echo
echo "[>> INGEN <<] test package installer ... [FAILED!]"
echo
exit 1
fi
# once tests ok, move the installer package into the release dir: installers/dailybuild
echo
echo "[>> INGEN <<] move final package installer :"
echo
mv -v "$INGEN_SYMBIFLOW_INSTALLER_ARCHIVE" "$INGEN_SYMBIFLOW_INSTALLER_ARCHIVE_PUBLISH_PATH"
# the updates yaml becomes the new current yaml
echo
echo "[>> INGEN <<] update the corresponding final 'package current yaml' :"
echo
rm "$INGEN_PACKAGE_CURRENT_YAML"
mv -v "$INGEN_PACKAGE_UPDATES_YAML" "$INGEN_PACKAGE_CURRENT_YAML"
# the changelog txt is removed (leave it, as it is 'git'ignored)
##########################################################################################
# PART C : Publish the Symbiflow Package Installer
##########################################################################################
echo
echo "[>> INGEN <<] publish package installer ... STARTED!"
echo
bash "${INGEN_ROOT_DIR}/ingen_publish_package_installer.sh" "github-actions"
INGEN_PUBLISH_PACKAGE_INSTALLER_STATUS=$?
if [ $INGEN_PUBLISH_PACKAGE_INSTALLER_STATUS == 0 ] ; then
echo
echo "[>> INGEN <<] publish package installer ... [OK]"
echo
else
echo
echo "[>> INGEN <<] publish package installer ... [FAILED!]"
echo
exit 1
fi
##########################################################################################
# PART D : Run the full CI tests with the Symbiflow Package Installer
##########################################################################################
# TODO
# invoke regression script to execute device testing.
# this involves firing off the tests in a different repo and use the latest installer
# this infra needs a bit of changes before it can be integrated here.