-
Notifications
You must be signed in to change notification settings - Fork 113
Automate prebuilt executable updates via GitHub Actions #474
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 8 commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
7aebf4e
Add testbenches
vacantron 8cc9bbf
Fix missing header of "spirograph"
vacantron 0f1ad98
Add benchmark scripts
vacantron f8e2422
Trim executables
vacantron 69dc153
Add GitHub workflow for building executables
vacantron 8a1b74a
Update document for prebuilt executables
vacantron 039574b
Update top-level Makefile
vacantron 2786803
Use wget instead of curl
vacantron 0fd7b4e
Update CI and toolchain installation
vacantron ef4daea
Update submodules
vacantron 56731b3
Fix GDB script
vacantron 7d198e3
Recover "uaes"
vacantron 065006c
Rename makefile target
vacantron 1b7f3ef
Update submodule
vacantron adfde19
Replace "curl" with pre-installed "wget"
vacantron a1353d2
Update dependencies of arch-test
vacantron 51de954
Recover "hello"
vacantron 80d3dc3
Refine document
vacantron 709d6e3
Fix indent
vacantron 2746418
Add "ieeelib" and ENABLE_PREBUILT option
vacantron b940fd2
Keep naming convention
vacantron 200f34c
Miscellaneous changes
vacantron be0ca6c
Update grep command
vacantron 1a83bdb
Fix typo
vacantron 262513e
Miscellaneous changes
vacantron File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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,61 @@ | ||
name: Build testbenches | ||
vacantron marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
workflow_dispatch: | ||
|
||
env: | ||
CROSS_CC_PREFIX: riscv-none-elf- | ||
vacantron marked this conversation as resolved.
Show resolved
Hide resolved
|
||
CROSS_CC_URL: https://github.com/xpack-dev-tools/riscv-none-elf-gcc-xpack/releases/download/v14.2.0-1/xpack-riscv-none-elf-gcc-14.2.0-1-linux-x64.tar.gz | ||
vacantron marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
jobs: | ||
build-testbenches: | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- name: Install essential packages | ||
run: | | ||
sudo apt-get update -q -y | ||
sudo apt-get upgrade -q -y | ||
sudo apt-get install -q -y gcc-multilib g++-multilib | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
with: | ||
submodules: 'true' | ||
- name: Test changed files | ||
id: file-changed | ||
uses: tj-actions/changed-files@v44 | ||
with: | ||
fetch_additional_submodule_history: 'true' | ||
files: | | ||
tests/ansibench/* | ||
tests/rv8-bench/* | ||
tests/*.c | ||
- name: Fetch xPack RISC-V GNU toolchain | ||
if: ${{ steps.file-changed.outputs.any_changed == 'true' || github.event_name == 'workflow_dispatch' }} | ||
run: | | ||
mkdir -p /opt/riscv-gnu-toolchain | ||
wget -O - $CROSS_CC_URL | tar -zxf - --strip-components=1 -C /opt/riscv-gnu-toolchain | ||
echo "/opt/riscv-gnu-toolchain/bin" >> $GITHUB_PATH | ||
echo "CROSS_CC=/opt/riscv-gnu-toolchain/bin/$CROSS_CC_PREFIX""gcc" >> $GITHUB_ENV | ||
- name: Build RISC-V executables | ||
if: ${{ steps.file-changed.outputs.any_changed == 'true' || github.event_name == 'workflow_dispatch' }} | ||
run: | | ||
CROSS_CC=$CROSS_CC USE_PREBUILT=0 make build-testbenches | ||
- name: Create tarballs | ||
if: ${{ steps.file-changed.outputs.any_changed == 'true' || github.event_name == 'workflow_dispatch' }} | ||
run: | | ||
tar -zcf rv32emu-prebuilt.tar.gz -C build bin | ||
vacantron marked this conversation as resolved.
Show resolved
Hide resolved
|
||
- name: Create GitHub Release | ||
if: ${{ steps.file-changed.outputs.any_changed == 'true' || github.event_name == 'workflow_dispatch' }} | ||
env: | ||
GH_TOKEN: ${{ secrets.RV32EMU_PREBUILT_TOKEN }} | ||
run: | | ||
RELEASE_TAG=$(date +'%Y.%m.%d') | ||
gh release create $RELEASE_TAG \ | ||
--repo sysprog21/rv32emu-prebuilt \ | ||
--title "$RELEASE_TAG""-nightly" | ||
gh release upload $RELEASE_TAG \ | ||
rv32emu-prebuilt.tar.gz \ | ||
--repo sysprog21/rv32emu-prebuilt |
This file contains hidden or 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 |
---|---|---|
|
@@ -16,6 +16,7 @@ build/softfloat | |
build/cache/ | ||
build/map/ | ||
build/path/ | ||
build/bin/ | ||
*.o | ||
*.o.d | ||
tests/**/*.elf | ||
|
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains hidden or 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,60 @@ | ||
USE_PREBUILT ?= 1 | ||
|
||
CC ?= gcc | ||
CROSS_CC ?= riscv-none-elf-gcc | ||
vacantron marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
BINDIR := $(abspath $(OUT))/bin | ||
|
||
TEST_SUITES += \ | ||
ansibench \ | ||
rv8-bench | ||
|
||
# "ieee754" needs F extension | ||
# "smolnes", "ticks" have inline assembly and only work in riscv | ||
TESTBENCHES += \ | ||
captcha \ | ||
donut \ | ||
fcalc \ | ||
hamilton \ | ||
$(ieee754) \ | ||
jit \ | ||
lena \ | ||
line \ | ||
maj2random \ | ||
mandelbrot \ | ||
nqueens \ | ||
nyancat \ | ||
pi \ | ||
puzzle \ | ||
qrcode \ | ||
richards \ | ||
rvsim \ | ||
$(smolnes) \ | ||
spirograph \ | ||
$(ticks) | ||
|
||
ifeq ($(USE_PREBUILT),1) | ||
LATEST_RELEASE := $(shell wget -qO - https://api.github.com/repos/sysprog21/rv32emu-prebuilt/releases/latest | grep -Po '(?<="tag_name": ").+(?=",)') | ||
endif | ||
|
||
.PHONY: build-testbenches benchmark | ||
|
||
# TODO: generate results automatically | ||
benchmark: build-testbenches | ||
|
||
build-testbenches: | ||
ifeq ($(USE_PREBUILT),1) | ||
@echo "Fetching prebuilt executables in \"rv32emu-prebuilt\"..." | ||
@wget -O - https://github.com/sysprog21/rv32emu-prebuilt/releases/download/$(LATEST_RELEASE)/rv32emu-prebuilt.tar.gz | tar zx -C build | ||
vacantron marked this conversation as resolved.
Show resolved
Hide resolved
|
||
else | ||
@$(foreach tb,$(TEST_SUITES), \ | ||
git submodule update --init ./tests/$(tb) &&) true | ||
@$(foreach tb,$(TEST_SUITES), \ | ||
CC=$(CC) CROSS_CC=$(CROSS_CC) BINDIR=$(BINDIR) \ | ||
$(MAKE) -C ./tests/$(tb) all &&) true | ||
@$(foreach tb,$(TESTBENCHES), \ | ||
$(CC) -m32 -O2 -Wno-unused-result -o $(BINDIR)/x86_64/$(tb) tests/$(tb).c -lm &&) true | ||
@$(foreach tb,$(TESTBENCHES), \ | ||
$(CROSS_CC) -march=rv32im -mabi=ilp32 -O2 -Wno-unused-result -Wno-implicit-function-declaration \ | ||
-o $(BINDIR)/riscv32/$(tb) tests/$(tb).c -lm -lsemihost &&) true | ||
endif |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.