mirror of
https://github.com/DragonOS-Community/DragonOS.git
synced 2025-06-18 08:06:32 +00:00
build: Remove DragonOS_GCC And make CI use docker image (#954)
* build: 不再需要x86_64-elf-gcc的支持 * ci: 添加ci用的docker镜像 * 切换workflow到构建用的容器上 --------- Signed-off-by: longjin <longjin@DragonOS.org>
This commit is contained in:
36
.github/actions/import-toolchain/action.yml
vendored
36
.github/actions/import-toolchain/action.yml
vendored
@ -1,36 +0,0 @@
|
||||
name: import-toolchain
|
||||
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: 'recursive'
|
||||
|
||||
- name: Cache DragonOS GCC
|
||||
id: cache-dragonos-gcc
|
||||
uses: actions/cache@v3
|
||||
env:
|
||||
cache-name: cache-dragonos-gcc
|
||||
with:
|
||||
path: |
|
||||
~/opt
|
||||
~/.bashrc
|
||||
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('tools/build_gcc_toolchain.sh') }}
|
||||
|
||||
- name: Cache build tools
|
||||
id: cache-build-tools
|
||||
uses: actions/cache@v3
|
||||
env:
|
||||
cache-name: cache-build-tools
|
||||
dadk_version: 0.1.11
|
||||
with:
|
||||
path: |
|
||||
~/.cargo
|
||||
~/.rustup
|
||||
~/.bashrc
|
||||
~/opt
|
||||
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ env.dadk_version }}-${{ hashFiles('.github/workflows/cache-toolchain.yml') }}-${{ hashFiles('tools/install_musl_gcc.sh') }}
|
||||
|
||||
- uses: ./.github/actions/install-apt-packages
|
||||
|
16
.github/actions/install-apt-packages/action.yml
vendored
16
.github/actions/install-apt-packages/action.yml
vendored
@ -1,16 +0,0 @@
|
||||
name: install-apt-packages
|
||||
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
|
||||
- uses: awalsh128/cache-apt-pkgs-action@latest
|
||||
with:
|
||||
packages: llvm-dev libclang-dev clang gcc-multilib libssl-dev pkg-config
|
||||
version: ${{ hashFiles('.github/actions/install-apt-packages/action.yml') }}
|
||||
|
||||
- uses: awalsh128/cache-apt-pkgs-action@latest
|
||||
with:
|
||||
packages: gcc-riscv64-unknown-elf gcc-riscv64-linux-gnu gdb-multiarch
|
||||
version: ${{ hashFiles('.github/actions/install-apt-packages/action.yml') }}
|
||||
|
94
.github/workflows/cache-toolchain.yml
vendored
94
.github/workflows/cache-toolchain.yml
vendored
@ -1,94 +0,0 @@
|
||||
name: Cache toolchain
|
||||
|
||||
on: workflow_call
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Cache DragonOS GCC
|
||||
id: cache-dragonos-gcc
|
||||
uses: actions/cache@v3
|
||||
env:
|
||||
cache-name: cache-dragonos-gcc
|
||||
with:
|
||||
path: |
|
||||
~/opt
|
||||
~/.bashrc
|
||||
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('tools/build_gcc_toolchain.sh') }}
|
||||
|
||||
- if: ${{ steps.cache-dragonos-gcc.outputs.cache-hit != 'true' }}
|
||||
name: build dragonos-gcc
|
||||
continue-on-error: true
|
||||
run: |
|
||||
bash tools/build_gcc_toolchain.sh -f
|
||||
|
||||
- uses: ./.github/actions/install-apt-packages
|
||||
|
||||
- name: Cache build tools
|
||||
id: cache-build-tools
|
||||
uses: actions/cache@v3
|
||||
env:
|
||||
cache-name: cache-build-tools
|
||||
dadk_version: 0.1.11
|
||||
with:
|
||||
path: |
|
||||
~/.cargo
|
||||
~/.rustup
|
||||
~/.bashrc
|
||||
~/opt
|
||||
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ env.dadk_version }}-${{ hashFiles('.github/workflows/cache-toolchain.yml') }}-${{ hashFiles('tools/install_musl_gcc.sh') }}
|
||||
|
||||
- if: ${{ steps.cache-build-tools.outputs.cache-hit != 'true' }}
|
||||
name: Install toolchain
|
||||
continue-on-error: false
|
||||
run: |
|
||||
USE_GITHUB=1 bash tools/install_musl_gcc.sh
|
||||
|
||||
cargo install cargo-binutils
|
||||
rustup toolchain install nightly-x86_64-unknown-linux-gnu
|
||||
rustup toolchain install nightly-2024-07-23-x86_64-unknown-linux-gnu
|
||||
rustup toolchain install nightly-2023-08-15-x86_64-unknown-linux-gnu
|
||||
rustup component add rust-src --toolchain nightly-2024-07-23-x86_64-unknown-linux-gnu
|
||||
rustup component add rust-src --toolchain nightly-2023-08-15-x86_64-unknown-linux-gnu
|
||||
rustup target add x86_64-unknown-none --toolchain nightly-2024-07-23-x86_64-unknown-linux-gnu
|
||||
rustup target add x86_64-unknown-none --toolchain nightly-2023-08-15-x86_64-unknown-linux-gnu
|
||||
|
||||
rustup toolchain install nightly-2024-07-23-riscv64gc-unknown-linux-gnu --force-non-host
|
||||
rustup toolchain install nightly-2023-08-15-riscv64gc-unknown-linux-gnu --force-non-host
|
||||
rustup target add riscv64gc-unknown-none-elf --toolchain nightly-2024-07-23-riscv64gc-unknown-linux-gnu
|
||||
rustup target add riscv64imac-unknown-none-elf --toolchain nightly-2024-07-23-riscv64gc-unknown-linux-gnu
|
||||
rustup target add riscv64gc-unknown-none-elf --toolchain nightly-2023-08-15-riscv64gc-unknown-linux-gnu
|
||||
rustup target add riscv64imac-unknown-none-elf --toolchain nightly-2023-08-15-riscv64gc-unknown-linux-gnu
|
||||
|
||||
rustup component add rust-src --toolchain nightly-x86_64-unknown-linux-gnu
|
||||
rustup component add rust-src
|
||||
rustup component add llvm-tools-preview
|
||||
|
||||
rustup component add rustfmt
|
||||
rustup component add rustfmt --toolchain nightly-x86_64-unknown-linux-gnu
|
||||
rustup component add rustfmt --toolchain nightly-2024-07-23-x86_64-unknown-linux-gnu
|
||||
rustup component add rustfmt --toolchain nightly-2023-08-15-x86_64-unknown-linux-gnu
|
||||
rustup component add rustfmt --toolchain nightly-2024-07-23-riscv64gc-unknown-linux-gnu
|
||||
rustup component add rustfmt --toolchain nightly-2023-08-15-riscv64gc-unknown-linux-gnu
|
||||
|
||||
rustup default nightly-2024-07-23
|
||||
|
||||
cargo install dadk --version 0.1.11
|
||||
|
||||
|
||||
userapp_musl_toolchain="nightly-2023-08-15-x86_64-unknown-linux-gnu"
|
||||
|
||||
rustup toolchain install ${userapp_musl_toolchain}
|
||||
rustup component add --toolchain ${userapp_musl_toolchain} rust-src
|
||||
rustup target add --toolchain ${userapp_musl_toolchain} x86_64-unknown-linux-musl
|
||||
|
||||
rustup target add x86_64-unknown-linux-musl --toolchain nightly-2024-07-23-x86_64-unknown-linux-gnu
|
||||
rustup component add rust-src --toolchain nightly-2024-07-23-x86_64-unknown-linux-gnu
|
||||
|
||||
|
||||
|
38
.github/workflows/makefile.yml
vendored
38
.github/workflows/makefile.yml
vendored
@ -7,28 +7,26 @@ on:
|
||||
branches: [ "master", "feat-*", "fix-*"]
|
||||
|
||||
jobs:
|
||||
# ensure the toolchain is cached
|
||||
ensure-toolchain:
|
||||
uses: ./.github/workflows/cache-toolchain.yml
|
||||
|
||||
format-check:
|
||||
name: Format check ${{ matrix.arch }}
|
||||
runs-on: ubuntu-latest
|
||||
needs: [ensure-toolchain]
|
||||
continue-on-error: true
|
||||
container: dragonos/dragonos-dev:v1.3
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
arch: [x86_64, riscv64]
|
||||
|
||||
steps:
|
||||
- run: echo "Running in dragonos/dragonos-dev:v1.3"
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- uses: ./.github/actions/import-toolchain
|
||||
|
||||
- name: Format check
|
||||
env:
|
||||
ARCH: ${{ matrix.arch }}
|
||||
HOME: /root
|
||||
shell: bash -ileo pipefail {0}
|
||||
run: |
|
||||
printf "\n" >> kernel/src/include/bindings/bindings.rs
|
||||
FMT_CHECK=1 make fmt
|
||||
@ -36,38 +34,38 @@ jobs:
|
||||
kernel-static-test:
|
||||
name: Kernel static test ${{ matrix.arch }}
|
||||
runs-on: ubuntu-latest
|
||||
needs: [ensure-toolchain]
|
||||
continue-on-error: true
|
||||
container: dragonos/dragonos-dev:v1.3
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
arch: [x86_64, riscv64]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- run: echo "Running in dragonos/dragonos-dev:v1.3"
|
||||
|
||||
- uses: ./.github/actions/import-toolchain
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Run kernel static test
|
||||
shell: bash -ileo pipefail {0}
|
||||
env:
|
||||
ARCH: ${{ matrix.arch }}
|
||||
run: bash -c "source ~/.cargo/env && cd kernel && make test"
|
||||
|
||||
HOME: /root
|
||||
run: bash -c "source /root/.cargo/env && cd kernel && make test"
|
||||
|
||||
build-x86_64:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
needs: [ensure-toolchain]
|
||||
container: dragonos/dragonos-dev:v1.3
|
||||
|
||||
steps:
|
||||
- run: echo "Running in dragonos/dragonos-dev:v1.3"
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- uses: ./.github/actions/import-toolchain
|
||||
|
||||
|
||||
- name: build the DragonOS
|
||||
env:
|
||||
ARCH: x86_64
|
||||
HOME: /root
|
||||
shell: bash -ileo pipefail {0}
|
||||
|
||||
run: |
|
||||
@ -77,23 +75,23 @@ jobs:
|
||||
|
||||
make -j $(nproc)
|
||||
|
||||
|
||||
build-riscv64:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
needs: [ensure-toolchain]
|
||||
container: dragonos/dragonos-dev:v1.3
|
||||
|
||||
steps:
|
||||
- run: echo "Running in dragonos/dragonos-dev:v1.3"
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: 'recursive'
|
||||
|
||||
- uses: ./.github/actions/import-toolchain
|
||||
|
||||
- name: build the DragonOS
|
||||
shell: bash -ileo pipefail {0}
|
||||
env:
|
||||
ARCH: riscv64
|
||||
HOME: /root
|
||||
|
||||
run: source ~/.bashrc && source ~/.cargo/env && make kernel -j $(nproc)
|
||||
|
||||
|
37
.github/workflows/publish-dragonos-docker-image.yml
vendored
Normal file
37
.github/workflows/publish-dragonos-docker-image.yml
vendored
Normal file
@ -0,0 +1,37 @@
|
||||
name: Publish Docker images
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
paths:
|
||||
- tools/BUILD_CONTAINER_VERSION
|
||||
|
||||
jobs:
|
||||
docker:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
|
||||
- name: Login to Docker Hub
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Fetch versions in the repo
|
||||
id: fetch-versions
|
||||
run: |
|
||||
BUILD_CONTAINER_VERSION=$(cat tools/BUILD_CONTAINER_VERSION)
|
||||
echo "build_container_version=$BUILD_CONTAINER_VERSION" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Build and push docker image
|
||||
uses: docker/build-push-action@v4
|
||||
with:
|
||||
context: .
|
||||
file: ./tools/Dockerfile
|
||||
platforms: linux/amd64
|
||||
push: true
|
||||
tags: dragonos/dragonos-dev:${{ steps.fetch-versions.outputs.build_container_version }}
|
Reference in New Issue
Block a user