-
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 all 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
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,87 @@ | ||
name: Build artifact | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
workflow_dispatch: | ||
|
||
jobs: | ||
detect-file-change: | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
with: | ||
submodules: 'true' | ||
- name: Test file change | ||
id: test-file-change | ||
uses: tj-actions/changed-files@v45 | ||
with: | ||
fetch_additional_submodule_history: 'true' | ||
files: | | ||
tests/ansibench/* | ||
tests/rv8-bench/* | ||
tests/*.c | ||
- name: Set alias | ||
id: has_changed_files | ||
run: | | ||
if [[ ${{ steps.test-file-change.outputs.any_modified }} == true ]]; then | ||
echo "has_changed_files=true" >> $GITHUB_OUTPUT | ||
else | ||
echo "has_changed_files=false" >> $GITHUB_OUTPUT | ||
fi | ||
outputs: | ||
has_changed_files: ${{ steps.has_changed_files.outputs.has_changed_files }} | ||
|
||
build-artifact: | ||
needs: [detect-file-change] | ||
if: ${{ needs.detect-file-change.outputs.has_changed_files == 'true' || github.event_name == 'workflow_dispatch' }} | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
with: | ||
submodules: 'true' | ||
- name: Install dependencies | ||
run: | | ||
sudo apt-get update -q -y | ||
sudo apt-get upgrade -q -y | ||
sudo apt-get install -q -y gcc-multilib g++-multilib | ||
sudo apt-get install -q -y opam build-essential libgmp-dev z3 pkg-config zlib1g-dev | ||
.ci/riscv-toolchain-install.sh | ||
echo "$PWD/toolchain/bin" >> $GITHUB_PATH | ||
- name: Build binaries | ||
run: | | ||
make artifact ENABLE_PREBUILT=0 | ||
mkdir -p /tmp/rv32emu-prebuilt | ||
mv build/linux-x86-softfp build/riscv32 /tmp/rv32emu-prebuilt | ||
- name: Build Sail model | ||
run: | | ||
cd /tmp | ||
opam init -y --disable-sandboxing | ||
opam switch create ocaml-base-compiler.4.06.1 | ||
opam install sail -y | ||
eval $(opam config env) | ||
git clone https://github.com/riscv/sail-riscv.git | ||
cd sail-riscv | ||
git checkout 9547a30bf84572c458476591b569a95f5232c1c7 | ||
ARCH=RV32 make -j | ||
mkdir -p /tmp/rv32emu-prebuilt/sail_cSim | ||
mv c_emulator/riscv_sim_RV32 /tmp/rv32emu-prebuilt/sail_cSim | ||
- name: Create tarball | ||
run: | | ||
cd /tmp | ||
tar -zcvf rv32emu-prebuilt.tar.gz rv32emu-prebuilt | ||
- name: Create GitHub Release | ||
env: | ||
GH_TOKEN: ${{ secrets.RV32EMU_PREBUILT_TOKEN }} | ||
run: | | ||
RELEASE_TAG=$(date +'%Y.%m.%d') | ||
cd /tmp | ||
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
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,67 @@ | ||
# Prebuilt Binaries | ||
|
||
The prebuilt binaries for [rv32emu](https://github.com/sysprog21/rv32emu) are prepared primarily because the [RISC-V Sail Model](https://github.com/riscv/sail-riscv) executable is required for the [RISC-V Architecture Test](https://github.com/riscv-non-isa/riscv-arch-test), and selected RISC-V ELF files are useful for ISA simulation validation and testing. | ||
Some of these prebuilt binaries are stored in [rv32emu-prebuilt](https://github.com/sysprog21/rv32emu-prebuilt). | ||
During testing or benchmarking, these binaries are automatically downloaded into the `build/linux-x86-softfp/` and `build/riscv32/` directories by default. | ||
The RISC-V binaries are compiled using the [xPack RISC-V GCC toolchain](https://github.com/xpack-dev-tools/riscv-none-elf-gcc-xpack) with the options `-march=rv32im -mabi=ilp32`. | ||
The x86 binaries are compiled by GCC with `-m32 -mno-sse -mno-sse2 -msoft-float` options and use [ieeelib](https://github.com/sysprog21/ieeelib) as the soft-fp library. | ||
|
||
To fetch the prebuilt binaries manually, run: | ||
|
||
```shell | ||
$ make artifact | ||
``` | ||
|
||
Or build the binaries from scratch (the RISC-V cross-compiler is required): | ||
|
||
```shell | ||
$ make artifact ENABLE_PREBUILT=0 [CROSS_COMPILE=<COMPILER_PREFIX>] | ||
``` | ||
|
||
The compiler prefix varies according to the used toolchain, such as `riscv-none-elf-`, `riscv32-unknown-elf-`, etc. | ||
|
||
The prebuilt binaries in `rv32emu-prebuilt` are built from the following repositories and resources: | ||
|
||
- [ansibench](https://github.com/sysprog21/ansibench) | ||
- coremark | ||
- stream | ||
- nbench | ||
- [rv8-bench](https://github.com/sysprog21/rv8-bench) | ||
- aes | ||
- dhrystone | ||
- miniz | ||
- norx | ||
- primes | ||
- qsort | ||
- sha512 | ||
- `captcha` : See [tests/captcha.c](/tests/captcha.c) | ||
- `donut` : See [tests/donut.c](/tests/donut.c) | ||
- `fcalc` : See [tests/fcalc.c](/tests/fcalc.c) | ||
- `hamilton` : See [tests/hamilton.c](/tests/hamilton.c) | ||
- `jit` : See [tests/jit.c](/tests/jit.c) | ||
- `lena`: See [tests/lena.c](/tests/lena.c) | ||
- `line` : See [tests/line.c](/tests/line.c) | ||
- `maj2random` : See [tests/maj2random.c](/tests/maj2random.c) | ||
- `mandelbrot` : See [tests/mandelbrot.c](/tests/mandelbrot.c) | ||
- `nqueens` : See [tests/nqueens.c](/tests/nqueens.c) | ||
- `nyancat` : See [tests/nyancat.c](/tests/nyancat.c) | ||
- `pi` : See [tests/pi.c](/tests/pi.c) | ||
- `puzzle` : See [tests/puzzle.c](/tests/puzzle.c) | ||
- `qrcode` : See [tests/qrcode.c](/tests/qrcode.c) | ||
- `richards` : See [tests/richards.c](/tests/richards.c) | ||
- `rvsim` : See [tests/rvsim.c](/tests/rvsim.c) | ||
- `spirograph` : See [tests/spirograph.c](/tests/spirograph.c) | ||
- `uaes` : See [tests/uaes.c](/tests/uaes.c) | ||
|
||
There are still some prebuilt standalone RISC-V binaries under `build/` directory only for testing purpose: | ||
|
||
- `hello.elf` : See [tests/asm-hello](/tests/asm-hello) | ||
- `cc.elf` : See [tests/cc](/tests/cc) | ||
- `chacha20.elf` : See [tests/chacha20](/tests/chacha20) | ||
- `doom.elf` : See [sysprog21/doom_riscv](https://github.com/sysprog21/doom_riscv) [RV32M] | ||
- `ieee754.elf` : See [tests/ieee754.c](/tests/ieee754.c) [RV32F] | ||
- `jit-bf.elf` : See [ezaki-k/xkon_beta](https://github.com/ezaki-k/xkon_beta) | ||
- `quake.elf` : See [sysprog21/quake-embedded](https://github.com/sysprog21/quake-embedded) [RV32F] | ||
- `readelf.elf` : See [tests/readelf](/tests/readelf) | ||
- `scimark2.elf` : See [tests/scimark2](/tests/scimark2) [RV32MF] | ||
- `smolnes.elf` : See [tests/smolnes](/tests/smolnes.c) [RV32M] |
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.