Skip to content

Commit

Permalink
* Package everything in build-all.yaml
Browse files Browse the repository at this point in the history
* Update tool to work with the new artifacts directory structure
* Release artifacts can just be dropped and added to the path as a whole, no need for a first update step
* Add --tarball option to orca update. This allows testing installs from CI artifacts without making a release
  • Loading branch information
martinfouilleul committed Mar 14, 2024
1 parent 65e2d44 commit 0955cfd
Show file tree
Hide file tree
Showing 5 changed files with 184 additions and 145 deletions.
65 changes: 29 additions & 36 deletions .github/workflows/build-all.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,14 @@ name: build-all

on:
workflow_call:
inputs:
version:
type: string
required: false
push:
branches:
- main
- webgpu-canvas

jobs:
build-dawn-mac:
Expand Down Expand Up @@ -41,13 +46,17 @@ jobs:
- name: Package
shell: cmd
run: |
orcadev.bat package-sdk orca-sdk-windows || exit 1
tar --format=ustar -czf orca-sdk-windows.tar.gz orca-sdk-windows
if [${{ inputs.version }}]==[] (
orcadev.bat install orca || exit 1
) else (
orcadev.bat install --version ${{ inputs.version }} orca || exit 1
)
tar --format=ustar -czf orca-windows.tar.gz orca
- uses: actions/upload-artifact@v4
with:
name: orca-sdk-windows
path: orca-sdk-windows.tar.gz
name: orca-windows
path: orca-windows.tar.gz

build-macos-x64:
needs: [build-dawn-mac]
Expand All @@ -74,13 +83,17 @@ jobs:
- name: Package
run: |
./orcadev package-sdk orca-sdk-mac-x64
tar --format=ustar -czf orca-sdk-mac-x64.tar.gz orca-sdk-mac-x64
if [ ${{ inputs.version }} != '' ] ; then
./orcadev install --version ${{ inputs.version }} orca
else
./orcadev install orca
fi
tar --format=ustar -czf orca-mac-x64.tar.gz orca
- uses: actions/upload-artifact@v4
with:
name: orca-sdk-mac-x64
path: orca-sdk-mac-x64.tar.gz
name: orca-mac-x64
path: orca-mac-x64.tar.gz

build-macos-arm64:
needs: [build-dawn-mac]
Expand All @@ -107,34 +120,14 @@ jobs:
- name: Package
run: |
./orcadev package-sdk orca-sdk-mac-arm64
tar --format=ustar -czf orca-sdk-mac-arm64.tar.gz orca-sdk-mac-arm64
if [ ${{ inputs.version }} != '' ] ; then
./orcadev install --version ${{ inputs.version }} orca
else
./orcadev install orca
fi
tar --format=ustar -czf orca-mac-arm64.tar.gz orca
- uses: actions/upload-artifact@v4
with:
name: orca-sdk-mac-arm64
path: orca-sdk-mac-arm64.tar.gz

mac-make-universal:
runs-on: macos-latest
needs: [build-macos-x64, build-macos-arm64]
steps:
- uses: actions/download-artifact@v4
with:
path: artifacts
merge-multiple: true

- name: Make universal binary
run: |
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: |
tar --format=ustar -czf orca-mac.tar.gz orca
- uses: actions/upload-artifact@v4
with:
name: orca-mac
path: orca-mac.tar.gz
name: orca-mac-arm64
path: orca-mac-arm64.tar.gz
34 changes: 6 additions & 28 deletions .github/workflows/create-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ on:
jobs:
build-all:
uses: ./.github/workflows/build-all.yaml
with:
version: ${{ github.ref_name }}

release:
runs-on: ubuntu-latest
Expand All @@ -20,36 +22,12 @@ jobs:
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
- name: Copy
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
cp artifacts/orca-windows.tar.gz releases
cp artifacts/orca-mac-x64.tar.gz releases
cp artifacts/orca-mac-arm64.tar.gz releases
- uses: ncipollo/release-action@v1
with:
Expand Down
20 changes: 18 additions & 2 deletions scripts/dev.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
from .log import *
from .utils import pushd, removeall, yeetdir, yeetfile
from .embed_text_files import *
from .version import orca_version

ANGLE_VERSION = "2023-07-05"
MAC_SDK_DIR = "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk"
Expand Down Expand Up @@ -61,6 +60,7 @@ def attach_dev_commands(subparsers):
package_cmd.set_defaults(func=dev_shellish(package_sdk))

install_cmd = subparsers.add_parser("install", help="Install a dev build of the Orca tools into the system Orca directory.")
install_cmd.add_argument("--version")
install_cmd.add_argument("install_dir", nargs='?')
install_cmd.set_defaults(func=dev_shellish(install))

Expand Down Expand Up @@ -1110,7 +1110,7 @@ def install(args):
print()

orca_dir = system_orca_dir() if args.install_dir == None else args.install_dir
version = orca_version()
version = f"dev-{orca_commit()}" if args.version == None else args.version
dest = os.path.join(orca_dir, version)

print(f"Installing dev build of Orca in {dest}")
Expand Down Expand Up @@ -1341,6 +1341,22 @@ def get_source_root():
dir = newdir


def src_dir():
# Fragile path adjustments! Yay!
return os.path.normpath(os.path.join(os.path.abspath(__file__), "../../src"))


def orca_commit():
with pushd(src_dir()):
try:
res = subprocess.run(["git", "rev-parse", "--short", "HEAD"], check=True, capture_output=True, text=True)
commit = res.stdout.strip()
return commit
except subprocess.CalledProcessError:
log_warning("failed to look up current git hash")
return "unknown"


def yeet(path):
os.makedirs(path, exist_ok=True)
shutil.rmtree(path)
16 changes: 0 additions & 16 deletions scripts/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,3 @@

from .log import *
from .utils import pushd


def src_dir():
# Fragile path adjustments! Yay!
return os.path.normpath(os.path.join(os.path.abspath(__file__), "../../src"))


def orca_version():
with pushd(src_dir()):
try:
res = subprocess.run(["git", "rev-parse", "--short", "HEAD"], check=True, capture_output=True, text=True)
version = res.stdout.strip()
return f"dev-{version}"
except subprocess.CalledProcessError:
log_warning("failed to look up current git hash for version number")
return "dev-unknown"
Loading

0 comments on commit 0955cfd

Please sign in to comment.