From dab085210ab5789cf218cc69a7955cf0fdfede39 Mon Sep 17 00:00:00 2001 From: Youjie Zheng Date: Tue, 21 May 2024 20:36:09 +0800 Subject: [PATCH] chore: add branch option for CI-CD --- .github/workflows/build.yml | 15 ++++++++++----- .github/workflows/test.yml | 12 ++++++++---- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ff0760e..23a6f8b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -21,6 +21,11 @@ on: description: 'The commit of the repository to call the workflow' required: true type: string + TopBranch: + description: 'The branch of the main repository' + required: true + type: string + default: 'main' jobs: prepare_for_external_test: @@ -57,7 +62,7 @@ jobs: targets: x86_64-unknown-none, riscv64gc-unknown-none-elf, aarch64-unknown-none, aarch64-unknown-none-softfloat - name: Clone Top Repository if: github.repository != 'Starry-OS/Starry' - run: git clone https://github.com/Starry-OS/Starry.git ${{ env.WORKING_DIRECTORY }} + run: git clone https://github.com/Starry-OS/Starry.git ${{ env.WORKING_DIRECTORY }} && cd ${{ env.WORKING_DIRECTORY }} && git checkout ${{ inputs.TopBranch }} - name: Check rust version working-directory: ${{ env.WORKING_DIRECTORY }} run: rustc --version --verbose @@ -101,7 +106,7 @@ jobs: - name: Clone Top Repository if: github.repository != 'Starry-OS/Starry' run: | - git clone https://github.com/Starry-OS/Starry.git ${{ env.WORKING_DIRECTORY }} + 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 }} @@ -201,7 +206,7 @@ jobs: - name: Clone Top Repository if: github.repository != 'Starry-OS/Starry' run: | - git clone https://github.com/Starry-OS/Starry.git ${{ env.WORKING_DIRECTORY }} + 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 }} @@ -253,7 +258,7 @@ jobs: - name: Clone Top Repository if: github.repository != 'Starry-OS/Starry' run: | - git clone https://github.com/Starry-OS/Starry.git ${{ env.WORKING_DIRECTORY }} + 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 }} @@ -322,7 +327,7 @@ jobs: - name: Clone Top Repository if: github.repository != 'Starry-OS/Starry' run: | - git clone https://github.com/Starry-OS/Starry.git ${{ env.WORKING_DIRECTORY }} + 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 }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e6a9a3e..365e0b4 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -21,7 +21,11 @@ on: description: 'The commit of the repository to call the workflow' required: true type: string - + TopBranch: + description: 'The branch of the main repository' + required: true + type: string + default: 'main' env: qemu-version: 8.2.0 rust-toolchain: nightly-2024-05-02 @@ -63,7 +67,7 @@ jobs: - name: Clone Top Repository if: github.repository != 'Starry-OS/Starry' run: | - git clone https://github.com/Starry-OS/Starry.git ${{ env.WORKING_DIRECTORY }} + 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 }} @@ -101,7 +105,7 @@ jobs: - name: Clone Top Repository if: github.repository != 'Starry-OS/Starry' run: | - git clone https://github.com/Starry-OS/Starry.git ${{ env.WORKING_DIRECTORY }} + 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 }} @@ -138,7 +142,7 @@ jobs: - name: Clone Top Repository if: github.repository != 'Starry-OS/Starry' run: | - git clone https://github.com/Starry-OS/Starry.git ${{ env.WORKING_DIRECTORY }} + 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 }}