2022-02-25 11:28:46 +00:00
|
|
|
name: Build host tools
|
|
|
|
|
|
|
|
on:
|
|
|
|
pull_request:
|
|
|
|
paths:
|
|
|
|
- 'tools/**'
|
2022-03-30 00:43:17 +00:00
|
|
|
- '.github/workflows/tools.yml'
|
2022-08-08 21:37:54 +00:00
|
|
|
push:
|
|
|
|
paths:
|
|
|
|
- 'tools/**'
|
|
|
|
- '.github/workflows/tools.yml'
|
2022-02-25 11:28:46 +00:00
|
|
|
|
2022-09-19 10:20:37 +00:00
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
|
2022-02-25 11:28:46 +00:00
|
|
|
jobs:
|
2022-03-20 20:02:08 +00:00
|
|
|
build-macos-latest:
|
2022-08-08 21:37:54 +00:00
|
|
|
if: github.event_name != 'push'
|
2022-03-20 20:02:08 +00:00
|
|
|
runs-on: macos-latest
|
|
|
|
|
2022-02-25 11:28:46 +00:00
|
|
|
steps:
|
|
|
|
- name: Checkout
|
2022-10-12 13:24:11 +00:00
|
|
|
uses: actions/checkout@v3
|
2022-02-25 11:28:46 +00:00
|
|
|
with:
|
|
|
|
path: openwrt
|
|
|
|
|
|
|
|
- name: Setup MacOS
|
|
|
|
run: |
|
2022-03-20 20:02:08 +00:00
|
|
|
echo "WORKPATH=/Volumes/OpenWrt" >> "$GITHUB_ENV"
|
2022-02-25 11:28:46 +00:00
|
|
|
hdiutil create -size 20g -type SPARSE -fs "Case-sensitive HFS+" -volname OpenWrt OpenWrt.sparseimage
|
|
|
|
hdiutil attach OpenWrt.sparseimage
|
|
|
|
mv "$GITHUB_WORKSPACE/openwrt" /Volumes/OpenWrt/
|
|
|
|
|
2022-03-20 20:02:08 +00:00
|
|
|
- name: Install required prereq on MacOS
|
|
|
|
working-directory: ${{ env.WORKPATH }}/openwrt
|
|
|
|
run: |
|
2022-02-25 11:28:46 +00:00
|
|
|
brew install \
|
|
|
|
autoconf \
|
|
|
|
automake \
|
|
|
|
coreutils \
|
|
|
|
diffutils \
|
|
|
|
findutils \
|
|
|
|
gawk \
|
|
|
|
gettext \
|
|
|
|
git-extras \
|
|
|
|
gmp \
|
|
|
|
gnu-getopt \
|
|
|
|
gnu-sed \
|
|
|
|
gnu-tar \
|
|
|
|
grep \
|
|
|
|
libidn2 \
|
|
|
|
libunistring \
|
|
|
|
m4 \
|
|
|
|
make \
|
|
|
|
mpfr \
|
|
|
|
ncurses \
|
|
|
|
openssl@1.1 \
|
|
|
|
pcre \
|
|
|
|
pkg-config \
|
|
|
|
quilt \
|
|
|
|
readline \
|
|
|
|
wget \
|
|
|
|
zstd
|
|
|
|
|
|
|
|
echo "/bin" >> "$GITHUB_PATH"
|
|
|
|
echo "/sbin/Library/Apple/usr/bin" >> "$GITHUB_PATH"
|
|
|
|
echo "/usr/bin" >> "$GITHUB_PATH"
|
|
|
|
echo "/usr/local/bin" >> "$GITHUB_PATH"
|
|
|
|
echo "/usr/local/opt/coreutils/bin" >> "$GITHUB_PATH"
|
|
|
|
echo "/usr/local/opt/findutils/libexec/gnubin" >> "$GITHUB_PATH"
|
|
|
|
echo "/usr/local/opt/gettext/bin" >> "$GITHUB_PATH"
|
|
|
|
echo "/usr/local/opt/gnu-getopt/bin" >> "$GITHUB_PATH"
|
|
|
|
echo "/usr/local/opt/make/libexec/gnubin" >> "$GITHUB_PATH"
|
|
|
|
echo "/usr/local/opt/make/libexec/gnubin" >> "$GITHUB_PATH"
|
|
|
|
echo "/usr/sbin" >> "$GITHUB_PATH"
|
|
|
|
|
|
|
|
- name: Make prereq
|
2022-03-20 20:02:08 +00:00
|
|
|
working-directory: ${{ env.WORKPATH }}/openwrt
|
|
|
|
run: make defconfig
|
2022-02-25 11:28:46 +00:00
|
|
|
|
2022-03-20 20:02:08 +00:00
|
|
|
- name: Build tools MacOS
|
|
|
|
working-directory: ${{ env.WORKPATH }}/openwrt
|
|
|
|
run: make tools/install -j$(nproc) BUILD_LOG=1 || ret=$? .github/workflows/scripts/show_build_failures.sh
|
|
|
|
|
|
|
|
- name: Upload logs
|
|
|
|
if: always()
|
2022-10-12 14:48:46 +00:00
|
|
|
uses: actions/upload-artifact@v3
|
2022-03-20 20:02:08 +00:00
|
|
|
with:
|
|
|
|
name: macos-latest-logs
|
|
|
|
path: ${{ env.WORKPATH }}/openwrt/logs
|
2022-02-25 11:28:46 +00:00
|
|
|
|
2022-03-20 20:02:08 +00:00
|
|
|
- name: Upload config
|
2022-03-30 00:43:17 +00:00
|
|
|
if: always()
|
2022-10-12 14:48:46 +00:00
|
|
|
uses: actions/upload-artifact@v3
|
2022-03-20 20:02:08 +00:00
|
|
|
with:
|
|
|
|
name: macos-latest-config
|
|
|
|
path: ${{ env.WORKPATH }}/openwrt/.config
|
|
|
|
|
|
|
|
build-linux-buildbot:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
container: registry.gitlab.com/openwrt/buildbot/buildworker-3.4.1
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: Checkout
|
2022-10-12 13:24:11 +00:00
|
|
|
uses: actions/checkout@v3
|
2022-03-20 20:02:08 +00:00
|
|
|
with:
|
|
|
|
path: 'openwrt'
|
|
|
|
|
|
|
|
- name: Fix permission
|
2022-03-09 12:30:21 +00:00
|
|
|
run: |
|
2022-03-20 20:02:08 +00:00
|
|
|
chown -R buildbot:buildbot openwrt
|
|
|
|
|
2022-10-04 16:38:57 +00:00
|
|
|
- name: Set configs for tools container
|
2022-08-08 21:37:54 +00:00
|
|
|
if: github.event_name == 'push'
|
|
|
|
shell: su buildbot -c "sh -e {0}"
|
|
|
|
working-directory: openwrt
|
|
|
|
run: |
|
|
|
|
touch .config
|
|
|
|
echo CONFIG_DEVEL=y >> .config
|
|
|
|
echo CONFIG_AUTOREMOVE=y >> .config
|
2022-10-04 16:38:57 +00:00
|
|
|
echo CONFIG_CCACHE=y >> .config
|
2022-08-08 21:37:54 +00:00
|
|
|
|
2022-03-20 20:02:08 +00:00
|
|
|
- name: Make prereq
|
|
|
|
shell: su buildbot -c "sh -e {0}"
|
|
|
|
working-directory: openwrt
|
|
|
|
run: make defconfig
|
2022-03-30 00:43:17 +00:00
|
|
|
|
2022-03-20 20:02:08 +00:00
|
|
|
- name: Build tools BuildBot Container
|
|
|
|
shell: su buildbot -c "sh -e {0}"
|
|
|
|
working-directory: openwrt
|
|
|
|
run: make tools/install -j$(nproc) BUILD_LOG=1 || ret=$? .github/workflows/scripts/show_build_failures.sh
|
2022-03-09 12:30:21 +00:00
|
|
|
|
2022-02-25 11:28:46 +00:00
|
|
|
- name: Upload logs
|
2022-03-30 00:43:17 +00:00
|
|
|
if: always()
|
2022-10-12 14:48:46 +00:00
|
|
|
uses: actions/upload-artifact@v3
|
2022-02-25 11:28:46 +00:00
|
|
|
with:
|
2022-03-20 20:02:08 +00:00
|
|
|
name: linux-buildbot-logs
|
|
|
|
path: openwrt/logs
|
2022-03-30 00:43:17 +00:00
|
|
|
|
|
|
|
- name: Upload config
|
|
|
|
if: always()
|
2022-10-12 14:48:46 +00:00
|
|
|
uses: actions/upload-artifact@v3
|
2022-03-30 00:43:17 +00:00
|
|
|
with:
|
2022-03-20 20:02:08 +00:00
|
|
|
name: linux-buildbot-config
|
|
|
|
path: openwrt/.config
|
2022-08-08 21:37:54 +00:00
|
|
|
|
|
|
|
- name: Archive prebuilt tools
|
|
|
|
if: github.event_name == 'push'
|
|
|
|
shell: su buildbot -c "sh -e {0}"
|
|
|
|
working-directory: openwrt
|
|
|
|
run: tar --mtime=now -cf tools.tar staging_dir/host build_dir/host dl
|
|
|
|
|
|
|
|
- name: Upload prebuilt tools
|
|
|
|
if: github.event_name == 'push'
|
2022-10-12 14:48:46 +00:00
|
|
|
uses: actions/upload-artifact@v3
|
2022-08-08 21:37:54 +00:00
|
|
|
with:
|
|
|
|
name: linux-buildbot-prebuilt-tools
|
|
|
|
path: openwrt/tools.tar
|
|
|
|
retention-days: 1
|
|
|
|
|
|
|
|
push-tools-container:
|
|
|
|
needs: build-linux-buildbot
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
if: github.event_name == 'push'
|
|
|
|
|
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
packages: write
|
|
|
|
|
|
|
|
steps:
|
2022-10-03 11:39:58 +00:00
|
|
|
- name: Set lower case owner name
|
|
|
|
env:
|
|
|
|
OWNER: ${{ github.repository_owner }}
|
|
|
|
run: |
|
|
|
|
echo "OWNER_LC=${OWNER,,}" >> "$GITHUB_ENV"
|
|
|
|
|
2022-08-08 21:37:54 +00:00
|
|
|
- name: Checkout
|
2022-10-12 13:24:11 +00:00
|
|
|
uses: actions/checkout@v3
|
2022-08-08 21:37:54 +00:00
|
|
|
with:
|
|
|
|
path: 'openwrt'
|
|
|
|
|
|
|
|
- name: Download prebuilt tools from build job
|
2022-10-12 14:48:46 +00:00
|
|
|
uses: actions/download-artifact@v3
|
2022-08-08 21:37:54 +00:00
|
|
|
with:
|
|
|
|
name: linux-buildbot-prebuilt-tools
|
|
|
|
path: openwrt
|
|
|
|
|
|
|
|
- name: Login to GitHub Container Registry
|
|
|
|
uses: docker/login-action@v2
|
|
|
|
with:
|
|
|
|
registry: ghcr.io
|
|
|
|
username: ${{ github.actor }}
|
|
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
|
|
|
|
- name: Build and push
|
|
|
|
uses: docker/build-push-action@v3
|
|
|
|
with:
|
|
|
|
context: openwrt
|
|
|
|
push: true
|
2022-10-03 11:39:58 +00:00
|
|
|
tags: ghcr.io/${{ env.OWNER_LC }}/tools:latest
|
2022-08-08 21:37:54 +00:00
|
|
|
file: openwrt/.github/workflows/Dockerfile.tools
|