build.yml: MacOs Build Inplace (#7677)

* `build.yml`: MacOs Build Inplace

* Update build.yml
This commit is contained in:
Derek Bailey
2022-11-28 16:38:56 -08:00
committed by GitHub
parent 5d2d0b92b1
commit fcab80f1bb

View File

@@ -221,32 +221,31 @@ jobs:
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: cmake - name: cmake
run: cmake -G "Xcode" -DCMAKE_BUILD_TYPE=Release -DFLATBUFFERS_FLATC_EXECUTABLE=$(PWD)/_build/Release/flatc -DFLATBUFFERS_STRICT_MODE=ON . run: cmake -G "Xcode" -DCMAKE_BUILD_TYPE=Release -DFLATBUFFERS_STRICT_MODE=ON .
- name: build - name: build
# NOTE: we need this _build dir to not have xcodebuild's default ./build dir clash with the BUILD file. run: xcodebuild -toolchain clang -configuration Release -target flattests
run: xcodebuild -toolchain clang -configuration Release -target flattests SYMROOT=$(PWD)/_build
- name: check that the binary is x86_64 - name: check that the binary is x86_64
run: | run: |
info=$(file _build/Release/flatc) info=$(file Release/flatc)
echo $info echo $info
echo $info | grep "Mach-O 64-bit executable x86_64" echo $info | grep "Mach-O 64-bit executable x86_64"
- name: test - name: test
run: _build/Release/flattests run: Release/flattests
- name: make flatc executable - name: make flatc executable
run: | run: |
chmod +x _build/Release/flatc chmod +x Release/flatc
./_build/Release/flatc --version Release/flatc --version
- name: flatc tests - name: flatc tests
run: python3 tests/flatc/main.py --flatc ./_build/Release/flatc run: python3 tests/flatc/main.py --flatc Release/flatc
- name: upload build artifacts - name: upload build artifacts
uses: actions/upload-artifact@v1 uses: actions/upload-artifact@v1
with: with:
name: Mac flatc binary name: Mac flatc binary
path: _build/Release/flatc path: Release/flatc
# Below if only for release. # Below if only for release.
- name: Zip file - name: Zip file
if: startsWith(github.ref, 'refs/tags/') if: startsWith(github.ref, 'refs/tags/')
run: mv _build/Release/flatc . && zip MacIntel.flatc.binary.zip flatc run: mv Release/flatc . && zip MacIntel.flatc.binary.zip flatc
- name: Release binary - name: Release binary
uses: softprops/action-gh-release@v1 uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/') if: startsWith(github.ref, 'refs/tags/')
@@ -267,30 +266,29 @@ jobs:
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: cmake - name: cmake
run: cmake -G "Xcode" -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" -DCMAKE_BUILD_TYPE=Release -DFLATBUFFERS_FLATC_EXECUTABLE=$(PWD)/_build/Release/flatc -DFLATBUFFERS_STRICT_MODE=ON . run: cmake -G "Xcode" -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" -DCMAKE_BUILD_TYPE=Release -DFLATBUFFERS_STRICT_MODE=ON .
- name: build - name: build
# NOTE: we need this _build dir to not have xcodebuild's default ./build dir clash with the BUILD file. run: xcodebuild -toolchain clang -configuration Release -target flattests
run: xcodebuild -toolchain clang -configuration Release -target flattests SYMROOT=$(PWD)/_build
- name: check that the binary is "universal" - name: check that the binary is "universal"
run: | run: |
info=$(file _build/Release/flatc) info=$(file Release/flatc)
echo $info echo $info
echo $info | grep "Mach-O universal binary with 2 architectures" echo $info | grep "Mach-O universal binary with 2 architectures"
- name: test - name: test
run: _build/Release/flattests run: Release/flattests
- name: make flatc executable - name: make flatc executable
run: | run: |
chmod +x _build/Release/flatc chmod +x Release/flatc
./_build/Release/flatc --version Release/flatc --version
- name: upload build artifacts - name: upload build artifacts
uses: actions/upload-artifact@v1 uses: actions/upload-artifact@v1
with: with:
name: Mac flatc binary name: Mac flatc binary
path: _build/Release/flatc path: Release/flatc
# Below if only for release. # Below if only for release.
- name: Zip file - name: Zip file
if: startsWith(github.ref, 'refs/tags/') if: startsWith(github.ref, 'refs/tags/')
run: mv _build/Release/flatc . && zip Mac.flatc.binary.zip flatc run: mv Release/flatc . && zip Mac.flatc.binary.zip flatc
- name: Release binary - name: Release binary
uses: softprops/action-gh-release@v1 uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/') if: startsWith(github.ref, 'refs/tags/')