mach-sys 0.5.4

forked from original mach, and merge from mach2/machx. A Rust interface to the user-space API of the Mach 3.0 kernel that underlies OSX.
Documentation
name: Build

on:
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]

env:
  CARGO_TERM_COLOR: always

jobs:
  cross_compile_xcode_simulator:
    needs: amd64-mac
    runs-on: macos-12

    strategy:
      fail-fast: false
      matrix:
        target:
          - aarch64-apple-ios
          - aarch64-apple-darwin
          - aarch64-apple-ios-sim
          - x86_64-apple-ios

    steps:
      - uses: actions/checkout@v4
        #with:
        #  submodules: true

      - uses: maxim-lobanov/setup-xcode@v1
        with:
          xcode-version: '14.2.0'

      - name: Create binary directory for this job
        run: |
          git config --global user.name github-actions && git config --global user.email github-actions@github.com
          git switch --orphan bin && git pull origin bin
          git switch bin
          mkdir bin/$(git log -1 --format="%cd" --date=format:"%Y-%m-%d_%H-%M-%S" ${{github.sha}})__${{github.sha}}/ || echo "use found bin dir"
          git switch master
          git reset --hard ${{github.sha}}

      - name: cross-compile test
        run: |
          export TARGET=${{matrix.target}}
          export RUST_VERSION=nightly
          export NOCTEST=1
          export NORUN=1

          ./tomake.sh ci

      - uses: actions/upload-artifact@v3
        with:
          name: lib-mach-sys.amd64-mac.zip
          path: target/${{matrix.target}}/release/libmach*

      - name: Upload binary of amd64 mac
        run: |
          git switch bin
          git pull origin bin
          cp -v target/${{matrix.target}}/release/libmach* bin/$(git log -1 --format="%cd" --date=format:"%Y-%m-%d_%H-%M-%S" ${{github.sha}})__${{github.sha}}/amd64-mac/
          git add -A
          git commit -m "[${{github.sha}}] upload ${{matrix.target}} of mach-sys library"
          git push origin bin
          git switch master
          git reset --hard ${{github.sha}}

  amd64-mac:
    runs-on: macos-12
    steps:
      - uses: actions/checkout@v4
        #with:
        #  submodules: true

      - name: Create binary directory for this job
        run: |
          git config --global user.name github-actions && git config --global user.email github-actions@github.com
          git switch --orphan bin && git pull origin bin
          git switch bin
          mkdir -p bin/$(git log -1 --format="%cd" --date=format:"%Y-%m-%d_%H-%M-%S" ${{github.sha}})__${{github.sha}}/amd64-mac/ || echo "use found bin dir"

          git switch master
          git reset --hard ${{github.sha}}
      
      - name: Build (mac)
        run: ./tomake.sh

      - uses: actions/upload-artifact@v3
        with:
          name: lib-mach-sys.amd64-mac.zip
          path: target/release/libmach*

      - name: Upload binary of amd64 mac
        run: |
          git switch bin
          git pull origin bin
          cp -v target/release/libmach* bin/$(git log -1 --format="%cd" --date=format:"%Y-%m-%d_%H-%M-%S" ${{github.sha}})__${{github.sha}}/amd64-mac/
          git add -A
          git commit -m "[${{github.sha}}] upload amd64-mac of mach-sys library"
          git push origin bin
          git switch master
          git reset --hard ${{github.sha}}

      - name: Run tests
        run: |
          ./tomake.sh test