scripts/BuildScripts/BuildCommon.mk: use git branch instead of PrawnOS release for image name

This commit is contained in:
Austin English 2021-01-21 15:28:09 -06:00
parent 1056aa92f7
commit 27e5299f64
7 changed files with 41 additions and 20 deletions

View File

@ -14,5 +14,5 @@ jobs:
run: sudo dpkg -i ./tests/resources/qemu-user-static_5.1+dfsg-4+b1_amd64.deb &&
docker run --mount type=bind,source=$PWD,target=/PrawnOS
--privileged -v/dev:/dev debian:bullseye
/bin/bash /PrawnOS/tests/build.sh "$GITHUB_SHA" arm64 Shiba kernel
/bin/bash /PrawnOS/tests/build.sh "$GITHUB_SHA" arm64 "${GITHUB_REF##*/}" kernel
# FIXME: can we make the binary available without upsetting FSF?

View File

@ -14,5 +14,5 @@ jobs:
run: sudo dpkg -i ./tests/resources/qemu-user-static_5.1+dfsg-4+b1_amd64.deb &&
docker run --mount type=bind,source=$PWD,target=/PrawnOS
--privileged -v/dev:/dev debian:bullseye
/bin/bash /PrawnOS/tests/build.sh "$GITHUB_SHA" armhf Shiba kernel
/bin/bash /PrawnOS/tests/build.sh "$GITHUB_SHA" armhf "${GITHUB_REF##*/}" kernel
# FIXME: can we make the binary available without upsetting FSF?

View File

@ -10,13 +10,17 @@ jobs:
steps:
- name: checkout project
uses: actions/checkout@v2
- name: Extract branch name
shell: bash
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF##*/})"
id: extract_branch
- name: build image
run: sudo dpkg -i ./tests/resources/qemu-user-static_5.1+dfsg-4+b1_amd64.deb &&
docker run --mount type=bind,source=$PWD,target=/PrawnOS
--privileged -v/dev:/dev debian:bullseye
/bin/bash /PrawnOS/tests/build.sh "$GITHUB_SHA" arm64 Shiba image
/bin/bash /PrawnOS/tests/build.sh "$GITHUB_SHA" arm64 ${{ steps.extract_branch.outputs.branch }} image
- name: publish image
uses: actions/upload-artifact@v2
with:
name: "CrawfishOS-Shiba-arm64-git-${{ github.sha }}.img.xz"
path: "CrawfishOS-Shiba-arm64-git-${{ github.sha }}.img.xz"
name: CrawfishOS-arm64-git-${{ steps.extract_branch.outputs.branch }}-${{ github.sha }}.img.xz
path: CrawfishOS-arm64-git-${{ steps.extract_branch.outputs.branch }}-${{ github.sha }}.img.xz

View File

@ -10,13 +10,17 @@ jobs:
steps:
- name: checkout project
uses: actions/checkout@v2
- name: Extract branch name
shell: bash
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF##*/})"
id: extract_branch
- name: build image
run: sudo dpkg -i ./tests/resources/qemu-user-static_5.1+dfsg-4+b1_amd64.deb &&
docker run --mount type=bind,source=$PWD,target=/PrawnOS
--privileged -v/dev:/dev debian:bullseye
/bin/bash /PrawnOS/tests/build.sh "$GITHUB_SHA" armhf Shiba image
/bin/bash /PrawnOS/tests/build.sh "$GITHUB_SHA" armhf ${{ steps.extract_branch.outputs.branch }} image
- name: publish image
uses: actions/upload-artifact@v2
with:
name: "CrawfishOS-Shiba-armhf-git-${{ github.sha }}.img.xz"
path: "CrawfishOS-Shiba-armhf-git-${{ github.sha }}.img.xz"
name: CrawfishOS-armhf-git-${{ steps.extract_branch.outputs.branch }}-${{ github.sha }}.img.xz
path: CrawfishOS-armhf-git-${{ steps.extract_branch.outputs.branch }}-${{ github.sha }}.img.xz

View File

@ -112,8 +112,7 @@ $(PRAWNOS_IMAGE):
$(MAKE) image
$(PRAWNOS_IMAGE_GIT_GZ): $(PRAWNOS_IMAGE)
cp $(PRAWNOS_IMAGE) $(PRAWNOS_IMAGE_GIT)
gzip -c $(PRAWNOS_IMAGE_GIT) > $(PRAWNOS_IMAGE_GIT_GZ)
gzip -c $(PRAWNOS_IMAGE) > $(PRAWNOS_IMAGE_GIT_GZ)
#:::::::::::::::::::::::::::::: dependency management ::::::::::::::::::::::::::

View File

@ -105,10 +105,23 @@ PRAWNOS_SUITE := Shiba
endif
PRAWNOS_GIT_SHA := $(shell git rev-parse HEAD)
PRAWNOS_GIT_BRANCH := $(shell git branch --show-current)
# GithubCI doesn't show any branch, extract it from ${GITHUB_REF##*/} as a fallback
ifeq ($(PRAWNOS_GIT_BRANCH),)
PRAWNOS_GIT_BRANCH := $(shell echo ${GITHUB_REF##*/})
endif
# If we're not on master, append the branch name/sha1 to the imagename
ifeq ($(PRAWNOS_GIT_BRANCH),master)
# FIXME: use tag here instead of PRAWNOS_SUITE
PRAWNOS_IMAGE := $(PRAWNOS_ROOT)/CrawfishOS-$(PRAWNOS_SUITE)-$(TARGET).img
PRAWNOS_IMAGE_GIT := $(PRAWNOS_ROOT)/CrawfishOS-$(PRAWNOS_SUITE)-$(TARGET)-git-$(PRAWNOS_GIT_SHA).img
PRAWNOS_IMAGE_GIT_GZ := $(PRAWNOS_IMAGE_GIT).gz
else
PRAWNOS_IMAGE := $(PRAWNOS_ROOT)/CrawfishOS-$(TARGET)-git-$(PRAWNOS_GIT_BRANCH)-$(PRAWNOS_GIT_SHA).img
endif
PRAWNOS_IMAGE_GIT_GZ := $(PRAWNOS_IMAGE).gz
PRAWNOS_IMAGE_BASE := $(PRAWNOS_IMAGE)-BASE
### BUILD SCRIPTS

View File

@ -21,12 +21,11 @@ set -x
GITHUB_SHA="$1"
TEST_TARGET="$2"
RELEASE_VERSION="$3"
BRANCH="$3"
BUILD_TYPE="$4"
IMG="CrawfishOS-${RELEASE_VERSION}-${TEST_TARGET}"
IMAGE="${IMG}.img"
IMAGE_GIT="${IMG}-git-${GITHUB_SHA}.img"
# FIXME: how will this handle tags?
IMG="CrawfishOS-${TEST_TARGET}-git-${BRANCH}-${GITHUB_SHA}.img"
cd "$(dirname "$0")/.."
@ -49,10 +48,12 @@ make install_dependencies_yes TARGET=$TEST_TARGET
;;
image)
make image TARGET=$TEST_TARGET
# rename the image to include git sha:
mv $IMAGE $IMAGE_GIT
# compress, otherwise downloads take forever
xz -1 $IMAGE_GIT
# Compress, otherwise downloads take forever. Ideally we'd use zip here, but:
# A) that would be an additional package to install,
# B) github actions would then nest THAT zip inside a second zip, see https://github.com/actions/upload-artifact/issues/39
# when ^ is fixed, revisit
xz -1 ${IMG}
;;
kernel)
make kernel TARGET=$TEST_TARGET