From e6d9d072d81b93bf38d7de4bebab7ea094947035 Mon Sep 17 00:00:00 2001 From: Ahmad Khalifa Date: Wed, 13 Nov 2024 19:48:40 +0200 Subject: [PATCH] Again --- .github/workflows/cross-bootstrap-tools.yml | 113 ++++++++++++++------ 1 file changed, 81 insertions(+), 32 deletions(-) diff --git a/.github/workflows/cross-bootstrap-tools.yml b/.github/workflows/cross-bootstrap-tools.yml index ddb543dc3b068..2a74ca8debe75 100644 --- a/.github/workflows/cross-bootstrap-tools.yml +++ b/.github/workflows/cross-bootstrap-tools.yml @@ -6,64 +6,104 @@ on: branches: [ main, 'stable/14', 'stable/13' ] paths: - 'sys/**' - - 'stand/**' - - 'bin/**' - - 'sbin/**' - - 'usr.bin/**' - - 'usr.sbin/**' - - # XXX What to build here? - 'Makefile' - 'Makefile.inc1' - '**/cross-bootstrap-tools.yml' - - - '!**.[1-9]' # Ignore manpages pull_request: branches: [ main ] paths: - 'sys/**' - - 'stand/**' - - 'bin/**' - - 'sbin/**' - - 'usr.bin/**' - - 'usr.sbin/**' - - # XXX What to build here? - 'Makefile' - 'Makefile.inc1' - '**/cross-bootstrap-tools.yml' - - - '!**.[1-9]' # Ignore manpages workflow_dispatch: permissions: contents: read jobs: - modified_files: - name: get modified files + setup: + name: setup runs-on: ubuntu-latest outputs: - changes: ${{ steps.changes.outputs.files }} + kern_archs: ${{ steps.match.outputs.kern_archs }} + world_archs: ${{ steps.match.outputs.world_archs }} + make_targets: ${{ steps.match.outputs.make_targets }} steps: - - uses: actions/checkout@v4 - - name: get modified files - id: changes + - name: checkout + uses: actions/checkout@v4 + - name: paths filter (kernel) + uses: dorny/paths-filter@v3 + id: kern_filter + with: + base: ${{ github.ref_name }} + filters: | + amd64: + - 'sys/amd64/**' + i386: + - 'sys/i386/**' + aarch64: + - 'sys/arm64/**' + armv7: + - 'sys/arm/**' + powerpc: &ppc + - 'sys/powerpc/**' + powerpc64: + - *ppc + powerpc64le: + - *ppc + riscv64: + - 'sys/riscv/**' + all: + - '**/cross-bootstrap-tools.yml' + - name: paths filter (world) + uses: dorny/paths-filter@v3 + id: world_filter + with: + base: ${{ github.ref_name }} + filters: | + all: + - '**/cross-bootstrap-tools.yml' + - name: match paths + id: match run: | - echo "files=$(git diff --name-only --diff-filter=ACMRT ${{ github.event.push.before }} ${{ github.sha }} | xargs)" - echo "files=$(git diff --name-only --diff-filter=ACMRT ${{ github.event.push.before }} ${{ github.sha }} | xargs)" >> $GITHUB_OUTPUT + all='["amd64", "armv7", "aarch64", "i386", "powerpc", "powerpc64", "powerpc64le", "riscv64"]' + + echo ${{ join(steps.kern_filter.outputs.*_count,) }} + exit 1 + + if ${{ steps.kern_filter.outputs.all_count }} -gt 0; then + make_targets="buildkernel" + if ${{ steps.kern_filter.outputs.all }}; then + echo "kern_archs=$all" | tee "$GITHUB_OUTPUT" + else + echo "kern_archs=${{ steps.kern_filter.outputs.changes }}" | tee "$GITHUB_OUTPUT" + fi + fi + + if ${{ steps.world_filter.outputs.all_count }} -gt 0; then + make_targets="$make_targets buildworld" + if ${{ steps.world_filter.outputs.all }}; then + echo "world_archs=$all" | tee "$GITHUB_OUTPUT" + else + echo "world_archs=${{ steps.world_filter.outputs.changes }}" | tee "$GITHUB_OUTPUT" + fi + fi + + echo "make_targets=$make_targets" | tee "$GITHUB_OUTPUT" build: - name: ${{ matrix.target_arch }} buildkernel on ${{ matrix.os }} (${{ matrix.compiler }}) + name: ${{ matrix.target_arch }} ${{ matrix.make_target }} on ${{ matrix.os }} (${{ matrix.compiler }}) runs-on: ${{ matrix.os }} - needs: modified_files + needs: setup strategy: fail-fast: false matrix: - target_arch: [ amd64, aarch64, powerpc ] + target_arch: ${{ fromJSON(needs.setup.outputs.kern_archs) }} + make_target: ${{ fromJSON(needs.setup.outputs.make_targets }} os: [ ubuntu-22.04, ubuntu-24.04, macos-latest ] include: # TODO: both Ubuntu and macOS have bmake packages, we should try them instead of bootstrapping our own copy. @@ -79,17 +119,26 @@ jobs: compiler: clang-18 cross-bindir: /opt/homebrew/opt/llvm@18/bin pkgs: bmake libarchive llvm@18 + + # Correspoding TARGET for TARGET_ARCH - target_arch: amd64 target: amd64 + - target_arch: armv7 + target: arm - target_arch: aarch64 target: arm64 + - target_arch: i386 + target: i386 - target_arch: powerpc target: powerpc + - target_arch: powerpc64 + target: powerpc + - target_arch: powerpc64le + target: powerpc + - target_arch: riscv64 + target: riscv steps: - uses: actions/checkout@v4 - - name: check modified files - run: | - echo ${{ needs.modified_files.outputs.changes }} && exit 1 - name: install packages (Ubuntu) if: runner.os == 'Linux' run: |