Update main.yml #6
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
name: Build and Lint | |
on: | |
push: | |
branches: | |
- main | |
- master | |
pull_request: | |
branches: | |
- main | |
- master | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
container: | |
image: nscscc:2019.2 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up LoongArch toolchain | |
run: | | |
export PATH=/opt/loongarch32r-linux-gnusf-2022-05-20/bin:${PATH} | |
- name: Build asm | |
run: make -C asm | |
- name: Run linter | |
run: python3 ./.ci-scripts/run-linter.py project/thinpad_top.xpr 2>linter.log | |
- name: Check diff and generate bitstream if needed | |
run: | | |
str="project/thinpad_top.srcs" | |
diff="" | |
git config --global --add safe.directory $(pwd) | |
if [ "${{ github.event.before }}" == "0000000000000000000000000000000000000000" ]; then | |
vivado -mode tcl -source .ci-scripts/bits.tcl project/thinpad_top.xpr | |
else | |
diff=$(git diff --name-only ${{ github.event.before }} ${{ github.sha }}) | |
fi | |
echo $diff | |
if [[ $diff =~ $str ]]; then | |
vivado -mode tcl -source .ci-scripts/bits.tcl project/thinpad_top.xpr | |
fi | |
- name: Verify bitstream | |
run: | | |
test -f project/thinpad_top.runs/impl_1/*.bit || vivado -mode tcl -source .ci-scripts/bits.tcl project/thinpad_top.xpr | |
test -f project/thinpad_top.runs/impl_1/*.bit | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: bitstream-files | |
path: | | |
asm/*.bin | |
project/thinpad_top.runs/impl_1/*.bit | |
project/thinpad_top.runs/*/runme.log | |
linter.log |