From 7b0ef10895108a0de5ff5ef3d2f93f40cf2e33a5 Mon Sep 17 00:00:00 2001 From: LoGin Date: Thu, 31 Oct 2024 01:05:34 +0800 Subject: [PATCH] ci: change rust src to crates-io-index while using GitHub workflow (#1023) Signed-off-by: longjin --- .github/workflows/makefile.yml | 16 ++++++++-------- tools/BUILD_CONTAINER_VERSION | 2 +- tools/docker-entrypoint.sh | 16 ++++++++++++++++ 3 files changed, 25 insertions(+), 9 deletions(-) diff --git a/.github/workflows/makefile.yml b/.github/workflows/makefile.yml index cfb55083..6a1612e4 100644 --- a/.github/workflows/makefile.yml +++ b/.github/workflows/makefile.yml @@ -12,14 +12,14 @@ jobs: name: Format check ${{ matrix.arch }} runs-on: ubuntu-latest continue-on-error: true - container: dragonos/dragonos-dev:v1.4 + container: dragonos/dragonos-dev:v1.5 strategy: matrix: arch: [x86_64, riscv64] steps: - - run: echo "Running in dragonos/dragonos-dev:v1.4" + - run: echo "Running in dragonos/dragonos-dev:v1.5" - uses: actions/checkout@v3 - name: Format check @@ -35,14 +35,14 @@ jobs: name: Kernel static test ${{ matrix.arch }} runs-on: ubuntu-latest continue-on-error: true - container: dragonos/dragonos-dev:v1.4 + container: dragonos/dragonos-dev:v1.5 strategy: matrix: arch: [x86_64, riscv64] steps: - - run: echo "Running in dragonos/dragonos-dev:v1.4" + - run: echo "Running in dragonos/dragonos-dev:v1.5" - uses: actions/checkout@v3 @@ -56,10 +56,10 @@ jobs: build-x86_64: runs-on: ubuntu-latest - container: dragonos/dragonos-dev:v1.4 + container: dragonos/dragonos-dev:v1.5 steps: - - run: echo "Running in dragonos/dragonos-dev:v1.4" + - run: echo "Running in dragonos/dragonos-dev:v1.5" - uses: actions/checkout@v3 - name: build the DragonOS @@ -78,10 +78,10 @@ jobs: build-riscv64: runs-on: ubuntu-latest - container: dragonos/dragonos-dev:v1.4 + container: dragonos/dragonos-dev:v1.5 steps: - - run: echo "Running in dragonos/dragonos-dev:v1.4" + - run: echo "Running in dragonos/dragonos-dev:v1.5" - uses: actions/checkout@v3 with: diff --git a/tools/BUILD_CONTAINER_VERSION b/tools/BUILD_CONTAINER_VERSION index 64c411b8..59b6ef75 100644 --- a/tools/BUILD_CONTAINER_VERSION +++ b/tools/BUILD_CONTAINER_VERSION @@ -1 +1 @@ -v1.4 \ No newline at end of file +v1.5 \ No newline at end of file diff --git a/tools/docker-entrypoint.sh b/tools/docker-entrypoint.sh index 5fc44481..ea8ccd65 100644 --- a/tools/docker-entrypoint.sh +++ b/tools/docker-entrypoint.sh @@ -1,3 +1,19 @@ #!/bin/bash +CONFIG_FILE=~/.cargo/config.toml + +change_rust_src_to_official() { +echo -e "[source.crates-io] \n \ +registry = \"sparse+https://index.crates.io/\" \n \ +[net] \n \ +git-fetch-with-cli = true \n \ +" > $CONFIG_FILE +} + +# Check if the GITHUB_WORKFLOW environment variable is set and not empty +if [ -n "$GITHUB_ACTION" ]; then + change_rust_src_to_official +fi + + exec "$@"