mirror of
https://github.com/rcore-os/rCore.git
synced 2024-11-21 23:56:18 +04:00
ci: add GitHub Actions
This commit is contained in:
parent
e19c6a336c
commit
fc5c82be28
71
.github/workflows/main.yml
vendored
Normal file
71
.github/workflows/main.yml
vendored
Normal file
@ -0,0 +1,71 @@
|
||||
name: CI
|
||||
|
||||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
check:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- run: rm rust-toolchain
|
||||
- uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
profile: minimal
|
||||
toolchain: nightly
|
||||
override: true
|
||||
components: rustfmt, clippy
|
||||
- name: Check code format
|
||||
run: cd kernel && cargo fmt -- --check
|
||||
|
||||
build:
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ubuntu-latest, macos-latest]
|
||||
arch: [x86_64, riscv32, riscv64, aarch64, mipsel]
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Checkout submodules
|
||||
run: git submodule update --init --recursive
|
||||
- uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
profile: minimal
|
||||
toolchain: nightly-2020-01-17
|
||||
components: rust-src, llvm-tools-preview
|
||||
|
||||
- name: Cache QEMU
|
||||
id: cache-qemu
|
||||
if: runner.os == 'Linux'
|
||||
uses: actions/cache@v1
|
||||
with:
|
||||
path: qemu-4.2.0
|
||||
key: ${{ runner.os }}-qemu
|
||||
- name: Install QEMU
|
||||
if: runner.os == 'Linux' && steps.cache-qemu.outputs.cache-hit != 'true'
|
||||
run: |
|
||||
wget https://download.qemu.org/qemu-4.2.0.tar.xz
|
||||
tar xJf qemu-4.2.0.tar.xz > /dev/null
|
||||
cd qemu-4.2.0 && ./configure --target-list=${{ matrix.arch }}-softmmu && sudo make install -j && cd ..
|
||||
- name: Install QEMU
|
||||
if: runner.os == 'macOS'
|
||||
run: brew install qemu
|
||||
|
||||
- name: Install dependencies
|
||||
if: runner.os == 'Linux'
|
||||
run: sudo apt install -y device-tree-compiler
|
||||
- name: Install dependencies
|
||||
if: runner.os == 'macOS'
|
||||
run: brew install dtc
|
||||
|
||||
- name: Cache cargo bins
|
||||
uses: actions/cache@v1
|
||||
with:
|
||||
path: ~/.cargo/bin
|
||||
key: ${{ runner.os }}-cargo-bin
|
||||
- name: Install cargo-binutils
|
||||
run: test -x $HOME/.cargo/bin/cargo-objdump || cargo install cargo-binutils
|
||||
|
||||
- name: Download prebuilt user image
|
||||
run: cd user && make sfsimg arch=${{ matrix.arch }} prebuilt=1 && cd ..
|
||||
- name: Build kernel
|
||||
run: cd kernel && make build arch=${{ matrix.arch }} && cd ..
|
57
.travis.yml
57
.travis.yml
@ -1,57 +0,0 @@
|
||||
sudo: false
|
||||
|
||||
language: rust
|
||||
|
||||
rust: nightly-2019-11-28
|
||||
|
||||
os:
|
||||
- linux
|
||||
- osx
|
||||
|
||||
dist: bionic
|
||||
|
||||
osx_image: xcode11
|
||||
|
||||
cache:
|
||||
cargo: true
|
||||
directories:
|
||||
- $HOME/Library/Caches/Homebrew
|
||||
- $TRAVIS_BUILD_DIR/qemu-4.1.0
|
||||
|
||||
addons:
|
||||
apt:
|
||||
update: true
|
||||
packages:
|
||||
- device-tree-compiler
|
||||
homebrew:
|
||||
packages:
|
||||
- qemu
|
||||
- dtc
|
||||
|
||||
env:
|
||||
matrix:
|
||||
- ARCH="riscv64"
|
||||
- ARCH="riscv64" OPTS="board=u540"
|
||||
- ARCH="riscv64" OPTS="board=k210"
|
||||
- ARCH="riscv64" OPTS="board=rocket_chip"
|
||||
- ARCH="riscv32"
|
||||
- ARCH="x86_64"
|
||||
- ARCH="x86_64" OPTS="board=pc"
|
||||
- ARCH="aarch64"
|
||||
- ARCH="mipsel" OPTS="board=malta"
|
||||
|
||||
install:
|
||||
- if [ $TRAVIS_OS_NAME = linux ]; then
|
||||
[ ! -d qemu-4.1.0/$ARCH-softmmu ] && wget https://download.qemu.org/qemu-4.1.0.tar.xz && tar xJf qemu-4.1.0.tar.xz > /dev/null && cd qemu-4.1.0 && ./configure --target-list=$ARCH-softmmu && make && cd ..;
|
||||
export PATH=$PATH:$PWD/qemu-4.1.0/$ARCH-softmmu:$PWD/qemu-4.1.0;
|
||||
fi
|
||||
|
||||
before_script:
|
||||
- rustup component add rust-src llvm-tools-preview
|
||||
- (test -x $HOME/.cargo/bin/cargo-objdump || cargo install cargo-binutils)
|
||||
- (test -x $HOME/.cargo/bin/cargo-xbuild || cargo install cargo-xbuild)
|
||||
|
||||
script:
|
||||
- cd user && make sfsimg arch=$ARCH prebuilt=1 && cd ..
|
||||
- cd kernel && make build arch=$ARCH $OPTS && cd ..
|
||||
- cd kernel && make test arch=$ARCH $OPTS && cd ..
|
@ -31,7 +31,6 @@
|
||||
# . extra_features = profile | ... Add additional features
|
||||
|
||||
arch ?= riscv64
|
||||
board ?= none
|
||||
mode ?= release
|
||||
LOG ?=
|
||||
graphic ?= off
|
||||
@ -56,7 +55,11 @@ export USER_IMG = $(user_dir)/build/$(arch).img
|
||||
export USER_QCOW2 = $(user_dir)/build/$(arch).qcow2
|
||||
|
||||
ifeq ($(arch), aarch64)
|
||||
board := raspi3
|
||||
board ?= raspi3
|
||||
else ifeq ($(arch), mipsel)
|
||||
board ?= malta
|
||||
else
|
||||
board ?= none
|
||||
endif
|
||||
|
||||
# currently only mipsel architecture and rocket-chip need DTB linked to the kernel
|
||||
|
Loading…
Reference in New Issue
Block a user