Skip to content

Commit

Permalink
* combined m1/intel mac build-dawn
Browse files Browse the repository at this point in the history
* fix caching
* fix mac runners parameter expansion
* simplify manual delivery of artifacts
* avoid copying everything in source when packaging SDK
* fix exec bits and make sdk accessible from build-all workflow
  • Loading branch information
martinfouilleul committed Mar 14, 2024
1 parent 118f660 commit 65e2d44
Show file tree
Hide file tree
Showing 7 changed files with 274 additions and 169 deletions.
68 changes: 54 additions & 14 deletions .github/workflows/build-all.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,74 +7,113 @@ on:
- main

jobs:
build-dawn-mac:
uses: ./.github/workflows/build-dawn-mac.yaml

build-dawn-win:
uses: ./.github/workflows/build-dawn-win.yaml

build-win:
needs: [build-dawn-win]
runs-on: windows-2022
steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v4
with:
python-version: '3.10'

- uses: actions/checkout@v4

- uses: actions/download-artifact@v4
with:
path: artifact

- name: Copy Dawn
shell: cmd
run: |
xcopy artifact\dawn-windows-x64 build\dawn.out\ /s /y
- name: Build
shell: cmd
run: |
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
orcadev.bat build --release --version ${{github.ref_name}}
orcadev.bat build --release --version ${{github.ref_name}} || exit 1
- name: Package
shell: cmd
run: |
orcadev.bat package-sdk orca-sdk-windows
orcadev.bat package-sdk orca-sdk-windows || exit 1
tar --format=ustar -czf orca-sdk-windows.tar.gz orca-sdk-windows
- uses: actions/upload-artifact@v4
with:
name: orca-sdk-windows
path: orca-sdk-windows
path: orca-sdk-windows.tar.gz

build-macos-x64:
needs: [build-dawn-mac]
runs-on: macos-13
steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v4
with:
python-version: '3.10'

- uses: actions/checkout@v4

- uses: actions/download-artifact@v4
with:
path: artifact

- name: Copy Dawn
run: |
mkdir -p build
cp -r artifact/dawn-mac-x64 build/dawn.out
- name: Build
run: |
./orcadev build --release --version ${{github.ref_name}}
- name: Package
run: |
./orcadev package-sdk orca-sdk-mac-x64
tar --format=ustar -czf orca-sdk-mac-x64.tar.gz orca-sdk-mac-x64
- uses: actions/upload-artifact@v4
with:
name: orca-sdk-mac-x64
path: orca-sdk-mac-x64
path: orca-sdk-mac-x64.tar.gz

build-macos-arm64:
needs: [build-dawn-mac]
runs-on: macos-14
steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v4
with:
python-version: '3.10'

- uses: actions/checkout@v4

- uses: actions/download-artifact@v4
with:
path: artifact

- name: Copy Dawn
run: |
mkdir -p build
cp -r artifact/dawn-mac-arm64 build/dawn.out
- name: Build
run: |
./orcadev build --release --version ${{github.ref_name}}
- name: Package
run: |
./orcadev package-sdk orca-sdk-mac-arm64
tar --format=ustar -czf orca-sdk-mac-arm64.tar.gz orca-sdk-mac-arm64
- uses: actions/upload-artifact@v4
with:
name: orca-sdk-mac-arm64
path: orca-sdk-mac-arm64
path: orca-sdk-mac-arm64.tar.gz

mac-make-universal:
runs-on: macos-latest
Expand All @@ -83,12 +122,13 @@ jobs:
- uses: actions/download-artifact@v4
with:
path: artifacts
merge-multiple: true

- name: Make universal binary
run: |
chmod +x artifacts/orca-sdk-mac-x64/bin/orca
chmod +x artifacts/orca-sdk-mac-arm64/bin/orca
lipo -create artifacts/orca-sdk-mac-x64/bin/orca artifacts/orca-sdk-mac-arm64/bin/orca -output orca
tar -xzf artifacts/orca-sdk-mac-x64.tar.gz
tar -xzf artifacts/orca-sdk-mac-arm64.tar.gz
lipo -create orca-sdk-mac-x64/bin/orca orca-sdk-mac-arm64/bin/orca -output orca
- name: Tar
run: |
Expand Down
42 changes: 42 additions & 0 deletions .github/workflows/build-dawn-mac.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: build-dawn-mac

on:
workflow_dispatch:
workflow_call:

jobs:
build-mac:
strategy:
matrix:
os: [macos-13, macos-14]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v4
with:
python-version: '3.10'

- name: Dawn version
id: dawn-version
run: |
echo "DAWN_COMMIT=$(cat deps/dawn-commit.txt)" >> $GITHUB_OUTPUT
ARCH=${{ runner.arch }}
echo "LOWERCASE_ARCH=$(echo $ARCH | tr '[:upper:]' '[:lower:]')" >> $GITHUB_OUTPUT
- name: Cache
id: cache-dawn
uses: actions/cache@v3
with:
path: build/dawn.out
key: dawn-${{ runner.os }}-${{ runner.arch }}-${{ steps.dawn-version.outputs.DAWN_COMMIT }}

