-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #47 from foss-for-synopsys-dwc-arc-processors/jing…
…ru-github-ci-flow [action] use github action to build arc_lab
- Loading branch information
Showing
19 changed files
with
295 additions
and
448 deletions.
There are no files selected for viewing
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
name: Build | ||
|
||
env: | ||
GIT_AUTHOR_NAME: svc-arcoss_auto arc | ||
GIT_COMMITTER_NAME: svc-arcoss_auto arc | ||
GIT_AUTHOR_EMAIL: [email protected] | ||
GIT_COMMITTER_EMAIL: [email protected] | ||
TOOLCHAIN: gnu | ||
TOOLCHAIN_VER: 2020.09 | ||
on: | ||
push: | ||
branches: | ||
- master | ||
- jingru-github-ci-flow | ||
|
||
jobs: | ||
example-build-on-iotdk: | ||
name: "Build arc_labs tests on iotdk" | ||
runs-on: ubuntu-latest | ||
env: | ||
BOARD: iotdk | ||
|
||
steps: | ||
- name: checkout | ||
uses: actions/checkout@v2 | ||
with: | ||
submodules: true | ||
- name: checkout-embarc_osp | ||
uses: actions/checkout@v2 | ||
with: | ||
repository: foss-for-synopsys-dwc-arc-processors/embarc_osp | ||
path: 'embarc_osp' | ||
ref: scripts-allow-insert-tests | ||
submodules: true | ||
|
||
- name: install-dependencies | ||
run: | | ||
bash ./embarc_osp/scripts/.ci/before_install.sh | ||
- name: build | ||
run: | | ||
bash .github/workflows/script.sh | ||
example-build-on-nsim: | ||
name: "Build arc_labs tests on nsim" | ||
runs-on: ubuntu-latest | ||
env: | ||
BOARD: nsim | ||
|
||
steps: | ||
- name: checkout | ||
uses: actions/checkout@v2 | ||
with: | ||
submodules: true | ||
- name: checkout-embarc_osp | ||
uses: actions/checkout@v2 | ||
with: | ||
repository: foss-for-synopsys-dwc-arc-processors/embarc_osp | ||
path: 'embarc_osp' | ||
ref: scripts-allow-insert-tests | ||
submodules: true | ||
|
||
- name: install-dependencies | ||
run: | | ||
bash ./embarc_osp/scripts/.ci/before_install.sh | ||
- name: build | ||
run: | | ||
bash .github/workflows/script.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
#!/bin/sh -eux | ||
|
||
readonly _DIR="$(readlink -e $(dirname $(readlink -e $0)))" | ||
|
||
die() { | ||
echo " *** ERROR: " $* | ||
exit 1 | ||
} | ||
|
||
prepare_env() { | ||
out_dir="${_DIR}/out" | ||
logs_dir="${_DIR}/logs" | ||
test_log="$logs_dir/test.log" | ||
|
||
mkdir -p $logs_dir $out_dir | ||
: >$test_log | ||
|
||
TOOLCHAIN_CACHE_FOLDER=".cache/toolchain" | ||
|
||
[ "${TRAVIS}" == "true" || "${GITHUB_ACTIONS}" == "true" ] && { | ||
if [ "${TOOLCHAIN}" == "gnu" ] ; then | ||
python scripts/.ci/toolchain.py -v $TOOLCHAIN_VER -c $TOOLCHAIN_CACHE_FOLDER || die | ||
if [ -d $TOOLCHAIN_CACHE_FOLDER ] ; then | ||
if [ -d $TOOLCHAIN_CACHE_FOLDER/$TOOLCHAIN_VER ] ; then | ||
ARC_DEV_TOOL_ROOT="${TOOLCHAIN_CACHE_FOLDER}/${TOOLCHAIN_VER}" | ||
fi | ||
fi | ||
else | ||
die "Toolchain ${TOOLCHAIN} not supported in travis ci" | ||
fi | ||
} | ||
|
||
if [ -d $ARC_DEV_TOOL_ROOT ] ; then | ||
REAL_ARC_DEV_ROOT=$(readlink -f ${ARC_DEV_TOOL_ROOT}) | ||
export ARC_GNU_ROOT=${REAL_ARC_DEV_ROOT} | ||
export PATH=${REAL_ARC_DEV_ROOT}/bin:${PATH} | ||
arc-elf32-gcc -v || die "ARC GNU toolchain is not installed correctly" | ||
else | ||
die "The toolchain path ${ARC_DEV_TOOL_ROOT} does not exist " | ||
fi | ||
git checkout -- . || die | ||
|
||
echo "Using ${TOOLCHAIN}-${TOOLCHAIN_VER}" || die | ||
. apply_embARC_patch.sh | ||
} | ||
|
||
run_test() { | ||
local target_flags="" | ||
if [[ ${BD_VER:-} ]]; then | ||
target_flags="$target_flags --platform-version $BD_VER" | ||
fi | ||
export PYTHONUNBUFFERED=1 | ||
{ | ||
hostname | ||
python ./scripts/test.py --platform $BOARD --testcase-root arc_labs/labs --toolchain $TOOLCHAIN $target_flags --build-only --report-dir $logs_dir -v -v || true | ||
} 2>&1 | tee -a $test_log | ||
} | ||
|
||
parse_logs() { | ||
# get rid of MAC \r and change it to UNIX \n | ||
sed -i 's/\r/\n/g' $test_log | ||
|
||
METRICS=$(cat $test_log | grep "test configurations passed" | sed -n 's/^.* \([0-9]\+\) of.*, \([0-9]\+\).*failed, \([0-9]\+\).*in \([0-9]\+\).*$/\1 \2 \3 \4/p') | ||
if ! ([ ${#METRICS[@]} -eq 4 ] && [ ${METRICS[1]} == "0" ]); then | ||
exit 1 | ||
fi | ||
} | ||
|
||
main() { | ||
mkdir embarc_osp/arc_labs | ||
cp -r labs embarc_osp/arc_labs | ||
pushd embarc_osp | ||
prepare_env | ||
run_test | ||
# parse_logs | ||
popd | ||
} | ||
|
||
main |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.