aboutsummaryrefslogtreecommitdiffstats
path: root/.github/workflows/tools.yml
blob: b315346ed6f8d8cced13cd764db45e3d302bdcb5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
name: Build host tools

on:
  pull_request:
    paths:
      - 'tools/**'
      - '.github/workflows/build-tools.yml'
      - '.github/workflows/tools.yml'
  push:
    paths:
      - 'tools/**'
      - '.github/workflows/build-tools.yml'
      - '.github/workflows/tools.yml'

permissions:
  contents: read

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

jobs:
  build-macos-latest:
    name: Build tools with macos latest
    runs-on: macos-latest

    steps:
      - name: Checkout
        uses: actions/checkout@v3
        with:
          path: openwrt

      - name: Setup MacOS
        run: |
          echo "WORKPATH=/Volumes/OpenWrt" >> "$GITHUB_ENV"
          hdiutil create -size 20g -type SPARSE -fs "Case-sensitive HFS+" -volname OpenWrt OpenWrt.sparseimage
          hdiutil attach OpenWrt.sparseimage
          mv "$GITHUB_WORKSPACE/openwrt" /Volumes/OpenWrt/

      - name: Install required prereq on MacOS
        working-directory: ${{ env.WORKPATH }}/openwrt
        run: |
          brew install \
            automake \
            coreutils \
            diffutils \
            findutils \
            gawk \
            git-extras \
            gnu-sed \
            grep \
            make

            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
        working-directory: ${{ env.WORKPATH }}/openwrt
        run: make defconfig

      - 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()
        uses: actions/upload-artifact@v3
        with:
          name: macos-latest-logs
          path: ${{ env.WORKPATH }}/openwrt/logs

      - name: Upload config
        if: always()
        uses: actions/upload-artifact@v3
        with:
          name: macos-latest-config
          path: ${{ env.WORKPATH }}/openwrt/.config

  build-linux-buildbot:
    name: Build tools with buildbot container
    uses: ./.github/workflows/build-tools.yml