diff --git a/.github/workflows/build-kanto-auto-deployer.yaml b/.github/workflows/build-kanto-auto-deployer.yaml new file mode 100644 index 0000000..9b273f7 --- /dev/null +++ b/.github/workflows/build-kanto-auto-deployer.yaml @@ -0,0 +1,109 @@ +# /******************************************************************************** +# * Copyright (c) 2023 Contributors to the Eclipse Foundation +# * +# * See the NOTICE file(s) distributed with this work for additional +# * information regarding copyright ownership. +# * +# * This program and the accompanying materials are made available under the +# * terms of the Apache License 2.0 which is available at +# * https://www.apache.org/licenses/LICENSE-2.0 +# * +# * SPDX-License-Identifier: Apache-2.0 +# ********************************************************************************/ +# + +name: Build Kanto Auto Deployer + +on: + workflow_dispatch: + workflow_call: + +jobs: + build: + strategy: + matrix: + target: + - aarch64-unknown-linux-gnu + - x86_64-unknown-linux-gnu + + # Not using latest here, so that building the binaries uses an older version of glibc + # and then can run on newer versions. + runs-on: ubuntu-20.04 + + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + submodules: 'recursive' + - name: Install Rust + run: rustup update stable + - name: Install Tools + run: | + sudo apt-get update + sudo apt-get install -y protobuf-compiler + - name: Install cross-compilation tools + uses: taiki-e/setup-cross-toolchain-action@v1 + with: + target: ${{ matrix.target }} + - uses: Swatinem/rust-cache@v2 + with: + workspaces: | + src/rust/kanto-auto-deployer/ -> target + src/rust/kantui/ -> target + - name: Build binary + run: | + cd src/rust/kanto-auto-deployer + cargo build --release + - name: Package + run: | + cp src/rust/kanto-auto-deployer/target/${{ matrix.target }}/release/kanto-auto-deployer . + chmod +x kanto-auto-deployer + tar czf kanto-auto-deployer-${{ matrix.target }}.tar.gz kanto-auto-deployer LICENSE README.md NOTICE.md + - name: Upload files + uses: actions/upload-artifact@v3 + with: + name: kanto-auto-deployer-${{ matrix.target }}-archive + if-no-files-found: error + path: kanto-auto-deployer-${{ matrix.target }}.tar.gz + - name: Debian Package Preparation + run: | + mkdir -p .debpkg/usr/bin + cp kanto-auto-deployer .debpkg/usr/bin + chmod +x .debpkg/usr/bin/kanto-auto-deployer + + # create DEBIAN directory if you want to add other pre/post scripts + mkdir -p .debpkg/DEBIAN + cat < .debpkg/DEBIAN/copyright + Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ + Upstream-Name: Eclipse Leda + Source: github.com/eclipse-leda/ + + Files: * + Copyright: 2022-2023, Contributors to the Eclipse Foundation + License: APL-2.0 + EOT + - name: Set variables + run: | + git describe --tags --always --long + echo "package_version=`echo $(git describe --tags --always --long | tr -d [:alpha:] | sed 's/-/./g')`" >> $GITHUB_ENV + if [ "${{ matrix.target }}" == "aarch64-unknown-linux-gnu" ]; then + echo "package_arch=arm64" >> $GITHUB_ENV + elif [ "${{ matrix.target }}" == "x86_64-unknown-linux-gnu" ]; then + echo "package_arch=amd64" >> $GITHUB_ENV + else + echo "::error::Unknown architecture: ${{ matrix.target }}" + fi + - uses: jiro4989/build-deb-action@v2 + with: + package: eclipse-leda-kanto-auto-deployer + package_root: .debpkg + maintainer: Eclipse Leda Development Team + version: '${{ env.package_version }}' + arch: '${{ env.package_arch }}' + depends: 'libc6' + desc: 'Automated container deployment based on JSON descriptors for Eclipse Kanto Container Management' + - uses: actions/upload-artifact@v3 + with: + name: kanto-auto-deployer-debian + path: + ./*.deb diff --git a/.github/workflows/build-kantui.yaml b/.github/workflows/build-kantui.yaml new file mode 100644 index 0000000..5168d21 --- /dev/null +++ b/.github/workflows/build-kantui.yaml @@ -0,0 +1,112 @@ +# /******************************************************************************** +# * Copyright (c) 2023 Contributors to the Eclipse Foundation +# * +# * See the NOTICE file(s) distributed with this work for additional +# * information regarding copyright ownership. +# * +# * This program and the accompanying materials are made available under the +# * terms of the Apache License 2.0 which is available at +# * https://www.apache.org/licenses/LICENSE-2.0 +# * +# * SPDX-License-Identifier: Apache-2.0 +# ********************************************************************************/ +# + +name: Build KantUI + +on: + workflow_dispatch: + workflow_call: + +jobs: + build: + strategy: + matrix: + target: + - aarch64-unknown-linux-gnu + - x86_64-unknown-linux-gnu + + # Not using latest here, so that building the binaries uses an older version of glibc + # and then can run on newer versions. + runs-on: ubuntu-20.04 + + steps: + - uses: actions/checkout@v3 + with: + submodules: 'recursive' + fetch-depth: 0 + - name: Install Rust + run: rustup update stable + - name: Install Tools + run: | + sudo apt-get update + sudo apt-get install -y protobuf-compiler + - name: Install cross-compilation tools + uses: taiki-e/setup-cross-toolchain-action@v1 + with: + target: ${{ matrix.target }} + - uses: Swatinem/rust-cache@v2 + with: + workspaces: | + src/rust/kanto-auto-deployer/ -> target + src/rust/kantui/ -> target + - name: Build binary + run: | + cd src/rust/kanto-tui + cargo build --release + - name: Package + run: | + cp src/rust/kanto-tui/kantui_conf.toml . + cp src/rust/kanto-tui/target/${{ matrix.target }}/release/kantui . + chmod +x kantui + tar czf kantui-${{ matrix.target }}.tar.gz kantui_conf.toml kantui LICENSE README.md NOTICE.md + - name: Upload files + uses: actions/upload-artifact@v3 + with: + name: kantui-${{ matrix.target }}-archive + if-no-files-found: error + path: kantui-${{ matrix.target }}.tar.gz + - name: Debian Package Preparation + run: | + mkdir -p .debpkg/usr/bin + mkdir -p .debpkg/etc/kantui + cp kantui_conf.toml .debpkg/etc/kantui/ + cp kantui .debpkg/usr/bin + chmod +x .debpkg/usr/bin/kantui + + # create DEBIAN directory if you want to add other pre/post scripts + mkdir -p .debpkg/DEBIAN + cat < .debpkg/DEBIAN/copyright + Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ + Upstream-Name: Eclipse Leda + Source: github.com/eclipse-leda/ + + Files: * + Copyright: 2022-2023, Contributors to the Eclipse Foundation + License: APL-2.0 + EOT + - name: Set variables + run: | + git describe --tags --always --long + echo "package_version=`echo $(git describe --tags --always --long | tr -d [:alpha:] | sed 's/-/./g')`" >> $GITHUB_ENV + if [ "${{ matrix.target }}" == "aarch64-unknown-linux-gnu" ]; then + echo "package_arch=arm64" >> $GITHUB_ENV + elif [ "${{ matrix.target }}" == "x86_64-unknown-linux-gnu" ]; then + echo "package_arch=amd64" >> $GITHUB_ENV + else + echo "::error::Unknown architecture: ${{ matrix.target }}" + fi + - uses: jiro4989/build-deb-action@v2 + with: + package: eclipse-leda-kantui + package_root: .debpkg + maintainer: Eclipse Leda Development Team + version: '${{ env.package_version }}' + arch: '${{ env.package_arch }}' + depends: 'libc6' + desc: 'Text user interface (cli) for Eclipse Kanto Container Management' + - uses: actions/upload-artifact@v3 + with: + name: kantui-debian + path: + ./*.deb diff --git a/.github/workflows/build-leda-utils.yaml b/.github/workflows/build-leda-utils.yaml new file mode 100644 index 0000000..8f2616d --- /dev/null +++ b/.github/workflows/build-leda-utils.yaml @@ -0,0 +1,67 @@ +# /******************************************************************************** +# * Copyright (c) 2023 Contributors to the Eclipse Foundation +# * +# * See the NOTICE file(s) distributed with this work for additional +# * information regarding copyright ownership. +# * +# * This program and the accompanying materials are made available under the +# * terms of the Apache License 2.0 which is available at +# * https://www.apache.org/licenses/LICENSE-2.0 +# * +# * SPDX-License-Identifier: Apache-2.0 +# ********************************************************************************/ +# + +name: Build Leda-Utils + +on: + workflow_dispatch: + workflow_call: + +jobs: + build: + runs-on: ubuntu-20.04 + + steps: + - uses: actions/checkout@v3 + with: + submodules: 'recursive' + fetch-depth: 0 + - name: Debian Package Preparation + run: | + mkdir -p .debpkg/usr/bin + mkdir -p .debpkg/etc/sdv + + cp src/sh/* .debpkg/usr/bin + cp src/sh/sdv.conf .debpkg/etc/sdv + chmod +x .debpkg/usr/bin/* + + # create DEBIAN directory if you want to add other pre/post scripts + mkdir -p .debpkg/DEBIAN + cat < .debpkg/DEBIAN/copyright + Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ + Upstream-Name: Eclipse Leda + Source: github.com/eclipse-leda/ + + Files: * + Copyright: 2022-2023, Contributors to the Eclipse Foundation + License: APL-2.0 + EOT + - name: Set variables + run: | + git describe --tags --always --long + echo "package_version=`echo $(git describe --tags --always --long | tr -d [:alpha:] | sed 's/-/./g')`" >> $GITHUB_ENV + - uses: jiro4989/build-deb-action@v2 + with: + package: eclipse-leda-utils + package_root: .debpkg + maintainer: Eclipse Leda Development Team + version: '${{ env.package_version }}' + arch: 'all' + desc: 'Shell utilities for Eclipse Leda (Software-Defined Vehicle)' + - uses: actions/upload-artifact@v3 + with: + name: leda-utils-debian + path: + ./*.deb + diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml new file mode 100644 index 0000000..5ce0651 --- /dev/null +++ b/.github/workflows/build.yaml @@ -0,0 +1,34 @@ +# /******************************************************************************** +# * Copyright (c) 2023 Contributors to the Eclipse Foundation +# * +# * See the NOTICE file(s) distributed with this work for additional +# * information regarding copyright ownership. +# * +# * This program and the accompanying materials are made available under the +# * terms of the Apache License 2.0 which is available at +# * https://www.apache.org/licenses/LICENSE-2.0 +# * +# * SPDX-License-Identifier: Apache-2.0 +# ********************************************************************************/ + +name: Leda-Utils Build + +on: + workflow_dispatch: + workflow_call: + +jobs: + build-kantui: + name: Build KantUI + uses: ./.github/workflows/build-kantui.yaml + secrets: inherit + + build-kanto-auto-deployer: + name: Build Kanto Auto Deployer + uses: ./.github/workflows/build-kanto-auto-deployer.yaml + secrets: inherit + + build-leda-utils: + name: Build Leda-Utils + uses: ./.github/workflows/build-leda-utils.yaml + secrets: inherit diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..94f2432 --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,48 @@ +# /******************************************************************************** +# * Copyright (c) 2023 Contributors to the Eclipse Foundation +# * +# * See the NOTICE file(s) distributed with this work for additional +# * information regarding copyright ownership. +# * +# * This program and the accompanying materials are made available under the +# * terms of the Apache License 2.0 which is available at +# * https://www.apache.org/licenses/LICENSE-2.0 +# * +# * SPDX-License-Identifier: Apache-2.0 +# ********************************************************************************/ + +name: Leda-Utils Release + +on: + release: + types: [published] + +jobs: + call-build: + name: Build + uses: ./.github/workflows/build.yaml + secrets: inherit + + upload-assets: + name: Upload assets + runs-on: ubuntu-22.04 + needs: [ call-build ] + permissions: + contents: write + steps: + - name: Download build artifacts + id: download + uses: actions/download-artifact@v3 + with: + path: build/ + - name: Upload assets + uses: softprops/action-gh-release@v1 + with: + fail_on_unmatched_files: true + files: | + ${{steps.download.outputs.download-path}}/kantui-debian/eclipse-leda-kantui_*_amd64.deb + ${{steps.download.outputs.download-path}}/kantui-debian/eclipse-leda-kantui_*_arm64.deb + ${{steps.download.outputs.download-path}}/kanto-auto-deployer-debian/eclipse-leda-kanto-auto-deployer_*_amd64.deb + ${{steps.download.outputs.download-path}}/kanto-auto-deployer-debian/eclipse-leda-kanto-auto-deployer_*_arm64.deb + ${{steps.download.outputs.download-path}}/leda-utils-debian/eclipse-leda-utils*.deb + diff --git a/.gitignore b/.gitignore index d108a31..de7ac6f 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ -/src/rust/kanto-auto-deployer/target \ No newline at end of file +/src/rust/kanto-auto-deployer/target +tmp +**/*.tar.gz \ No newline at end of file