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:
|
||||
runs-on: ubuntu-22.04
|
||||
timeout-minutes: 15
|
||||
strategy:
|
||||
matrix:
|
||||
arch: [ "x86_64", "aarch64" ]
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Setup Rust toolchain and cache
|
||||
uses: actions-rust-lang/setup-rust-toolchain@v1.3.7
|
||||
- uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||
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
|
||||
uses: taiki-e/install-action@just
|
||||
- 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
|
||||
run: just youki-release
|
||||
run: arch=${{ matrix.arch }} just youki-release
|
||||
- name: Upload youki binary
|
||||
if: ${{ matrix.arch == 'x86_64' }}
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
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]+*"]
|
||||
|
||||
jobs:
|
||||
check:
|
||||
name: Check
|
||||
build:
|
||||
name: Build
|
||||
runs-on: ubuntu-20.04
|
||||
strategy:
|
||||
matrix:
|
||||
arch: [ "x86_64", "aarch64" ]
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: recursive
|
||||
- name: Setup Rust toolchain and cache
|
||||
uses: actions-rust-lang/setup-rust-toolchain@v1.3.7
|
||||
- name: Install just
|
||||
uses: taiki-e/install-action@just
|
||||
- uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||
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
|
||||
- uses: taiki-e/install-action@just
|
||||
- name: Install requirements
|
||||
run: sudo env PATH=$PATH just ci-prepare
|
||||
- name: Build
|
||||
run: just youki-release
|
||||
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: Release build
|
||||
run: arch=${{ matrix.arch }} just youki-release
|
||||
- name: test
|
||||
# TODO(utam0k): The feature test needs nightly
|
||||
# run: just test-basic featuretest test-oci
|
||||
if: ${{ matrix.arch == 'x86_64' }}
|
||||
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
|
||||
run: mkdir output
|
||||
- name: Copy files to output
|
||||
@ -48,14 +45,13 @@ jobs:
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: output
|
||||
name: output-${{ matrix.arch }}
|
||||
path: output/*
|
||||
|
||||
release:
|
||||
name: Create Draft Release
|
||||
runs-on: ubuntu-20.04
|
||||
needs:
|
||||
- upload
|
||||
- build
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
@ -74,30 +70,41 @@ jobs:
|
||||
echo "INNERDIR=youki-${VERSION}" >> $GITHUB_ENV
|
||||
|
||||
- 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
|
||||
with:
|
||||
name: output
|
||||
path: ${{ env.OUTPUTDIR }}/${{ env.INNERDIR }}
|
||||
|
||||
name: output-x86_64
|
||||
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
|
||||
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
|
||||
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
|
||||
uses: softprops/action-gh-release@v1
|
||||
with:
|
||||
name: ${{ env.VERSION }} Release
|
||||
draft: true
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
files: ./${{ env.OUTPUTDIR }}.tar.gz
|
||||
files: |
|
||||
./${{ env.OUTPUTDIR }}-x86_64.tar.gz
|
||||
./${{ env.OUTPUTDIR }}-aarch64.tar.gz
|
||||
|
||||
publish:
|
||||
name: Publish Packages
|
||||
needs: check
|
||||
needs: build
|
||||
runs-on: ubuntu-20.04
|
||||
env:
|
||||
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
|
||||
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
|
||||
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
|
||||
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
|
||||
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
|
||||
|
||||
|
@ -4,16 +4,16 @@ set -euo pipefail
|
||||
ROOT=$(git rev-parse --show-toplevel)
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
VERSION=debug
|
||||
TARGET="$(uname -m)-unknown-linux-gnu"
|
||||
CRATE="youki"
|
||||
RUNTIMETEST_TARGET="$ROOT/runtimetest-target"
|
||||
features=""
|
||||
while getopts f:ro:c:h OPT; do
|
||||
ARCH=$(uname -m)
|
||||
while getopts f:ro:c:ha: OPT; do
|
||||
case $OPT in
|
||||
f) features=${OPTARG}
|
||||
;;
|
||||
@ -23,6 +23,8 @@ while getopts f:ro:c:h OPT; do
|
||||
;;
|
||||
c) CRATE=${OPTARG}
|
||||
;;
|
||||
a) ARCH=${OPTARG}
|
||||
;;
|
||||
h) usage_exit
|
||||
;;
|
||||
\?) usage_exit
|
||||
@ -37,12 +39,20 @@ if [ ${VERSION} = release ]; then
|
||||
OPTION="--${VERSION}"
|
||||
fi
|
||||
|
||||
TARGET="${ARCH}-unknown-linux-gnu"
|
||||
CARGO="cargo"
|
||||
if [ "$ARCH" == "aarch64" ]; then
|
||||
# shellcheck disable=SC2034
|
||||
CARGO="cross"
|
||||
fi
|
||||
|
||||
FEATURES=""
|
||||
if [ -n "${features}" ]; then
|
||||
FEATURES="--features ${features}"
|
||||
fi
|
||||
echo "* FEATURES: ${FEATURES}"
|
||||
echo "* features: ${features}"
|
||||
echo "* TARGET: ${TARGET}"
|
||||
|
||||
OUTPUT=${output:-$ROOT/bin}
|
||||
[ ! -d $OUTPUT ] && mkdir -p $OUTPUT
|
||||
@ -50,7 +60,7 @@ OUTPUT=${output:-$ROOT/bin}
|
||||
|
||||
if [ "$CRATE" == "youki" ]; then
|
||||
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}/
|
||||
fi
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user