From e7375348e093c47026b6b3478d0bac7364865ede Mon Sep 17 00:00:00 2001 From: Jeremy Soller Date: Sun, 10 Jun 2018 09:54:05 -0600 Subject: [PATCH] Make images in gitlab ci --- .gitlab-ci.yml | 39 ++++++++++++++++----------------------- .travis.yml | 2 +- Makefile | 31 +++++++++++++++++-------------- mk/disk.mk | 6 ++++++ 4 files changed, 40 insertions(+), 38 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 9d25317..6bf58a3 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -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 diff --git a/.travis.yml b/.travis.yml index 2076d1f..d5933cb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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 diff --git a/Makefile b/Makefile index 741f87f..8d7b5d8 100644 --- a/Makefile +++ b/Makefile @@ -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: diff --git a/mk/disk.mk b/mk/disk.mk index c3b1042..76a6f1e 100644 --- a/mk/disk.mk +++ b/mk/disk.mk @@ -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 $<