Merge pull request #38 from qclic/ZLM #124
This file contains 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
name: Test CI | |
on: | |
push: | |
pull_request: | |
workflow_call: | |
inputs: | |
TopTestDirectory: | |
description: 'The directory where the main repository will be placed' | |
required: true | |
type: string | |
CallerPackage: | |
description: 'The package to call the workflow' | |
required: true | |
type: string | |
CallerRepository: | |
description: 'The repository to call the workflow' | |
required: true | |
type: string | |
CallerCommit: | |
description: 'The commit of the repository to call the workflow' | |
required: true | |
type: string | |
TopBranch: | |
description: 'The branch of the main repository' | |
required: false | |
type: string | |
default: 'main' | |
env: | |
qemu-version: 8.2.0 | |
rust-toolchain: nightly-2024-05-02 | |
jobs: | |
prepare_for_external_test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- id: step1 | |
if: github.repository != 'Starry-OS/Starry' | |
# 输出的值可以在后续的job中使用 | |
run: echo "TopTestDirectory=${{ inputs.TopTestDirectory }}" >> $GITHUB_OUTPUT | |
- id: step2 | |
if: github.repository == 'Starry-OS/Starry' | |
run: echo "TopTestDirectory=./" >> $GITHUB_OUTPUT | |
outputs: | |
TopTestDirectory: ${{ steps.step1.outputs.TopTestDirectory || steps.step2.outputs.TopTestDirectory }} | |
app-test-for-unikernel: | |
needs: prepare_for_external_test | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest] | |
arch: [x86_64, riscv64, aarch64] | |
env: | |
WORKING_DIRECTORY: ${{ needs.prepare_for_external_test.outputs.TopTestDirectory }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@stable | |
with: | |
toolchain: ${{ env.rust-toolchain }} | |
components: rust-src | |
- uses: Swatinem/rust-cache@v2 | |
- run: cargo install cargo-binutils | |
- name: Clone Top Repository | |
if: github.repository != 'Starry-OS/Starry' | |
run: | | |
git clone https://github.com/Starry-OS/Starry.git ${{ env.WORKING_DIRECTORY }} && cd ${{ env.WORKING_DIRECTORY }} && git checkout ${{ inputs.TopBranch }} && cd .. | |
sh ${{ env.WORKING_DIRECTORY }}/scripts/test/external_test.sh ${{ env.WORKING_DIRECTORY }} ${{ inputs.CallerPackage }} ${{ inputs.CallerRepository }} ${{ inputs.CallerCommit }} | |
- name: Update Top Repository | |
working-directory: ${{ env.WORKING_DIRECTORY }} | |
run: make pre_update | |
- uses: ./.github/workflows/actions/setup-qemu | |
with: | |
qemu-version: ${{ env.qemu-version }} | |
- uses: ./.github/workflows/actions/setup-musl | |
with: | |
arch: ${{ matrix.arch }} | |
- name: Run app tests | |
working-directory: ${{ env.WORKING_DIRECTORY }} | |
run: | | |
make disk_img | |
make test ARCH=${{ matrix.arch }} | |
app-test-for-monolithic: | |
needs: prepare_for_external_test | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest] | |
arch: [x86_64, riscv64, aarch64] | |
env: | |
WORKING_DIRECTORY: ${{ needs.prepare_for_external_test.outputs.TopTestDirectory }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@stable | |
with: | |
toolchain: ${{ env.rust-toolchain }} | |
components: rust-src | |
- uses: Swatinem/rust-cache@v2 | |
- run: cargo install cargo-binutils | |
- name: Clone Top Repository | |
if: github.repository != 'Starry-OS/Starry' | |
run: | | |
git clone https://github.com/Starry-OS/Starry.git ${{ env.WORKING_DIRECTORY }} && cd ${{ env.WORKING_DIRECTORY }} && git checkout ${{ inputs.TopBranch }} && cd .. | |
sh ${{ env.WORKING_DIRECTORY }}/scripts/test/external_test.sh ${{ env.WORKING_DIRECTORY }} ${{ inputs.CallerPackage }} ${{ inputs.CallerRepository }} ${{ inputs.CallerCommit }} | |
- name: Update Top Repository | |
working-directory: ${{ env.WORKING_DIRECTORY }} | |
run: make pre_update | |
- uses: ./.github/workflows/actions/setup-qemu | |
with: | |
qemu-version: ${{ env.qemu-version }} | |
- uses: ./.github/workflows/actions/setup-musl | |
with: | |
arch: ${{ matrix.arch }} | |
- name: Run app tests | |
working-directory: ${{ env.WORKING_DIRECTORY }} | |
run: | | |
make disk_img | |
make test_monolithic ARCH=${{ matrix.arch }} | |
app-test-for-ext4fs: | |
needs: prepare_for_external_test | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest] | |
arch: [x86_64, riscv64, aarch64] | |
env: | |
WORKING_DIRECTORY: ${{ needs.prepare_for_external_test.outputs.TopTestDirectory }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@stable | |
with: | |
toolchain: ${{ env.rust-toolchain }} | |
components: rust-src | |
- uses: Swatinem/rust-cache@v2 | |
- run: cargo install cargo-binutils | |
- name: Clone Top Repository | |
if: github.repository != 'Starry-OS/Starry' | |
run: | | |
git clone https://github.com/Starry-OS/Starry.git ${{ env.WORKING_DIRECTORY }} && cd ${{ env.WORKING_DIRECTORY }} && git checkout ${{ inputs.TopBranch }} && cd .. | |
sh ${{ env.WORKING_DIRECTORY }}/scripts/test/external_test.sh ${{ env.WORKING_DIRECTORY }} ${{ inputs.CallerPackage }} ${{ inputs.CallerRepository }} ${{ inputs.CallerCommit }} | |
- name: Update Top Repository | |
working-directory: ${{ env.WORKING_DIRECTORY }} | |
run: make pre_update | |
- uses: ./.github/workflows/actions/setup-qemu | |
with: | |
qemu-version: ${{ env.qemu-version }} | |
- uses: ./.github/workflows/actions/setup-musl | |
with: | |
arch: ${{ matrix.arch }} | |
- name: Run app tests | |
working-directory: ${{ needs.prepare_for_external_test.outputs.TopTestDirectory }} | |
run: | | |
sh ./build_img.sh -a ${{ matrix.arch }} -fs ext4 | |
export MONOLITHIC_TESTCASE=other | |
make ARCH=${{ matrix.arch }} A=apps/monolithic_userboot APP_FEATURES=batch FEATURES="lwext4_rust" LOG=off ACCEL=n run | |
make clean | |
make ARCH=${{ matrix.arch }} A=apps/monolithic_userboot APP_FEATURES=batch FEATURES="ext4_rs" LOG=off ACCEL=n run |