这是indexloc提供的服务,不要输入任何密码
Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .github/workflows/Dockerfile.base
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FROM alpine:latest

RUN apk add --no-cache gcc g++ ncurses-dev git rsync perl tar bash patch findutils diffutils grep gzip unzip bzip2 wget python3 file which make gawk coreutils linux-headers argp-standalone musl-fts-dev musl-obstack-dev musl-libintl
RUN adduser -D buildbot

WORKDIR /home/buildbot
8 changes: 8 additions & 0 deletions .github/workflows/Dockerfile.toolchain
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
ARG OWNER_LC
ARG CONTAINER_TAG

FROM ghcr.io/$OWNER_LC/tools:$CONTAINER_TAG

ARG TOOLCHAIN_NAME

ADD $TOOLCHAIN_NAME /external-toolchain/
5 changes: 4 additions & 1 deletion .github/workflows/Dockerfile.tools
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
FROM registry.gitlab.com/openwrt/buildbot/buildworker-3.4.1
ARG OWNER_LC
ARG CONTAINER_TAG

FROM ghcr.io/$OWNER_LC/base-alpine:$CONTAINER_TAG

COPY --chown=buildbot:buildbot tools.tar /tools.tar
5 changes: 4 additions & 1 deletion .github/workflows/build-tools.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ name: Build host tools
on:
workflow_call:
inputs:
container:
type: string
default: registry.gitlab.com/openwrt/buildbot/buildworker-3.4.1
generate_prebuilt_artifacts:
type: boolean

Expand All @@ -13,7 +16,7 @@ jobs:
build:
name: Build tools
runs-on: ubuntu-latest
container: registry.gitlab.com/openwrt/buildbot/buildworker-3.4.1
container: ${{ inputs.container }}

steps:
- name: Checkout
Expand Down
57 changes: 53 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
name: Build sub target

on:
on:
workflow_call:
inputs:
container_name:
type: string
default: tools
target:
required: true
type: string
Expand All @@ -22,6 +25,10 @@ on:
type: boolean
build_all_boards:
type: boolean
build_external_toolchain:
type: boolean
upload_external_toolchain:
type: boolean

permissions:
contents: read
Expand Down Expand Up @@ -86,7 +93,7 @@ jobs:
needs: setup_build
runs-on: ubuntu-latest

container: ghcr.io/${{ needs.setup_build.outputs.owner_lc }}/tools:${{ needs.setup_build.outputs.container_tag }}
container: ghcr.io/${{ needs.setup_build.outputs.owner_lc }}/${{ inputs.container_name }}:${{ needs.setup_build.outputs.container_tag }}

permissions:
contents: read
Expand Down Expand Up @@ -150,6 +157,11 @@ jobs:
id: parse-toolchain
working-directory: openwrt
run: |
if [ -d /external-toolchain/ ]; then
echo "toolchain-type=external_container" >> $GITHUB_OUTPUT
exit 0
fi

TOOLCHAIN_PATH=snapshots

if [ -n "${{ github.base_ref }}" ]; then
Expand Down Expand Up @@ -196,7 +208,7 @@ jobs:
echo "TOOLCHAIN_PATH=$TOOLCHAIN_PATH" >> "$GITHUB_ENV"

- name: Cache external toolchain/sdk
if: inputs.build_toolchain == false
if: inputs.build_toolchain == false && steps.parse-toolchain.outputs.toolchain-type != 'external_container'
id: cache-external-toolchain
uses: actions/cache@v3
with:
Expand All @@ -212,7 +224,7 @@ jobs:
ccache-kernel-${{ env.TARGET }}/${{ env.SUBTARGET }}-

- name: Download external toolchain/sdk
if: inputs.build_toolchain == false && steps.cache-external-toolchain.outputs.cache-hit != 'true'
if: inputs.build_toolchain == false && steps.parse-toolchain.outputs.toolchain-type != 'external_container' && steps.cache-external-toolchain.outputs.cache-hit != 'true'
shell: su buildbot -c "sh -e {0}"
working-directory: openwrt
run: |
Expand Down Expand Up @@ -254,6 +266,20 @@ jobs:
echo CONFIG_TARGET_PER_DEVICE_ROOTFS=y >> .config
echo CONFIG_TARGET_ALL_PROFILES=y >> .config

- name: Configure external toolchain in container
if: inputs.build_toolchain == false && steps.parse-toolchain.outputs.toolchain-type == 'external_container'
shell: su buildbot -c "sh -e {0}"
working-directory: openwrt
run: |
echo CONFIG_DEVEL=y >> .config
echo CONFIG_AUTOREMOVE=y >> .config
echo CONFIG_CCACHE=y >> .config

./scripts/ext-toolchain.sh \
--toolchain /external-toolchain/$(ls /external-toolchain/ | grep openwrt-toolchain)/toolchain-* \
--overwrite-config \
--config ${{ env.TARGET }}/${{ env.SUBTARGET }}

- name: Configure external toolchain
if: inputs.build_toolchain == false && steps.parse-toolchain.outputs.toolchain-type == 'external_toolchain'
shell: su buildbot -c "sh -e {0}"
Expand Down Expand Up @@ -357,9 +383,32 @@ jobs:
working-directory: openwrt
run: make -j$(nproc) BUILD_LOG=1 || ret=$? .github/workflows/scripts/show_build_failures.sh

- name: Build external toolchain
if: inputs.build_external_toolchain == true
shell: su buildbot -c "sh -e {0}"
working-directory: openwrt
run: make target/toolchain/compile -j$(nproc) BUILD_LOG=1 || ret=$? .github/workflows/scripts/show_build_failures.sh

- name: Upload logs
if: failure()
uses: actions/upload-artifact@v3
with:
name: ${{ env.TARGET }}-${{ env.SUBTARGET }}-logs
path: "openwrt/logs"

- name: Find external toolchain name
if: inputs.upload_external_toolchain == true
working-directory: openwrt
run: |
SUBTARGET_DIR=$(ls bin/targets/${{ env.TARGET }} | grep ${{ env.SUBTARGET }})
TOOLCHAIN_NAME=$(ls bin/targets/${{ env.TARGET }}/$SUBTARGET_DIR | grep toolchain)
echo "SUBTARGET_DIR=$SUBTARGET_DIR" >> "$GITHUB_ENV"
echo "TOOLCHAIN_NAME=$TOOLCHAIN_NAME" >> "$GITHUB_ENV"

- name: Upload prebuilt toolchain
if: inputs.upload_external_toolchain == true
uses: actions/upload-artifact@v3
with:
name: ${{ env.TARGET }}-${{ env.SUBTARGET }}-external-toolchain
path: openwrt/bin/targets/${{ env.TARGET }}/${{ env.SUBTARGET_DIR }}/${{ env.TOOLCHAIN_NAME }}
retention-days: 1
5 changes: 5 additions & 0 deletions .github/workflows/kernel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ on:
permissions:
contents: read

concurrency:
group: ${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}

jobs:
determine_targets:
name: Set targets
Expand Down Expand Up @@ -66,6 +70,7 @@ jobs:
target: ${{fromJson(needs.determine_targets.outputs.target)}}
uses: ./.github/workflows/build.yml
with:
container_name: toolchain-${{ matrix.target }}
target: ${{ matrix.target }}
build_kernel: true
build_all_kmods: true
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ jobs:
- target: x86/64
uses: ./.github/workflows/build.yml
with:
container_name: toolchain-${{ matrix.target }}
target: ${{ matrix.target }}
build_kernel: true
build_all_kmods: true
Expand Down
Loading