Skip to content
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

Test ci #3

Merged
merged 30 commits into from
May 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
65cd3a1
ci: test ubuntu
yfblock May 4, 2024
e6e1553
CI: Test update ci
yfblock May 4, 2024
1d82117
ci: test ci through archlinux docker
yfblock May 4, 2024
eb44617
ci: test ci through docker
yfblock May 4, 2024
409e323
ci: fix ci without toolchain
yfblock May 4, 2024
70ae133
ci: add gcc package
yfblock May 4, 2024
6293a2c
ci: fix ci
yfblock May 4, 2024
74be9a7
export ci
yfblock May 4, 2024
4119378
ci: test ci
yfblock May 4, 2024
d3189e2
Install qemu
yfblock May 4, 2024
7b4825b
ci: update example
yfblock May 4, 2024
a1f632c
Test ci (#1)
chyyuu May 4, 2024
aa2c40c
CI: add time out minutes
yfblock May 4, 2024
fb3ad0d
ci: test trigger another repo ci
yfblock May 8, 2024
d561951
ci: change personal_token name
yfblock May 8, 2024
f1b608a
ci: rename yaml file
yfblock May 8, 2024
2f5a553
ci: config proper config
yfblock May 8, 2024
e4f2d3e
Merge pull request #2 from Byte-OS/test-ci
yfblock May 8, 2024
88cc517
ci: add sha
yfblock May 8, 2024
ea874da
ci: update template ci
yfblock May 9, 2024
8cc0b4a
ci: install openssl
yfblock May 9, 2024
016d448
ci: install pkgconf
yfblock May 9, 2024
7be0f45
ci: install cargo-generate through pacman
yfblock May 9, 2024
9458470
ci: install git
yfblock May 9, 2024
9dec706
ci: install libgit2
yfblock May 9, 2024
2c5b0aa
ci: install cargo generate through cargo
yfblock May 9, 2024
1e9b729
ci: install openssl and pkgconf
yfblock May 9, 2024
2e7e889
ci: set path
yfblock May 9, 2024
e20b997
fix example
yfblock May 9, 2024
5409b74
Merge branch 'main' into test-ci
yfblock May 9, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
95 changes: 75 additions & 20 deletions .github/workflows/example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,32 +5,87 @@ on:
push:

jobs:
build-qemu:
runs-on: ubuntu-20.04
steps:
- name: Install dependencies
run: sudo apt -y install autoconf automake autotools-dev curl libmpc-dev libmpfr-dev libgmp-dev \
gawk build-essential bison flex texinfo gperf libtool patchutils bc \
zlib1g-dev libexpat-dev pkg-config libglib2.0-dev libpixman-1-dev libsdl2-dev libslirp-dev \
git tmux python3 python3-pip ninja-build
- name: Get QEMU Source Code
run: wget https://github.com/qemu/qemu/archive/refs/tags/v9.0.0.tar.gz
- name: extract qemu source code
run: tar zxvf v9.0.0.tar.gz
- name: build qemu 9.0
run: mkdir v9.0.0/build && cd v9.0.0/build && ../configure --target-list=riscv64-softmmu,aarch64-softmmu,x86_64-softmmu,loongarch64-softmmu
- name: make qemu 9.0
run: cd v9.0.0/build && make -j8
# build-qemu:
# runs-on: ubuntu-latest
# steps:
# - run: sudo apt update
# - name: Install dependencies
# run: sudo apt -y install autoconf automake autotools-dev curl libmpc-dev libmpfr-dev libgmp-dev \
# build-essential bison flex texinfo gperf libtool patchutils bc \
# libexpat-dev pkg-config libglib2.0-dev libpixman-1-dev libsdl2-dev libslirp-dev \
# tmux python3 python3-pip ninja-build
# - name: Get QEMU Source Code
# run: wget https://github.com/qemu/qemu/archive/refs/tags/v9.0.0.tar.gz
# - name: extract qemu source code
# run: tar zxvf v9.0.0.tar.gz
# - name: build qemu 9.0
# run: mkdir v9.0.0/build && cd v9.0.0/build && ../configure --target-list=riscv64-softmmu,aarch64-softmmu,x86_64-softmmu,loongarch64-softmmu
# - name: make qemu 9.0
# run: cd v9.0.0/build && make -j8

test:
runs-on: ubuntu-20.04
needs: build-qemu
runs-on: ubuntu-latest
container:
image: archlinux:base
volumes:
- .:/code
strategy:
fail-fast: false
matrix:
arch: [x86_64, riscv64, aarch64, loongarch64]
include:
- arch: aarch64
packages: qemu-system-aarch64
- arch: riscv64
packages: qemu-system-riscv
- arch: x86_64
packages: qemu-system-x86
- arch: loongarch64
packages: qemu-system-loongarch64
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@nightly
- name: Install generaic tools
run: yes | pacman -Syy make cmake rustup gcc
- name: setup rust toolchain
run: rustup default nightly && cargo install cargo-binutils
- name: Test ${{ matrix.arch }}
run: cd example && make ARCH=${{ matrix.arch }} build
run: cd example && PATH=$PATH:~/.cargo/bin make ARCH=${{ matrix.arch }} build
- name: Install Qemu
run: yes | pacman -Syy ${{ matrix.packages }}
- name: Test run
run: cd example && PATH=$PATH:~/.cargo/bin make ARCH=${{ matrix.arch }} run
timeout-minutes: 1

template:
runs-on: ubuntu-latest
container:
image: archlinux:base
volumes:
- .:/code
strategy:
fail-fast: false
matrix:
arch: [x86_64, riscv64, aarch64, loongarch64]
include:
- arch: aarch64
packages: qemu-system-aarch64
- arch: riscv64
packages: qemu-system-riscv
- arch: x86_64
packages: qemu-system-x86
- arch: loongarch64
packages: qemu-system-loongarch64
steps:
- name: Install generaic tools
run: yes | pacman -Syy make cmake rustup gcc git libgit2 libgit2-glib pkgconf openssl
- name: Install Rust toolchain
run: rustup default stable && cargo install cargo-binutils && cargo install cargo-generate
- name: generate by template
run: USER=test cargo generate --git https://github.com/Byte-OS/polyhal-template.git -n test-polyhal
- name: Install Qemu
run: yes | pacman -Syy ${{ matrix.packages }}
- name: test run
run: cd test-polyhal && (PATH=$PATH:~/.cargo/bin timeout 60 make ARCH=${{ matrix.arch }} run > output.log) || echo "qemu exited!"
timeout-minutes: 2
- name: test log
run: grep "\[kernel\] exited successfully" test-polyhal/output.log
24 changes: 24 additions & 0 deletions .github/workflows/test-extranel.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: TestExternal

on:
workflow_dispatch:
push:
pull_request:

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: convictional/[email protected]
with:
owner: yfblock
repo: rcore-tutorial-v3-with-hal-component
github_token: ${{ secrets.PERSONAL_TOKEN }}
github_user: yfblock
workflow_file_name: test-run.yml
ref: ch7
wait_interval: 10
client_payload: '{"commit": "${{ github.sha}}"}'
propagate_failure: true
trigger_workflow: true
wait_workflow: true
21 changes: 15 additions & 6 deletions example/Makefile
Original file line number Diff line number Diff line change
@@ -1,35 +1,43 @@
# Building
ARCH := riscv64
QEMU_EXEC := timeout 40


ifeq ($(ARCH), x86_64)
TARGET := x86_64-unknown-none
KERNEL_ELF := target/$(TARGET)/release/example
KERNEL_BIN := $(KERNEL_ELF).bin
QEMU_EXEC += qemu-system-x86_64 \
-machine q35 \
-kernel $(KERNEL_ELF) \
-cpu IvyBridge-v2
BUS := pci
else ifeq ($(ARCH), riscv64)
TARGET := riscv64gc-unknown-none-elf
KERNEL_ELF := target/$(TARGET)/release/example
KERNEL_BIN := $(KERNEL_ELF).bin
QEMU_EXEC += qemu-system-$(ARCH) \
-machine virt \
-kernel $(KERNEL_BIN)
else ifeq ($(ARCH), aarch64)
TARGET := aarch64-unknown-none-softfloat
KERNEL_ELF := target/$(TARGET)/release/example
KERNEL_BIN := $(KERNEL_ELF).bin
QEMU_EXEC += qemu-system-$(ARCH) \
-cpu cortex-a72 \
-machine virt \
-kernel $(KERNEL_BIN)
else ifeq ($(ARCH), loongarch64)
TARGET := loongarch64-unknown-none
KERNEL_ELF := target/$(TARGET)/release/example
KERNEL_BIN := $(KERNEL_ELF).bin
QEMU_EXEC += qemu-system-$(ARCH) -kernel $(KERNEL_ELF)
BUILD_ARGS += -Z build-std=core,alloc
BUS := pci
else
$(error "ARCH" must be one of "x86_64", "riscv64", "aarch64" or "loongarch64")
endif

KERNEL_ELF := target/$(TARGET)/release/example
KERNEL_BIN := $(KERNEL_ELF).bin

# Binutils
OBJDUMP := rust-objdump --arch-name=riscv64
OBJCOPY := rust-objcopy --binary-architecture=riscv64
Expand All @@ -54,15 +62,16 @@ clean:

run: run-inner

QEMU_EXEC += -nographic -smp 1
QEMU_EXEC += -nographic -smp 1 >output.log 2>&1

run-inner: build
$(QEMU_EXEC)
$(QEMU_EXEC) || echo "QEMU exited"
grep "\[kernel\] Hello, world!" output.log

test:
make ARCH=aarch64 run
make ARCH=riscv64 run
make ARCH=x86_64 run
# make ARCH=loongarch64 run
make ARCH=loongarch64 run

.PHONY: build env kernel clean run-inner
Loading