mirror of
https://github.com/containers/youki
synced 2024-11-26 06:08:07 +01:00
fix(main): support arm64 release youki
Signed-off-by: cuisongliu <cuisongliu@qq.com>
This commit is contained in:
parent
c7567ab42a
commit
d0515ff231
20
.github/workflows/e2e.yaml
vendored
20
.github/workflows/e2e.yaml
vendored
@ -12,17 +12,29 @@ jobs:
|
|||||||
youki-build:
|
youki-build:
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-22.04
|
||||||
timeout-minutes: 15
|
timeout-minutes: 15
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
arch: [ "x86_64", "aarch64" ]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
- name: Setup Rust toolchain and cache
|
- uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||||
uses: actions-rust-lang/setup-rust-toolchain@v1.3.7
|
env:
|
||||||
|
RUST_CACHE_KEY_OS: rust-cache-${{ matrix.arch }}
|
||||||
|
with:
|
||||||
|
rustflags: '' #Disable. By default this action sets environment variable is set to -D warnings. We manage this in the Makefile
|
||||||
- name: Install just
|
- name: Install just
|
||||||
uses: taiki-e/install-action@just
|
uses: taiki-e/install-action@just
|
||||||
- name: Install requirements
|
- name: Install requirements
|
||||||
run: sudo env PATH=$PATH just ci-prepare
|
if: ${{ matrix.arch == 'x86_64' }}
|
||||||
|
run: |
|
||||||
|
sudo env PATH=$PATH arch=${{ matrix.arch }} just ci-prepare
|
||||||
|
- name: Install requirements for aarch64
|
||||||
|
if: ${{ matrix.arch == 'aarch64' }}
|
||||||
|
run: cargo install cross --git https://github.com/cross-rs/cross
|
||||||
- name: Build youki
|
- name: Build youki
|
||||||
run: just youki-release
|
run: arch=${{ matrix.arch }} just youki-release
|
||||||
- name: Upload youki binary
|
- name: Upload youki binary
|
||||||
|
if: ${{ matrix.arch == 'x86_64' }}
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: youki
|
name: youki
|
||||||
|
77
.github/workflows/release.yml
vendored
77
.github/workflows/release.yml
vendored
@ -5,39 +5,36 @@ on:
|
|||||||
tags: ["v[0-9]+.[0-9]+.[0-9]+*"]
|
tags: ["v[0-9]+.[0-9]+.[0-9]+*"]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
check:
|
build:
|
||||||
name: Check
|
name: Build
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-20.04
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
arch: [ "x86_64", "aarch64" ]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
submodules: recursive
|
submodules: recursive
|
||||||
- name: Setup Rust toolchain and cache
|
- uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||||
uses: actions-rust-lang/setup-rust-toolchain@v1.3.7
|
env:
|
||||||
- name: Install just
|
RUST_CACHE_KEY_OS: rust-cache-${{ matrix.arch }}
|
||||||
uses: taiki-e/install-action@just
|
with:
|
||||||
|
rustflags: '' #Disable. By default this action sets environment variable is set to -D warnings. We manage this in the Makefile
|
||||||
|
- uses: taiki-e/install-action@just
|
||||||
- name: Install requirements
|
- name: Install requirements
|
||||||
run: sudo env PATH=$PATH just ci-prepare
|
if: ${{ matrix.arch == 'x86_64' }}
|
||||||
- name: Build
|
run: |
|
||||||
run: just youki-release
|
sudo env PATH=$PATH arch=${{ matrix.arch }} just ci-prepare
|
||||||
|
- name: Install requirements for aarch64
|
||||||
|
if: ${{ matrix.arch == 'aarch64' }}
|
||||||
|
run: cargo install cross --git https://github.com/cross-rs/cross
|
||||||
|
- name: Release build
|
||||||
|
run: arch=${{ matrix.arch }} just youki-release
|
||||||
- name: test
|
- name: test
|
||||||
# TODO(utam0k): The feature test needs nightly
|
# TODO(utam0k): The feature test needs nightly
|
||||||
# run: just test-basic featuretest test-oci
|
# run: just test-basic featuretest test-oci
|
||||||
|
if: ${{ matrix.arch == 'x86_64' }}
|
||||||
run: just test-basic test-oci
|
run: just test-basic test-oci
|
||||||
|
|
||||||
upload:
|
|
||||||
name: Upload
|
|
||||||
needs: check
|
|
||||||
runs-on: ubuntu-20.04
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
- name: Setup Rust toolchain and cache
|
|
||||||
uses: actions-rust-lang/setup-rust-toolchain@v1.3.7
|
|
||||||
- uses: taiki-e/install-action@just
|
|
||||||
- name: Install requirements
|
|
||||||
run: sudo env PATH=$PATH just ci-prepare
|
|
||||||
- name: Release build
|
|
||||||
run: just youki-release
|
|
||||||
- name: Create output directory
|
- name: Create output directory
|
||||||
run: mkdir output
|
run: mkdir output
|
||||||
- name: Copy files to output
|
- name: Copy files to output
|
||||||
@ -48,14 +45,13 @@ jobs:
|
|||||||
- name: Upload artifact
|
- name: Upload artifact
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: output
|
name: output-${{ matrix.arch }}
|
||||||
path: output/*
|
path: output/*
|
||||||
|
|
||||||
release:
|
release:
|
||||||
name: Create Draft Release
|
name: Create Draft Release
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-20.04
|
||||||
needs:
|
needs:
|
||||||
- upload
|
- build
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
@ -74,30 +70,41 @@ jobs:
|
|||||||
echo "INNERDIR=youki-${VERSION}" >> $GITHUB_ENV
|
echo "INNERDIR=youki-${VERSION}" >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: Create Output Directory
|
- name: Create Output Directory
|
||||||
run: mkdir -p ${{ env.OUTPUTDIR }}/${{ env.INNERDIR }}
|
run: |
|
||||||
|
mkdir -p ${{ env.OUTPUTDIR }}-x86_64/${{ env.INNERDIR }}
|
||||||
|
mkdir -p ${{ env.OUTPUTDIR }}-aarch64/${{ env.INNERDIR }}
|
||||||
|
|
||||||
- name: Download Linux Artifacts
|
- name: Download Linux Artifacts for x86_64
|
||||||
uses: actions/download-artifact@v3
|
uses: actions/download-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: output
|
name: output-x86_64
|
||||||
path: ${{ env.OUTPUTDIR }}/${{ env.INNERDIR }}
|
path: ${{ env.OUTPUTDIR }}-x86_64/${{ env.INNERDIR }}
|
||||||
|
- name: Download Linux Artifacts for aarch64
|
||||||
|
uses: actions/download-artifact@v3
|
||||||
|
with:
|
||||||
|
name: output-aarch64
|
||||||
|
path: ${{ env.OUTPUTDIR }}-aarch64/${{ env.INNERDIR }}
|
||||||
- name: Restore File Modes
|
- name: Restore File Modes
|
||||||
run: |
|
run: |
|
||||||
chmod 755 ${{ env.OUTPUTDIR }}/${{ env.INNERDIR }}/youki
|
chmod 755 ${{ env.OUTPUTDIR }}-x86_64/${{ env.INNERDIR }}/youki
|
||||||
|
chmod 755 ${{ env.OUTPUTDIR }}-aarch64/${{ env.INNERDIR }}/youki
|
||||||
- name: Create tarball
|
- name: Create tarball
|
||||||
run: tar -zcvf ${{ env.OUTPUTDIR }}.tar.gz ${{ env.OUTPUTDIR }}
|
run: |
|
||||||
|
tar -zcvf ${{ env.OUTPUTDIR }}-x86_64.tar.gz ${{ env.OUTPUTDIR }}-x86_64
|
||||||
|
tar -zcvf ${{ env.OUTPUTDIR }}-aarch64.tar.gz ${{ env.OUTPUTDIR }}-aarch64
|
||||||
- name: Create Release Draft
|
- name: Create Release Draft
|
||||||
uses: softprops/action-gh-release@v1
|
uses: softprops/action-gh-release@v1
|
||||||
with:
|
with:
|
||||||
name: ${{ env.VERSION }} Release
|
name: ${{ env.VERSION }} Release
|
||||||
draft: true
|
draft: true
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
files: ./${{ env.OUTPUTDIR }}.tar.gz
|
files: |
|
||||||
|
./${{ env.OUTPUTDIR }}-x86_64.tar.gz
|
||||||
|
./${{ env.OUTPUTDIR }}-aarch64.tar.gz
|
||||||
|
|
||||||
publish:
|
publish:
|
||||||
name: Publish Packages
|
name: Publish Packages
|
||||||
needs: check
|
needs: build
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-20.04
|
||||||
env:
|
env:
|
||||||
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
|
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
|
||||||
|
8
Cross.toml
Normal file
8
Cross.toml
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
[build]
|
||||||
|
default-target = "x86_64-unknown-linux-gnu"
|
||||||
|
|
||||||
|
[target.aarch64-unknown-linux-gnu]
|
||||||
|
dockerfile = "cross/Dockerfile.gnu"
|
||||||
|
|
||||||
|
[target.x86_64-unknown-linux-gnu]
|
||||||
|
dockerfile = "cross/Dockerfile.gnu"
|
8
cross/Dockerfile.gnu
Normal file
8
cross/Dockerfile.gnu
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
ARG CROSS_BASE_IMAGE
|
||||||
|
ARG CROSS_DEB_ARCH
|
||||||
|
FROM $CROSS_BASE_IMAGE
|
||||||
|
|
||||||
|
ARG CROSS_DEB_ARCH
|
||||||
|
RUN dpkg --add-architecture ${CROSS_DEB_ARCH} && \
|
||||||
|
apt-get -y update && \
|
||||||
|
apt-get install -y pkg-config libseccomp-dev:${CROSS_DEB_ARCH}
|
8
justfile
8
justfile
@ -12,19 +12,19 @@ build-all: youki-release rust-oci-tests-bin runtimetest
|
|||||||
|
|
||||||
# build youki in dev mode
|
# build youki in dev mode
|
||||||
youki-dev:
|
youki-dev:
|
||||||
{{ cwd }}/scripts/build.sh -o {{ cwd }} -c youki
|
{{ cwd }}/scripts/build.sh -o {{ cwd }} -c youki -a ${arch:-x86_64}
|
||||||
|
|
||||||
# build youki in release mode
|
# build youki in release mode
|
||||||
youki-release:
|
youki-release:
|
||||||
{{ cwd }}/scripts/build.sh -o {{ cwd }} -r -c youki
|
{{ cwd }}/scripts/build.sh -o {{ cwd }} -r -c youki -a ${arch:-x86_64}
|
||||||
|
|
||||||
# build runtimetest binary
|
# build runtimetest binary
|
||||||
runtimetest:
|
runtimetest:
|
||||||
{{ cwd }}/scripts/build.sh -o {{ cwd }} -r -c runtimetest
|
{{ cwd }}/scripts/build.sh -o {{ cwd }} -r -c runtimetest -a ${arch:-x86_64}
|
||||||
|
|
||||||
# build rust oci tests binary
|
# build rust oci tests binary
|
||||||
rust-oci-tests-bin:
|
rust-oci-tests-bin:
|
||||||
{{ cwd }}/scripts/build.sh -o {{ cwd }} -r -c integration-test
|
{{ cwd }}/scripts/build.sh -o {{ cwd }} -r -c integration-test -a ${arch:-x86_64}
|
||||||
|
|
||||||
# Tests
|
# Tests
|
||||||
|
|
||||||
|
@ -4,16 +4,16 @@ set -euo pipefail
|
|||||||
ROOT=$(git rev-parse --show-toplevel)
|
ROOT=$(git rev-parse --show-toplevel)
|
||||||
|
|
||||||
usage_exit() {
|
usage_exit() {
|
||||||
echo "Usage: $0 [-r] [-o dir]" 1>&2
|
echo "Usage: $0 [-r] [-o dir] [-c crate] [-a arch] [-f features]" 1>&2
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
VERSION=debug
|
VERSION=debug
|
||||||
TARGET="$(uname -m)-unknown-linux-gnu"
|
|
||||||
CRATE="youki"
|
CRATE="youki"
|
||||||
RUNTIMETEST_TARGET="$ROOT/runtimetest-target"
|
RUNTIMETEST_TARGET="$ROOT/runtimetest-target"
|
||||||
features=""
|
features=""
|
||||||
while getopts f:ro:c:h OPT; do
|
ARCH=$(uname -m)
|
||||||
|
while getopts f:ro:c:ha: OPT; do
|
||||||
case $OPT in
|
case $OPT in
|
||||||
f) features=${OPTARG}
|
f) features=${OPTARG}
|
||||||
;;
|
;;
|
||||||
@ -23,6 +23,8 @@ while getopts f:ro:c:h OPT; do
|
|||||||
;;
|
;;
|
||||||
c) CRATE=${OPTARG}
|
c) CRATE=${OPTARG}
|
||||||
;;
|
;;
|
||||||
|
a) ARCH=${OPTARG}
|
||||||
|
;;
|
||||||
h) usage_exit
|
h) usage_exit
|
||||||
;;
|
;;
|
||||||
\?) usage_exit
|
\?) usage_exit
|
||||||
@ -37,12 +39,20 @@ if [ ${VERSION} = release ]; then
|
|||||||
OPTION="--${VERSION}"
|
OPTION="--${VERSION}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
TARGET="${ARCH}-unknown-linux-gnu"
|
||||||
|
CARGO="cargo"
|
||||||
|
if [ "$ARCH" == "aarch64" ]; then
|
||||||
|
# shellcheck disable=SC2034
|
||||||
|
CARGO="cross"
|
||||||
|
fi
|
||||||
|
|
||||||
FEATURES=""
|
FEATURES=""
|
||||||
if [ -n "${features}" ]; then
|
if [ -n "${features}" ]; then
|
||||||
FEATURES="--features ${features}"
|
FEATURES="--features ${features}"
|
||||||
fi
|
fi
|
||||||
echo "* FEATURES: ${FEATURES}"
|
echo "* FEATURES: ${FEATURES}"
|
||||||
echo "* features: ${features}"
|
echo "* features: ${features}"
|
||||||
|
echo "* TARGET: ${TARGET}"
|
||||||
|
|
||||||
OUTPUT=${output:-$ROOT/bin}
|
OUTPUT=${output:-$ROOT/bin}
|
||||||
[ ! -d $OUTPUT ] && mkdir -p $OUTPUT
|
[ ! -d $OUTPUT ] && mkdir -p $OUTPUT
|
||||||
@ -50,7 +60,7 @@ OUTPUT=${output:-$ROOT/bin}
|
|||||||
|
|
||||||
if [ "$CRATE" == "youki" ]; then
|
if [ "$CRATE" == "youki" ]; then
|
||||||
rm -f ${OUTPUT}/youki
|
rm -f ${OUTPUT}/youki
|
||||||
cargo build --target ${TARGET} ${OPTION} ${FEATURES} --bin youki
|
$CARGO build --target ${TARGET} ${OPTION} ${FEATURES} --bin youki
|
||||||
mv ${ROOT}/target/${TARGET}/${VERSION}/youki ${OUTPUT}/
|
mv ${ROOT}/target/${TARGET}/${VERSION}/youki ${OUTPUT}/
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user