diff --git a/.github/workflows/Build.yml b/.github/workflows/Build.yml index 3d299b2..6e2daf8 100644 --- a/.github/workflows/Build.yml +++ b/.github/workflows/Build.yml @@ -3,17 +3,25 @@ on: branches: - 'build/*' tags: [ 'v*' ] + pull_request: + types: [ opened, synchronize, reopened, labeled ] workflow_dispatch: -name: Build x86_64 +name: Build ${{ matrix.os.arch }} jobs: build: name: Build - runs-on: macos-11 + if: ${{ github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'CI-build') }} + runs-on: ${{ matrix.os.name }} strategy: fail-fast: false matrix: + os: + - name: macos-11 + arch: x86_64 + - name: macos-14 + arch: aarch64 target: - x86_64-unknown-linux-gnu - x86_64-unknown-linux-musl @@ -56,21 +64,21 @@ jobs: run: | set -ex cd /Volumes/tools - tar czf ${{ matrix.target }}-x86_64-darwin.tar.gz ${{ matrix.target }} + tar czf ${{ matrix.target }}-${{ matrix.os.arch }}-darwin.tar.gz ${{ matrix.target }} cd - - mv /Volumes/tools/${{ matrix.target }}-x86_64-darwin.tar.gz . - sha256sum ${{ matrix.target }}-x86_64-darwin.tar.gz | tee ${{ matrix.target }}-x86_64-darwin.tar.gz.sha256 + mv /Volumes/tools/${{ matrix.target }}-${{ matrix.os.arch }}-darwin.tar.gz . + sha256sum ${{ matrix.target }}-${{ matrix.os.arch }}-darwin.tar.gz | tee ${{ matrix.target }}-${{ matrix.os.arch }}-darwin.tar.gz.sha256 - name: Upload Toolchain - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: - name: toolchains - path: ${{ matrix.target }}-x86_64-darwin.tar.gz + name: toolchain-${{ matrix.target }}-${{ matrix.os.arch }}-darwin + path: ${{ matrix.target }}-${{ matrix.os.arch }}-darwin.tar.gz if-no-files-found: error - name: Upload Toolchain to GitHub Release uses: svenstaro/upload-release-action@v2 if: "startsWith(github.ref, 'refs/tags/')" with: repo_token: ${{ secrets.GITHUB_TOKEN }} - file: ${{ matrix.target }}-x86_64-darwin.tar.gz* + file: ${{ matrix.target }}-${{ matrix.os.arch }}-darwin.tar.gz* file_glob: true tag: ${{ github.ref }} diff --git a/.github/workflows/aarch64.yml b/.github/workflows/aarch64.yml deleted file mode 100644 index 30d912c..0000000 --- a/.github/workflows/aarch64.yml +++ /dev/null @@ -1,83 +0,0 @@ -on: - push: - branches: - - 'build/*' - tags: ['v*'] - workflow_dispatch: - -name: Build aarch64 - -jobs: - build: - name: Build - runs-on: macos-14 - strategy: - fail-fast: false - matrix: - target: - - x86_64-unknown-linux-gnu - - x86_64-unknown-linux-musl - - i686-unknown-linux-gnu - - i686-unknown-linux-musl - - aarch64-unknown-linux-gnu - - aarch64-unknown-linux-musl - - armv7-unknown-linux-gnueabihf - - armv7-unknown-linux-musleabihf - - arm-unknown-linux-gnueabi - - arm-unknown-linux-gnueabihf - - arm-unknown-linux-musleabihf - - mipsel-unknown-linux-gnu - steps: - - uses: actions/checkout@v3 - - name: Install crosstool-ng - run: | - brew install coreutils crosstool-ng - python3 --version - - name: Mount volumes - run: | - set -ex - hdiutil create -type SPARSE -fs 'Case-sensitive Journaled HFS+' -size 16g -volname build build.dmg - hdiutil create -type SPARSE -fs 'Case-sensitive Journaled HFS+' -size 1g -volname tools tools.dmg - # Detach old if exists - hdiutil detach /Volumes/build -force | true - hdiutil detach /Volumes/tools -force | true - # Attach new - hdiutil attach build.dmg.sparseimage - hdiutil attach tools.dmg.sparseimage - ls /Volumes - - name: Build Toolchain - run: | - set -ex - mkdir /Volumes/build/src - cd ${{ matrix.target }} - MACOSX_DEPLOYMENT_TARGET=11.0 ct-ng build -j $(($(nproc) - 1)) - - name: Tail build.log on failure - if: ${{ failure() }} - run: tail -n 500 ${{ matrix.target }}/build.log - - name: Archive Toolchain - run: | - set -ex - cd /Volumes/tools - tar czf ${{ matrix.target }}-aarch64-darwin.tar.gz ${{ matrix.target }} - cd - - mv /Volumes/tools/${{ matrix.target }}-aarch64-darwin.tar.gz . - sha256sum ${{ matrix.target }}-aarch64-darwin.tar.gz | tee ${{ matrix.target }}-aarch64-darwin.tar.gz.sha256 - - name: Remove volumes - if: ${{ always() }} - run: | - hdiutil detach /Volumes/build -force | true - hdiutil detach /Volumes/tools -force | true - - name: Upload Toolchain - uses: actions/upload-artifact@v3 - with: - name: toolchains - path: ${{ matrix.target }}-aarch64-darwin.tar.gz - if-no-files-found: error - - name: Upload Toolchain to GitHub Release - uses: svenstaro/upload-release-action@v2 - if: "startsWith(github.ref, 'refs/tags/')" - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: ${{ matrix.target }}-aarch64-darwin.tar.gz* - file_glob: true - tag: ${{ github.ref }}