- name: Build Dawn
if: steps.cache-dawn.outputs.cache-hit != 'true'
run: |
./orcadev build-dawn --release --parallel 4
- uses: actions/upload-artifact@v4
with:
name: dawn-mac-${{steps.dawn-version.outputs.LOWERCASE_ARCH}}
path: build/dawn.out
41 changes: 41 additions & 0 deletions .github/workflows/build-dawn-win.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: build-dawn-win

on:
workflow_dispatch:
workflow_call:

jobs:
build-win:
runs-on: windows-2022
steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v4
with:
python-version: '3.10'

- name: Dawn version
id: dawn-version
shell: cmd
run: |
@chcp 65001>nul
set /p DAWN_COMMIT=<deps/dawn-commit.txt
echo DAWN_COMMIT=%DAWN_COMMIT% >> %GITHUB_OUTPUT%
- name: Cache
id: cache-dawn
uses: actions/cache@v3
with:
path: build/dawn.out
key: dawn-${{ runner.os }}-${{ runner.arch }}-${{ steps.dawn-version.outputs.DAWN_COMMIT }}

- name: Build Dawn
if: steps.cache-dawn.outputs.cache-hit != 'true'
shell: cmd
run: |
orcadev build-dawn --release --parallel 4
- uses: actions/upload-artifact@v4
with:
name: dawn-windows-x64
path: build/dawn.out
74 changes: 0 additions & 74 deletions .github/workflows/build-dawn.yaml

This file was deleted.

81 changes: 45 additions & 36 deletions .github/workflows/create-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,39 +9,48 @@ jobs:
uses: ./.github/workflows/build-all.yaml

release:
runs-on: ubuntu-latest
permissions:
contents: write
needs: [build-all]
steps:
- uses: actions/download-artifact@v4
with:
# when name is not specified, all artifacts from this run will be downloaded
path: artifacts

- name: Package CLI Tool
run: |
mkdir releases
cp artifacts/orca-sdk-windows/bin/orca.exe releases
cp artifacts/orca-mac/orca-mac.tar.gz releases
- name: Package Windows SDK
run: |
find orca-sdk-windows -type f -exec sha1sum {} + | LC_ALL=C sort | sha1sum | cut -z -f 1 -d " " > artifacts/sha1.sum
tar --format=ustar -czf releases/orca-sdk-windows.tar.gz -C artifacts orca-sdk-windows sha1.sum
- name: Package Mac x64 Release
run: |
chmod +x artifacts/orca-sdk-mac-x64/bin/orca
find orca-sdk-mac-x64 -type f -exec sha1sum {} + | LC_ALL=C sort | sha1sum | cut -z -f 1 -d " " > artifacts/sha1.sum
tar --format=ustar -czf releases/orca-sdk-mac-x64.tar.gz -C artifacts orca-sdk-mac-x64 sha1.sum
- name: Package Mac arm64 Release
run: |
chmod +x artifacts/orca-sdk-mac-arm64/bin/orca
find orca-sdk-mac-arm64 -type f -exec sha1sum {} + | LC_ALL=C sort | sha1sum | cut -z -f 1 -d " " > artifacts/sha1.sum
tar --format=ustar -czf releases/orca-sdk-mac-arm64.tar.gz -C artifacts orca-sdk-mac-arm64 sha1.sum
- uses: ncipollo/release-action@v1
with:
artifacts: "releases/*"
runs-on: ubuntu-latest
permissions:
contents: write
needs: [build-all]
steps:
- uses: actions/download-artifact@v4
with:
# when name is not specified, all artifacts from this run will be downloaded
path: artifacts
merge-multiple: true

- name: Untar
run: |
tar -xzf artifacts/orca-sdk-windows.tar.gz
tar -xzf artifacts/orca-sdk-mac-x64.tar.gz
tar -xzf artifacts/orca-sdk-mac-arm64.tar.gz
- name: Package CLI Tool
run: |
mkdir releases
cp orca-sdk-windows/bin/orca.exe releases
cp orca-mac.tar.gz releases
- name: Package Windows SDK
run: |
find orca-sdk-windows -type f -exec sha1sum {} + | LC_ALL=C sort | sha1sum | cut -z -f 1 -d " " > sha1.sum
tar --format=ustar -czf releases/orca-sdk-windows.tar.gz orca-sdk-windows sha1.sum
- name: Package Mac x64 Release
run: |
chmod +x orca-sdk-mac-x64/bin/orca
chmod +x orca-sdk-mac-x64/bin/orca_runtime
find orca-sdk-mac-x64 -type f -exec sha1sum {} + | LC_ALL=C sort | sha1sum | cut -z -f 1 -d " " > sha1.sum
tar --format=ustar -czf releases/orca-sdk-mac-x64.tar.gz orca-sdk-mac-x64 sha1.sum
- name: Package Mac arm64 Release
run: |
chmod +x orca-sdk-mac-arm64/bin/orca
chmod +x orca-sdk-mac-arm64/bin/orca_runtime
find orca-sdk-mac-arm64 -type f -exec sha1sum {} + | LC_ALL=C sort | sha1sum | cut -z -f 1 -d " " > sha1.sum
tar --format=ustar -czf releases/orca-sdk-mac-arm64.tar.gz orca-sdk-mac-arm64 sha1.sum
- uses: ncipollo/release-action@v1
with:
artifacts: "releases/*"
Loading

0 comments on commit 65e2d44

Please sign in to comment.