diff --git a/.github/workflows/sdk.yaml b/.github/workflows/sdk.yaml index b66a606dd..b6363cbb5 100644 --- a/.github/workflows/sdk.yaml +++ b/.github/workflows/sdk.yaml @@ -47,12 +47,19 @@ jobs: wget -O aarch64-toolchain.tar.gz https://sel4-toolchains.s3.us-east-2.amazonaws.com/arm-gnu-toolchain-12.2.rel1-x86_64-aarch64-none-elf.tar.xz%3Frev%3D28d5199f6db34e5980aae1062e5a6703%26hash%3DF6F5604BC1A2BBAAEAC4F6E98D8DC35B tar xf aarch64-toolchain.tar.gz echo "$(pwd)/arm-gnu-toolchain-12.2.rel1-x86_64-aarch64-none-elf/bin" >> $GITHUB_PATH + - name: Set version + run: echo "SDK_VERSION=$(./ci/dev_version.sh)" >> $GITHUB_ENV - name: Build SDK run: | python3.9 -m venv pyenv ./pyenv/bin/pip install --upgrade pip setuptools wheel ./pyenv/bin/pip install -r requirements.txt - ./pyenv/bin/python build_sdk.py --sel4=seL4 + ./pyenv/bin/python build_sdk.py --sel4=seL4 --version ${{ env.SDK_VERSION }} + - name: Upload SDK + uses: actions/upload-artifact@v4 + with: + name: microkit-sdk-${{ env.SDK_VERSION }}-linux-x86-64 + path: release/microkit-sdk-${{ env.SDK_VERSION }}.tar.gz build_macos_x64: name: Build SDK (macOS x86-64) runs-on: macos-14 @@ -75,12 +82,19 @@ jobs: wget -O aarch64-toolchain.tar.gz https://sel4-toolchains.s3.us-east-2.amazonaws.com/arm-gnu-toolchain-12.2.rel1-darwin-x86_64-aarch64-none-elf.tar.xz%3Frev%3D09b11f159fc24fdda01e05bb32695dd5%26hash%3D6AAF4239F28AE17389AB3E611DFFE0A6 tar xf aarch64-toolchain.tar.gz echo "$(pwd)/arm-gnu-toolchain-12.2.rel1-darwin-x86_64-aarch64-none-elf/bin" >> $GITHUB_PATH + - name: Set version + run: echo "SDK_VERSION=$(./ci/dev_version.sh)" >> $GITHUB_ENV - name: Build SDK run: | python3.9 -m venv pyenv ./pyenv/bin/pip install --upgrade pip setuptools wheel ./pyenv/bin/pip install -r requirements.txt - ./pyenv/bin/python build_sdk.py --sel4=seL4 + ./pyenv/bin/python build_sdk.py --sel4=seL4 --version ${{ env.SDK_VERSION }} + - name: Upload SDK + uses: actions/upload-artifact@v4 + with: + name: microkit-sdk-${{ env.SDK_VERSION }}-macos-x86-64 + path: release/microkit-sdk-${{ env.SDK_VERSION }}.tar.gz build_macos_arm64: name: Build SDK (macOS ARM64) runs-on: macos-14 @@ -104,9 +118,16 @@ jobs: wget -O aarch64-toolchain.tar.gz https://sel4-toolchains.s3.us-east-2.amazonaws.com/arm-gnu-toolchain-12.2.rel1-darwin-x86_64-aarch64-none-elf.tar.xz%3Frev%3D09b11f159fc24fdda01e05bb32695dd5%26hash%3D6AAF4239F28AE17389AB3E611DFFE0A6 tar xf aarch64-toolchain.tar.gz echo "$(pwd)/arm-gnu-toolchain-12.2.rel1-darwin-x86_64-aarch64-none-elf/bin" >> $GITHUB_PATH + - name: Set version + run: echo "SDK_VERSION=$(./ci/dev_version.sh)" >> $GITHUB_ENV - name: Build SDK run: | python3.9 -m venv pyenv ./pyenv/bin/pip install --upgrade pip setuptools wheel ./pyenv/bin/pip install -r requirements.txt - ./pyenv/bin/python build_sdk.py --sel4=seL4 --tool-target-triple=aarch64-apple-darwin + ./pyenv/bin/python build_sdk.py --sel4=seL4 --version ${{ env.SDK_VERSION }} + - name: Upload SDK + uses: actions/upload-artifact@v4 + with: + name: microkit-sdk-${{ env.SDK_VERSION }}-macos-aarch64 + path: release/microkit-sdk-${{ env.SDK_VERSION }}.tar.gz diff --git a/build_sdk.py b/build_sdk.py index 6b327b224..2619b067b 100644 --- a/build_sdk.py +++ b/build_sdk.py @@ -535,9 +535,12 @@ def main() -> None: parser.add_argument("--skip-sel4", action="store_true", help="seL4 will not be built") parser.add_argument("--skip-docs", action="store_true", help="Docs will not be built") parser.add_argument("--skip-tar", action="store_true", help="SDK and source tarballs will not be built") + parser.add_argument("--version", default=VERSION, help="SDK version") args = parser.parse_args() + version = args.version + if args.boards is not None: supported_board_names = frozenset(board.name for board in SUPPORTED_BOARDS) selected_board_names = frozenset(args.boards.split(",")) @@ -562,9 +565,9 @@ def main() -> None: if not sel4_dir.exists(): raise Exception(f"sel4_dir: {sel4_dir} does not exist") - root_dir = Path("release") / f"{NAME}-sdk-{VERSION}" - tar_file = Path("release") / f"{NAME}-sdk-{VERSION}.tar.gz" - source_tar_file = Path("release") / f"{NAME}-source-{VERSION}.tar.gz" + root_dir = Path("release") / f"{NAME}-sdk-{version}" + tar_file = Path("release") / f"{NAME}-sdk-{version}.tar.gz" + source_tar_file = Path("release") / f"{NAME}-source-{version}.tar.gz" dir_structure = [ root_dir / "bin", root_dir / "board", @@ -656,7 +659,7 @@ def main() -> None: process = popen("git ls-files") filenames = [Path(fn.strip()) for fn in process.readlines()] process.close() - source_prefix = Path(f"{NAME}-source-{VERSION}") + source_prefix = Path(f"{NAME}-source-{version}") with tar_open(source_tar_file, "w:gz") as tar: for filename in filenames: tar.add(filename, arcname=source_prefix / filename, filter=tar_filter) diff --git a/ci/dev_version.sh b/ci/dev_version.sh new file mode 100755 index 000000000..44d1ac3b6 --- /dev/null +++ b/ci/dev_version.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +# Copyright 2024, UNSW +# SPDX-License-Identifier: BSD-2-Clause + +VERSION=`cat VERSION` +NUM_COMMITS=`git rev-list --count 1.4.1..main` +HEAD=`git rev-parse --short HEAD` + +echo "$VERSION.$NUM_COMMITS+$HEAD"