Skip to content

Commit

Permalink
[ci] Add deploy CI for doc
Browse files Browse the repository at this point in the history
  • Loading branch information
Azure-stars committed Sep 20, 2024
1 parent 24b7289 commit e3c0bbd
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 9 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
rust-toolchain: [nightly]
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@nightly
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ matrix.rust-toolchain }}
components: rust-src, clippy, rustfmt
Expand Down Expand Up @@ -56,7 +56,7 @@ jobs:
qemu-version: 8.2.0
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@nightly
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ matrix.rust-toolchain }}
components: rust-src, llvm-tools
Expand Down
34 changes: 34 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Build & Deploy docs

on: [push, pull_request]

env:
rust-toolchain: nightly-2024-05-02

jobs:
doc:
runs-on: ubuntu-latest
strategy:
fail-fast: false
permissions:
contents: write
env:
default-branch: ${{ format('refs/heads/{0}', github.event.repository.default_branch) }}
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ env.rust-toolchain }}
- uses: Swatinem/rust-cache@v2
- run: cargo install cargo-binutils
- run: ./scripts/get_deps.sh
- name: Build docs
continue-on-error: ${{ github.ref != env.default-branch && github.event_name != 'pull_request' }}
run: make doc_check_missing
- name: Deploy to Github Pages
if: ${{ github.ref == env.default-branch }}
uses: JamesIves/github-pages-deploy-action@v4
with:
single-commit: true
branch: gh-pages
folder: target/doc
12 changes: 11 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
AX_ROOT ?= $(PWD)/.arceos
AX_TESTCASE ?= nimbos
ARCH ?= x86_64
AX_TESTCASES_LIST=$(shell cat ./apps/$(AX_TESTCASE)/testcase_list | tr '\n' ',')

export AX_TESTCASES_LIST=$(shell cat ./apps/$(AX_TESTCASE)/testcase_list | tr '\n' ',')
RUSTDOCFLAGS := -Z unstable-options --enable-index-page -D rustdoc::broken_intra_doc_links -D missing-docs

ifneq ($(filter $(MAKECMDGOALS),doc_check_missing),) # make doc_check_missing
export RUSTDOCFLAGS
else ifeq ($(filter $(MAKECMDGOALS),clean user_apps ax_root),) # Not make clean, user_apps, ax_root
export AX_TESTCASES_LIST
endif

all: build

Expand All @@ -22,4 +29,7 @@ clean: ax_root
@make -C $(AX_ROOT) A=$(PWD) clean
@cargo clean

doc_check_missing:
@cargo doc --no-deps --all-features --workspace

.PHONY: all ax_root build run justrun debug disasm clean
4 changes: 3 additions & 1 deletion apps/libc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ else
$(error "Unknown TARGET")
endif

all: build_dir build_c build_rust
all: build

build: build_dir build_c build_rust

build_dir:
@mkdir -p build
Expand Down
12 changes: 7 additions & 5 deletions scripts/app_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ function run_and_compare() {

echo -ne " run with \"${BLOD_C}$args${END_C}\": "

make -C "$ROOT" A="$APP" $args > "$actual" 2>&1
make -C "$ROOT" AX_TESTCASE=$APP $args > "$actual" 2>&1
if [ $? -ne 0 ]; then
return $S_BUILD_FAILED
fi
Expand All @@ -77,8 +77,8 @@ function run_and_compare() {

function test_one() {
local args=$1
local expect="$APP/$2"
local actual="$APP/actual.out"
local expect="$APP_DIR/$2"
local actual="$APP_DIR/actual.out"
args="$args ARCH=$ARCH ACCEL=n"
rm -f "$actual"

Expand Down Expand Up @@ -109,13 +109,15 @@ function test_one() {
# TODO: add more testcases
test_list=(
"nimbos"
"libc"
)

for t in ${test_list[@]}; do
APP=$(realpath "$(pwd)/apps/$t")
APP=$t
APP_DIR=$(realpath "$(pwd)/apps/$t")
make -C "$ROOT" user_apps AX_TESTCASE=$t
echo -e "${CYAN_C}Testing${END_C} $t:"
source "$APP/test_cmd"
source "$APP_DIR/test_cmd"
done

echo -e "test script exited with: $EXIT_STATUS"
Expand Down
1 change: 1 addition & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#![no_std]
#![no_main]
#![doc = include_str!("../README.md")]

#[macro_use]
extern crate log;
Expand Down

0 comments on commit e3c0bbd

Please sign in to comment.