-
Notifications
You must be signed in to change notification settings - Fork 16
Added GitHub Action for CI: #56
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
Open
Chris-godz
wants to merge
2
commits into
plctlab:main
Choose a base branch
from
Chris-godz:feature
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,100 @@ | ||
| name: Mlibc Compilation | ||
|
|
||
| # Controls when the action will run. Triggers the workflow on push or pull request | ||
| # events but only for the main branch | ||
| on: | ||
| push: | ||
| branches: [ main ] | ||
| paths-ignore: | ||
| - '**/README.md' | ||
| - '**/README_zh.md' | ||
| pull_request: | ||
| branches: [ main ] | ||
| paths-ignore: | ||
| - '**/README.md' | ||
| - '**/README_zh.md' | ||
|
|
||
| permissions: | ||
| contents: read # to fetch code (actions/checkout) | ||
|
|
||
| jobs: | ||
| build: | ||
| runs-on: ubuntu-22.04 | ||
| name: ${{ matrix.legs.MLIBC_COMPILE }} | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| legs: | ||
| - MLIBC_COMPILE: "Mlibc Arm Compilation On Linux" | ||
| ARCH: "arm" | ||
| QEMU_BOARD: "qemu-vexpress-a9" | ||
|
|
||
| - MLIBC_COMPILE: "Mlibc AArch64 Compilation On Linux" | ||
| ARCH: "aarch64" | ||
| QEMU_BOARD: "qemu-virt-aarch64" | ||
|
|
||
| - MLIBC_COMPILE: "Mlibc RISCV32 Compilation On Linux" | ||
| ARCH: "riscv32" | ||
| QEMU_BOARD: "qemu-virt-riscv32" | ||
|
|
||
| - MLIBC_COMPILE: "Mlibc RISCV64 Compilation On Linux" | ||
| ARCH: "riscv64" | ||
| QEMU_BOARD: "qemu-virt-riscv64" | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - name: Install Arm ToolChains | ||
| if: ${{ matrix.legs.ARCH == 'arm'}} | ||
| shell: bash | ||
| run: | | ||
| wget -q https://github.com/RT-Thread/toolchains-ci/releases/download/v1.3/gcc-arm-none-eabi-10-2020-q4-major-x86_64-linux.tar.bz2 | ||
| sudo tar xjf gcc-arm-none-eabi-10-2020-q4-major-x86_64-linux.tar.bz2 -C /opt | ||
| /opt/gcc-arm-none-eabi-10-2020-q4-major/bin/arm-none-eabi-gcc --version | ||
| echo "MLIBC_TOOLCHAIN_CC=/opt/gcc-arm-none-eabi-10-2020-q4-major/bin/arm-none-eabi-gcc" >> $GITHUB_ENV | ||
| echo "MLIBC_TOOLCHAIN_AR=/opt/gcc-arm-none-eabi-10-2020-q4-major/bin/arm-none-eabi-gcc-ar" >> $GITHUB_ENV | ||
|
|
||
| - name: Install AArch64 ToolChains | ||
| if: ${{ matrix.legs.ARCH == 'aarch64'}} | ||
| shell: bash | ||
| run: | | ||
| wget -q https://github.com/RT-Thread/toolchains-ci/releases/download/v1.6/gcc-arm-10.2-2020.11-x86_64-aarch64-none-elf.tar.xz | ||
| sudo tar -xf gcc-arm-10.2-2020.11-x86_64-aarch64-none-elf.tar.xz -C /opt | ||
| /opt/gcc-arm-10.2-2020.11-x86_64-aarch64-none-elf/bin/aarch64-none-elf-gcc --version | ||
| echo "MLIBC_TOOLCHAIN_CC=/opt/gcc-arm-10.2-2020.11-x86_64-aarch64-none-elf/bin/aarch64-none-elf-gcc" >> $GITHUB_ENV | ||
| echo "MLIBC_TOOLCHAIN_AR=/opt/gcc-arm-10.2-2020.11-x86_64-aarch64-none-elf/bin/aarch64-none-elf-ar" >> $GITHUB_ENV | ||
|
|
||
| - name: Install RV32 ToolChains | ||
| if: ${{ matrix.legs.ARCH == 'riscv32'}} | ||
| shell: bash | ||
| run: | | ||
| wget -q https://github.com/hpmicro/riscv-gnu-toolchain/releases/download/2022.05.15/riscv32-unknown-elf-newlib-multilib_2022.05.15_linux.tar.gz | ||
| sudo tar zxf riscv32-unknown-elf-newlib-multilib_2022.05.15_linux.tar.gz -C /opt | ||
| /opt/riscv32-unknown-elf-newlib-multilib/bin/riscv32-unknown-elf-gcc --version | ||
| echo "MLIBC_TOOLCHAIN_CC=/opt/riscv32-unknown-elf-newlib-multilib/bin/riscv32-unknown-elf-gcc" >> $GITHUB_ENV | ||
| echo "MLIBC_TOOLCHAIN_AR=/opt/riscv32-unknown-elf-newlib-multilib/bin/riscv32-unknown-elf-ar" >> $GITHUB_ENV | ||
|
|
||
| - name: Install RV64 ToolChains | ||
| if: ${{ matrix.legs.ARCH == 'riscv64'}} | ||
| shell: bash | ||
| run: | | ||
| wget -q https://github.com/RT-Thread/toolchains-ci/releases/download/v1.4/riscv64-unknown-elf-toolchain-10.2.0-2020.12.8-x86_64-linux-ubuntu14.tar.gz | ||
| sudo tar zxf riscv64-unknown-elf-toolchain-10.2.0-2020.12.8-x86_64-linux-ubuntu14.tar.gz -C /opt | ||
| /opt/riscv64-unknown-elf-toolchain-10.2.0-2020.12.8-x86_64-linux-ubuntu14/bin/riscv64-unknown-elf-gcc --version | ||
| echo "MLIBC_TOOLCHAIN_CC=/opt/riscv64-unknown-elf-toolchain-10.2.0-2020.12.8-x86_64-linux-ubuntu14/bin/riscv64-unknown-elf-gcc" >> $GITHUB_ENV | ||
| echo "MLIBC_TOOLCHAIN_AR=/opt/riscv64-unknown-elf-toolchain-10.2.0-2020.12.8-x86_64-linux-ubuntu14/bin/riscv64-unknown-elf-ar" >> $GITHUB_ENV | ||
|
|
||
| - name: Mlibc Make Compile | ||
| shell: bash | ||
| env: | ||
| ARCH : ${{ matrix.legs.ARCH }} | ||
| QEMU_BOARD : ${{ matrix.legs.QEMU_BOARD }} | ||
| run: | | ||
| make mlibc | ||
|
|
||
| - name: Upload Mlibc Compilation | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: mlibc-${{ matrix.legs.ARCH }}.a | ||
| path: ./build/${{ matrix.legs.ARCH }}/libmlibc.a | ||
| if-no-files-found: error | ||
| retention-days: 7 |
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,157 @@ | ||
| name: Qemu-hello RUN | ||
|
|
||
| on: | ||
| push: | ||
| branches: [ main ] | ||
| paths-ignore: | ||
| - '**/README.md' | ||
| - '**/README_zh.md' | ||
| pull_request: | ||
| branches: [ main ] | ||
| paths-ignore: | ||
| - '**/README.md' | ||
| - '**/README_zh.md' | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| test: | ||
| runs-on: ubuntu-22.04 | ||
| name: ${{ matrix.platform.QEMU_HELLO }} | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| platform: | ||
| - { QEMU_BOARD: "qemu-mps3-an536" , ARCH: "arm" , QEMU_HELLO: "qemu-hello run on qemu-mps3-an536"} | ||
| - { QEMU_BOARD: "qemu-vexpress-a9" , ARCH: "arm" , QEMU_HELLO: "qemu-hello run on qemu-vexpress-a9"} | ||
| - { QEMU_BOARD: "qemu-virt-aarch64", ARCH: "aarch64" , QEMU_HELLO: "qemu-hello run on qemu-virt-aarch64"} | ||
| - { QEMU_BOARD: "qemu-virt-riscv32", ARCH: "riscv32" , QEMU_HELLO: "qemu-hello run on qemu-virt-riscv32"} | ||
| - { QEMU_BOARD: "qemu-virt-riscv64", ARCH: "riscv64" , QEMU_HELLO: "qemu-hello run on qemu-virt-riscv64"} | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - name: Install Qemu | ||
| shell: bash | ||
| run: | | ||
| wget -q https://github.com/Chris-godz/mlibc/releases/download/CI/qemu-9.2.2.tar.zst | ||
| cat *.tar.zst | zstd -d -T0 | tar -xf - > /dev/null 2>&1 | ||
| chmod +x ./qemu-9.2.2/qemu_install.sh | ||
| sudo ./qemu-9.2.2/qemu_install.sh | ||
|
|
||
| - name: Verify QEMU installation | ||
| shell: bash | ||
| run: | | ||
| qemu-system-arm --version | ||
|
|
||
| - name: Install Arm ToolChains | ||
| if: ${{ matrix.platform.ARCH == 'arm'}} | ||
| shell: bash | ||
| run: | | ||
| wget -q https://github.com/RT-Thread/toolchains-ci/releases/download/v1.3/gcc-arm-none-eabi-10-2020-q4-major-x86_64-linux.tar.bz2 | ||
| sudo tar xjf gcc-arm-none-eabi-10-2020-q4-major-x86_64-linux.tar.bz2 -C /opt | ||
| /opt/gcc-arm-none-eabi-10-2020-q4-major/bin/arm-none-eabi-gcc --version | ||
| echo "MLIBC_TOOLCHAIN_CC=/opt/gcc-arm-none-eabi-10-2020-q4-major/bin/arm-none-eabi-gcc" >> $GITHUB_ENV | ||
| echo "MLIBC_TOOLCHAIN_AR=/opt/gcc-arm-none-eabi-10-2020-q4-major/bin/arm-none-eabi-gcc-ar" >> $GITHUB_ENV | ||
|
|
||
| - name: Install AArch64 ToolChains | ||
| if: ${{ matrix.platform.ARCH == 'aarch64'}} | ||
| shell: bash | ||
| run: | | ||
| wget -q https://github.com/RT-Thread/toolchains-ci/releases/download/v1.6/gcc-arm-10.2-2020.11-x86_64-aarch64-none-elf.tar.xz | ||
| sudo tar -xf gcc-arm-10.2-2020.11-x86_64-aarch64-none-elf.tar.xz -C /opt | ||
| /opt/gcc-arm-10.2-2020.11-x86_64-aarch64-none-elf/bin/aarch64-none-elf-gcc --version | ||
| echo "MLIBC_TOOLCHAIN_CC=/opt/gcc-arm-10.2-2020.11-x86_64-aarch64-none-elf/bin/aarch64-none-elf-gcc" >> $GITHUB_ENV | ||
| echo "MLIBC_TOOLCHAIN_AR=/opt/gcc-arm-10.2-2020.11-x86_64-aarch64-none-elf/bin/aarch64-none-elf-ar" >> $GITHUB_ENV | ||
|
|
||
| - name: Install RV32 ToolChains | ||
| if: ${{ matrix.platform.ARCH == 'riscv32'}} | ||
| shell: bash | ||
| run: | | ||
| wget -q https://github.com/hpmicro/riscv-gnu-toolchain/releases/download/2022.05.15/riscv32-unknown-elf-newlib-multilib_2022.05.15_linux.tar.gz | ||
| sudo tar zxf riscv32-unknown-elf-newlib-multilib_2022.05.15_linux.tar.gz -C /opt | ||
| /opt/riscv32-unknown-elf-newlib-multilib/bin/riscv32-unknown-elf-gcc --version | ||
| echo "MLIBC_TOOLCHAIN_CC=/opt/riscv32-unknown-elf-newlib-multilib/bin/riscv32-unknown-elf-gcc" >> $GITHUB_ENV | ||
| echo "MLIBC_TOOLCHAIN_AR=/opt/riscv32-unknown-elf-newlib-multilib/bin/riscv32-unknown-elf-ar" >> $GITHUB_ENV | ||
|
|
||
| - name: Install RV64 ToolChains | ||
| if: ${{ matrix.platform.ARCH == 'riscv64'}} | ||
| shell: bash | ||
| run: | | ||
| wget -q https://github.com/RT-Thread/toolchains-ci/releases/download/v1.4/riscv64-unknown-elf-toolchain-10.2.0-2020.12.8-x86_64-linux-ubuntu14.tar.gz | ||
| sudo tar zxf riscv64-unknown-elf-toolchain-10.2.0-2020.12.8-x86_64-linux-ubuntu14.tar.gz -C /opt | ||
| /opt/riscv64-unknown-elf-toolchain-10.2.0-2020.12.8-x86_64-linux-ubuntu14/bin/riscv64-unknown-elf-gcc --version | ||
| echo "MLIBC_TOOLCHAIN_CC=/opt/riscv64-unknown-elf-toolchain-10.2.0-2020.12.8-x86_64-linux-ubuntu14/bin/riscv64-unknown-elf-gcc" >> $GITHUB_ENV | ||
| echo "MLIBC_TOOLCHAIN_AR=/opt/riscv64-unknown-elf-toolchain-10.2.0-2020.12.8-x86_64-linux-ubuntu14/bin/riscv64-unknown-elf-ar" >> $GITHUB_ENV | ||
|
|
||
| - name: qemu-hello test | ||
| shell: bash | ||
| if: ${{ env.MLIBC_TOOLCHAIN_AR != '' && success() }} | ||
| env: | ||
| ARCH : ${{ matrix.platform.ARCH }} | ||
| QEMU_BOARD : ${{ matrix.platform.QEMU_BOARD }} | ||
| run: | | ||
| if [[ "${{ matrix.platform.QEMU_BOARD }}" == "qemu-mps3-an536" ]]; then | ||
| make qemu-hello | ||
| qemu-system-arm -M mps3-an536 \ | ||
| -kernel ./helloworld/qemu/${{ matrix.platform.QEMU_BOARD }}/${{ matrix.platform.QEMU_BOARD }}.elf \ | ||
| -nographic -m 512 \ | ||
| > qemu_output_$QEMU_BOARD.log 2>&1 & | ||
|
|
||
| elif [[ "${{ matrix.platform.QEMU_BOARD }}" == "qemu-vexpress-a9" ]]; then | ||
| make qemu-hello | ||
| qemu-system-arm -M vexpress-a9 \ | ||
| -kernel ./helloworld/qemu/${{ matrix.platform.QEMU_BOARD }}/${{ matrix.platform.QEMU_BOARD }}.elf \ | ||
| -nographic -m 512 \ | ||
| > qemu_output_$QEMU_BOARD.log 2>&1 & | ||
|
|
||
| elif [[ "${{ matrix.platform.QEMU_BOARD }}" == "qemu-virt-aarch64" ]]; then | ||
| make qemu-hello | ||
| qemu-system-aarch64 -M virt \ | ||
| -cpu cortex-a53 \ | ||
| -kernel ./helloworld/qemu/${{ matrix.platform.QEMU_BOARD }}/${{ matrix.platform.QEMU_BOARD }}.elf \ | ||
| -nographic -m 512 \ | ||
| > qemu_output_$QEMU_BOARD.log 2>&1 & | ||
|
|
||
| elif [[ "${{ matrix.platform.QEMU_BOARD }}" == "qemu-virt-riscv32" ]]; then | ||
| make qemu-hello | ||
| qemu-system-riscv32 -machine virt \ | ||
| -nographic -m 256M \ | ||
| -kernel ./helloworld/qemu/${{ matrix.platform.QEMU_BOARD }}/${{ matrix.platform.QEMU_BOARD }}.elf \ | ||
| > qemu_output_$QEMU_BOARD.log 2>&1 & | ||
|
|
||
| elif [[ "${{ matrix.platform.QEMU_BOARD }}" == "qemu-virt-riscv64" ]]; then | ||
| make qemu-hello | ||
| qemu-system-riscv64 -machine virt \ | ||
| -nographic -m 512M \ | ||
| -kernel ./helloworld/qemu/${{ matrix.platform.QEMU_BOARD }}/${{ matrix.platform.QEMU_BOARD }}.elf \ | ||
| > qemu_output_$QEMU_BOARD.log 2>&1 & | ||
| fi | ||
|
|
||
| QEMU_PID=$! | ||
| disown $QEMU_PID | ||
| echo "QEMU_SETUP_READY=true" >> $GITHUB_ENV | ||
|
|
||
| - name: Monitor qemu log | ||
| if: ${{ env.QEMU_SETUP_READY == 'true' && success() }} | ||
| shell: bash | ||
| run: | | ||
| # wait for qemu finish | ||
| sleep 10 | ||
| echo "==========================================================================================" | ||
| echo " || || " | ||
| echo " || Start automatic running of qemu-hello || " | ||
| echo " VV VV " | ||
| echo "==========================================================================================" | ||
| LAST_TWO_LINES=$(tail -n 2 qemu_output_${{ matrix.platform.QEMU_BOARD }}.log) | ||
| echo "$LAST_TWO_LINES" | ||
|
|
||
| if grep -q "Uart Test" qemu_output_${{ matrix.platform.QEMU_BOARD }}.log && grep -q "Hello mlibc" qemu_output_${{ matrix.platform.QEMU_BOARD }}.log; then | ||
| echo "==========================================================================================" | ||
| echo " Successed: qemu-hello run completed. Exiting log monitoring " | ||
| echo "==========================================================================================" | ||
| else | ||
| echo "==========================================================================================" | ||
| echo " Failed: qemu-hello run not completed. Exiting log monitoring " | ||
| echo "==========================================================================================" | ||
| exit 1 | ||
| fi | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 这是一个 bugfix,应该单独提一个 pr。不建议和这个 pr 一起提交。
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 是否应该移除这个文件的修改? |
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个是不是应该放到 https://github.com/plctlab/mlibc/ 上去,而不是 https://github.com/Chris-godz/mlibc/
另外 qemu_install.sh 干了什么?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个是我编译后的qemu-9.2.2,删掉了不必要的部分, qemu_install.sh是我根据qemu安装的日志,把编译后的部分mov到系统对应的位置
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
是的,需不需要也把用到的 rtt release 的工具链部分也一起放到mlibc的仓库里面
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
我觉得像 gcc 那样统一放 https://github.com/RT-Thread/toolchains-ci/releases 就挺好的,@BernardXiong 熊大给个建议?
@Chris-godz 另外我发现 rv32 的toolchain 你是从一个非官方的地方下载的,其实我记得 riscv64 的 gcc 也是可以编译 rv32 的,就是用 -march 和 -mabi 控制好就好了的。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
问题是,放哪个仓库呢?