Skip to content

Commit

Permalink
Merge pull request #32 from SoftwareDefinedVehicle/main
Browse files Browse the repository at this point in the history
Build and release workflows
  • Loading branch information
mikehaller authored Mar 16, 2023
2 parents 15ff12d + 6e29284 commit ad701d9
Show file tree
Hide file tree
Showing 6 changed files with 373 additions and 1 deletion.
109 changes: 109 additions & 0 deletions .github/workflows/build-kanto-auto-deployer.yaml
Original file line number Diff line number Diff line change
@@ -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 <<EOT > .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
112 changes: 112 additions & 0 deletions .github/workflows/build-kantui.yaml
Original file line number Diff line number Diff line change
@@ -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 <<EOT > .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
67 changes: 67 additions & 0 deletions .github/workflows/build-leda-utils.yaml
Original file line number Diff line number Diff line change
@@ -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 <<EOT > .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

34 changes: 34 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -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
48 changes: 48 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -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
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
/src/rust/kanto-auto-deployer/target
/src/rust/kanto-auto-deployer/target
tmp
**/*.tar.gz

0 comments on commit ad701d9

Please sign in to comment.