Make images in gitlab ci

This commit is contained in:
Jeremy Soller 2018-06-10 09:54:05 -06:00
parent 2f7ff3d625
commit e7375348e0
4 changed files with 40 additions and 38 deletions

View file

@ -1,21 +1,14 @@
variables:
GIT_STRATEGY: "none"
GIT_SUBMODULE_STRATEGY: "none"
GIT_CHECKOUT: "false"
GIT_STRATEGY: "pull"
GIT_SUBMODULE_STRATEGY: "recursive"
GIT_CHECKOUT: "true"
before_script:
- |
apt-get update -qq &&
apt-get install -qq \
autopoint \
autoconf \
automake \
bison \
build-essential \
clang \
cmake \
curl \
flex \
fuse \
genisoimage \
git \
@ -24,26 +17,26 @@ before_script:
nasm \
pkg-config \
software-properties-common \
syslinux \
texinfo \
wget &&
syslinux &&
apt-key adv -q --batch --yes --keyserver keyserver.ubuntu.com --recv-keys AA12E97F0881517F &&
add-apt-repository 'deb https://static.redox-os.org/toolchain/apt ./' &&
apt-get update -qq &&
apt-get purge -qq binutils-doc &&
apt-get install -qq x86-64-unknown-redox-gcc &&
curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain none
curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain none &&
[ -d "$CI_PROJECT_NAME" ] || git clone "$CI_REPOSITORY_URL" "$CI_PROJECT_NAME" &&
cd "$CI_PROJECT_NAME" &&
git remote set-url origin "$CI_REPOSITORY_URL" &&
git fetch origin &&
git checkout "$CI_COMMIT_SHA" &&
git submodule update --init --recursive &&
source "$HOME/.cargo/env" &&
rustup update &&
cargo install cargo-config xargo
build:
img:
script:
- |
[ -d "$CI_PROJECT_NAME" ] || git clone "$CI_REPOSITORY_URL" "$CI_PROJECT_NAME" &&
cd "$CI_PROJECT_NAME" &&
git remote set-url origin "$CI_REPOSITORY_URL" &&
git fetch origin &&
git checkout "$CI_COMMIT_SHA" &&
git submodule update --init --recursive &&
source "$HOME/.cargo/env" &&
rustup update &&
cargo install cargo-config xargo &&
make ci
make ci-img IMG_TAG=$CI_COMMIT_REF_NAME

View file

@ -32,7 +32,7 @@ matrix:
before_script:
- cd cookbook && ./setup.sh && cd ..
script:
- make clean && make travis
- make clean && make travis IMG_TAG=$TRAVIS_TAG
deploy:
provider: releases

View file

@ -40,12 +40,6 @@ fetch:
"$$(cargo run --manifest-path ../installer/Cargo.toml -- --list-packages -c ../initfs.toml)" \
"$$(cargo run --manifest-path ../installer/Cargo.toml -- --list-packages -c ../filesystem.toml)"
ci:
cd cookbook && ./fetch.sh \
"$$(cargo run --manifest-path ../installer/Cargo.toml -- --list-packages -c ../ci.toml)"
cd cookbook && ./repo.sh \
"$$(cargo run --manifest-path ../installer/Cargo.toml -- --list-packages -c ../ci.toml)"
# Emulation recipes
include mk/qemu.mk
include mk/bochs.mk
@ -61,14 +55,23 @@ include mk/filesystem.mk
# Disk images
include mk/disk.mk
# Travis target
travis: FORCE
make INSTALLER_FLAGS= build/harddrive.bin.gz build/livedisk.iso
rm -rf build/travis
mkdir build/travis
mv build/harddrive.bin.gz build/travis/redox_$(TRAVIS_TAG).bin.gz
mv build/livedisk.iso build/travis/redox_$(TRAVIS_TAG).iso
cd build/travis && sha256sum -b redox_$(TRAVIS_TAG).bin.gz redox_$(TRAVIS_TAG).iso > SHA256SUM
# CI image target
ci-img: FORCE
make INSTALLER_FLAGS= build/harddrive.bin.gz build/harddrive-efi.bin.gz build/livedisk.iso build/livedisk-efi.iso
rm -rf build/img
mkdir build/img
mv build/harddrive.bin.gz build/img/redox_$(IMG_TAG)_harddrive.bin.gz
mv build/livedisk.iso build/img/redox_$(IMG_TAG)_livedisk.iso
mv build/harddrive-efi.bin.gz build/img/redox_$(IMG_TAG)_harddrive-efi.bin.gz
mv build/livedisk-efi.iso build/img/redox_$(IMG_TAG)_livedisk-efi.iso
cd build/img && sha256sum -b * > SHA256SUM
# CI packaging target
ci-pkg: FORCE
cd cookbook && ./fetch.sh \
"$$(cargo run --manifest-path ../installer/Cargo.toml -- --list-packages -c ../ci.toml)"
cd cookbook && ./repo.sh \
"$$(cargo run --manifest-path ../installer/Cargo.toml -- --list-packages -c ../ci.toml)"
# An empty target
FORCE:

View file

@ -40,6 +40,9 @@ build/harddrive-efi.bin: build/bootloader.efi build/filesystem.bin
mcopy -i $@.partial -s bootloader-efi/res ::redox_bootloader
cat $@.partial build/filesystem.bin > $@
build/harddrive-efi.bin.gz: build/harddrive-efi.bin
gzip -k -f $<
build/livedisk-efi.iso: build/bootloader.efi build/kernel_live
dd if=/dev/zero of=$@.partial bs=1048576 count=272
mkfs.vfat $@.partial
@ -50,3 +53,6 @@ build/livedisk-efi.iso: build/bootloader.efi build/kernel_live
mcopy -i $@.partial -s bootloader-efi/res ::redox_bootloader
mcopy -i $@.partial -s build/kernel_live ::redox_bootloader/kernel
mv $@.partial $@
build/livedisk-efi.bin.gz: build/livedisk-efi.bin
gzip -k -f $<