Skip to content

GHA: Disable sid-desktop-xfce temportally #125

GHA: Disable sid-desktop-xfce temportally

GHA: Disable sid-desktop-xfce temportally #125

Workflow file for this run

name: CI
on:
workflow_dispatch:
push:
branches:
- readme
paths:
- .github/workflows/ci.yml
env:
SCRIPT_REPO: ${{ github.repository }}
SCRIPT_REF: ${{ github.ref_name }}
UBOOT_REPO: hzyitc/u-boot-onecloud
UBOOT_RELEASE: latest
UBOOT_BURNIMG: eMMC.burn.img
ARMBIAN_REPO: armbian/build
ARMBIAN_REF: main
PATCHES: 4077,5076
PATCHES_DISABLED: 5082
jobs:
prepare:
name: Prepare
runs-on: ubuntu-22.04
outputs:
env: ${{ steps.get.outputs.env }}
steps:
- id: get
name: Get repositories information
run: |
TIME="$(curl https://api.github.com/repos/${SCRIPT_REPO}/actions/runs/${GITHUB_RUN_ID} | jq -r .created_at)"
SCRIPT_SHA=$(curl https://api.github.com/repos/${SCRIPT_REPO}/commits/${SCRIPT_REF} | jq -r .sha)
UBOOT_TAG=$(curl https://api.github.com/repos/${UBOOT_REPO}/releases/${UBOOT_RELEASE} | jq -r .tag_name)
ARMBIAN_SHA=$(curl https://api.github.com/repos/${ARMBIAN_REPO}/commits/${ARMBIAN_REF} | jq -r .sha)
cat <<EOF | sed -E 's/^ //' >>$GITHUB_ENV
TIME=$TIME
SCRIPT_SHA=$SCRIPT_SHA
UBOOT_TAG=$UBOOT_TAG
ARMBIAN_SHA=$ARMBIAN_SHA
EOF
echo "env=$(cat $GITHUB_ENV | base64 -w 0)" >>$GITHUB_OUTPUT
- name: Show repositories information
run: |
C_RESET="\e[0m"
C_BLACK="\e[30m"
C_RED="\e[31m"
C_GREEN="\e[32m"
C_YELLOW="\e[33m"
C_BLUE="\e[34m"
C_MAGENTA="\e[35m"
C_CYAN="\e[36m"
C_GRAY="\e[37m"
echo -e "$(cat <<EOF | sed -E 's/^ //'
TIME: ${C_GREEN}$(date -d "$TIME" +'%Y-%m-%d %H:%M:%S %Z(%:z)')${C_RESET}
Script: ${C_BLUE}${SCRIPT_REPO}${C_RESET}@${C_MAGENTA}${SCRIPT_REF}${C_RESET}(https://github.com/${SCRIPT_REPO}/tree/${SCRIPT_REF})
${C_YELLOW}${SCRIPT_SHA}${C_RESET}(https://github.com/${SCRIPT_REPO}/tree/${SCRIPT_SHA})
U-Boot: ${C_BLUE}${UBOOT_REPO}${C_RESET}@${C_MAGENTA}${UBOOT_RELEASE}${C_RESET}(https://github.com/${UBOOT_REPO}/releases/tag/${UBOOT_RELEASE})
${C_MAGENTA}${UBOOT_TAG}${C_RESET}(https://github.com/${UBOOT_REPO}/releases/tag/${UBOOT_TAG})
Armbian: ${C_BLUE}${ARMBIAN_REPO}${C_RESET}@${C_MAGENTA}${ARMBIAN_REF}${C_RESET}(https://github.com/${ARMBIAN_REPO}/tree/${ARMBIAN_REF})
${C_YELLOW}${ARMBIAN_SHA}${C_RESET}(https://github.com/${ARMBIAN_REPO}/tree/${ARMBIAN_SHA})
EOF
)"
if [[ -n "${PATCHES}" ]]; then
echo -e "\nPatches:"
while read -r id; do
echo -e " ${C_BLUE}armbian/build${C_RESET}#${C_MAGENTA}${id}${C_RESET}(http://github.com/armbian/build/pull/${id})"
done < <(echo -e "${PATCHES}" | tr ',' '\n')
fi
cat <<EOF | sed -E 's/^ //' >>$GITHUB_STEP_SUMMARY
# $(date -d "$TIME" +'%Y-%m-%d %H:%M:%S %Z(%:z)')
## Sources
Script: [${SCRIPT_REPO}@${SCRIPT_REF}](https://github.com/${SCRIPT_REPO}/tree/${SCRIPT_REF}) ([\`${SCRIPT_SHA}\`](https://github.com/${SCRIPT_REPO}/tree/${SCRIPT_SHA}))
U-Boot: [${UBOOT_REPO}@${UBOOT_RELEASE}](https://github.com/${UBOOT_REPO}/releases/tag/${UBOOT_RELEASE}) ([\`${UBOOT_TAG}\`](https://github.com/${UBOOT_REPO}/releases/tag/${UBOOT_TAG}))
Armbian: [${ARMBIAN_REPO}@${ARMBIAN_REF}](https://github.com/${ARMBIAN_REPO}/tree/${ARMBIAN_REF}) ([\`${ARMBIAN_SHA}\`](https://github.com/${ARMBIAN_REPO}/tree/${ARMBIAN_SHA}))
${PATCHES:+$(
echo "## Patches"
echo "${PATCHES}" | tr ',' '\n' | sed -E 's|(.*)|[armbian/build#\1](http://github.com/armbian/build/pull/\1)|'
)}
EOF
build-debs:
name: Build ${{ matrix.BRANCH }}
needs: prepare
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
BRANCH:
- edge
- current
steps:
- name: Import env
run: |
echo "$(echo "${{ needs.prepare.outputs.env }}" | base64 -d)" >>$GITHUB_ENV
- name: Checkout
uses: actions/checkout@v3
with:
repository: ${{ env.ARMBIAN_REPO }}
ref: ${{ env.ARMBIAN_SHA }}
- name: "Apply patch ${{ env.PATCHES }}"
if: ${{ env.PATCHES }}
run: |
echo "::group::Download"
curl -L -O "https://github.com/armbian/build/pull/{${PATCHES}}.patch"
echo "::endgroup::"
for file in *.patch; do
echo "::group::Applying $file"
patch --batch -p1 -N <"$file"
echo "::endgroup::"
done
- name: Build
run: |
# Don't update remote cache
export GITHUB_ACTIONS=false
sudo --preserve-env \
./compile.sh kernel \
ALLOW_ROOT=yes \
BOARD=onecloud \
BRANCH=${{ matrix.BRANCH }} \
EXPERT=yes \
USE_CCACHE=no
sudo chown $(id -u):$(id -g) -R output/
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: debs-${{ matrix.BRANCH }}
path: output/debs/*
build:
name: Build ${{ matrix.RELEASE }}-${{ matrix.BRANCH }}-${{ matrix.TYPE == 'desktop' && matrix.DESKTOP_ENVIRONMENT || matrix.TYPE }}
needs: [ prepare, build-debs ]
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
BRANCH:
- edge
- current
RELEASE:
# - focal # Ubuntu 20.04 LTS
- jammy # Ubuntu 22.04 LTS
# - lunar # Ubuntu 23.04
# - buster # Debian 10
- bullseye # Debian 11
- bookworm # Debian 12
- sid # Debian unstable
TYPE:
- minimal
- cli
- desktop
include:
- TYPE: desktop
DESKTOP_ENVIRONMENT: xfce
DESKTOP_ENVIRONMENT_CONFIG_NAME: config_base
DESKTOP_APPGROUPS_SELECTED: ""
exclude:
- RELEASE: sid
TYPE: desktop
steps:
- name: Import env
run: |
echo "$(echo "${{ needs.prepare.outputs.env }}" | base64 -d)" >>$GITHUB_ENV
- name: Checkout
uses: actions/checkout@v3
with:
repository: ${{ env.ARMBIAN_REPO }}
ref: ${{ env.ARMBIAN_SHA }}
- name: "Apply patch ${{ env.PATCHES }}"
if: ${{ env.PATCHES }}
run: |
echo "::group::Download"
curl -L -O "https://github.com/armbian/build/pull/{${PATCHES}}.patch"
echo "::endgroup::"
for file in *.patch; do
echo "::group::Applying $file"
patch --batch -p1 -N <"$file"
echo "::endgroup::"
done
- name: Download debs
uses: actions/download-artifact@v3
with:
name: debs-${{ matrix.BRANCH }}
path: output/debs/
- name: Build
run: |
# Don't update remote cache
export GITHUB_ACTIONS=false
sudo --preserve-env \
./compile.sh build \
ALLOW_ROOT=yes \
BOARD=onecloud \
BRANCH=${{ matrix.BRANCH }} \
RELEASE=${{ matrix.RELEASE }} \
KERNEL_CONFIGURE=no \
BUILD_MINIMAL=${{ matrix.TYPE == 'minimal' && 'yes' || 'no' }} \
BUILD_DESKTOP=${{ matrix.TYPE == 'desktop' && 'yes' || 'no' }} \
DESKTOP_ENVIRONMENT=${{ matrix.DESKTOP_ENVIRONMENT }} \
DESKTOP_ENVIRONMENT_CONFIG_NAME=${{ matrix.DESKTOP_ENVIRONMENT_CONFIG_NAME }} \
DESKTOP_APPGROUPS_SELECTED=${{ matrix.DESKTOP_APPGROUPS_SELECTED }} \
EXPERT=yes \
SKIP_EXTERNAL_TOOLCHAINS=yes \
CLEAN_LEVEL= \
USE_CCACHE=no \
COMPRESS_OUTPUTIMAGE=img
sudo chown $(id -u):$(id -g) -R output/
- name: Install Dependents
run: |
sudo apt install img2simg
ver="v0.3.1"
curl -L -o ./AmlImg https://github.com/hzyitc/AmlImg/releases/download/$ver/AmlImg_${ver}_linux_amd64
chmod +x ./AmlImg
- name: Download and unpack the latest u-boot
run: |
echo "::group::Download"
curl -L -o ./uboot.img https://github.com/${UBOOT_REPO}/releases/download/${UBOOT_TAG}/${UBOOT_BURNIMG}
echo "::endgroup::"
echo "::group::Unpack"
./AmlImg unpack ./uboot.img burn/
echo "::endgroup::"
- name: Extract boot and rootfs partitions
run: |
diskimg=$(ls output/images/*.img)
loop=$(sudo losetup --find --show --partscan $diskimg)
sudo img2simg ${loop}p1 burn/boot.simg
sudo img2simg ${loop}p2 burn/rootfs.simg
sudo losetup -d $loop
sudo chown $(id -u):$(id -g) -R burn/
- name: Generate burn image
run: |
echo -n "sha1sum $(sha1sum burn/boot.simg | awk '{print $1}')" >burn/boot.VERIFY
echo -n "sha1sum $(sha1sum burn/rootfs.simg | awk '{print $1}')" >burn/rootfs.VERIFY
cat <<EOF >>burn/commands.txt
PARTITION:boot:sparse:boot.simg
VERIFY:boot:normal:boot.VERIFY
PARTITION:rootfs:sparse:rootfs.simg
VERIFY:rootfs:normal:rootfs.VERIFY
EOF
prefix=$(ls output/images/*.img | sed 's/\.img$//')
burnimg=${prefix}.burn.img
./AmlImg pack $burnimg burn/
- name: Hash and compress images
run: |
for f in output/images/*.img; do
sha256sum "$f" >"${f}.sha"
xz --threads=0 --compress "$f"
done
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.RELEASE }}-${{ matrix.BRANCH }}-${{ matrix.TYPE == 'desktop' && matrix.DESKTOP_ENVIRONMENT || matrix.TYPE }}
path: output/images/*
release:
needs: [ prepare, build ]
runs-on: ubuntu-22.04
permissions:
contents: write
steps:
- name: Import env
run: |
echo "$(echo "${{ needs.prepare.outputs.env }}" | base64 -d)" >>$GITHUB_ENV
- name: Checkout
uses: actions/checkout@v3
- name: Download artifacts
uses: actions/download-artifact@v3
with:
path: artifacts/
- name: Generate sha256sum
run: |
touch sha256sum
for a in artifacts/*/*.sha; do
cat "$a" >>sha256sum
rm -f "$a"
done
- name: Show sha256sum
run: |
cat sha256sum
cat <<EOF | sed -E 's/^ //' >>$GITHUB_STEP_SUMMARY
# SHA256
$(cat sha256sum | awk '{printf "%s: `%s`\n", $2, $1}')
EOF
- name: Release
run: |
cat <<EOF | sed -E 's/^ //' >Release.md
CI $(date -d "$TIME" +'%Y-%m-%d %H:%M:%S %Z(%:z)')
# Sources
Script: [${SCRIPT_REPO}@${SCRIPT_REF}](https://github.com/${SCRIPT_REPO}/tree/${SCRIPT_REF}) ([\`${SCRIPT_SHA}\`](https://github.com/${SCRIPT_REPO}/tree/${SCRIPT_SHA}))
U-Boot: [${UBOOT_REPO}@${UBOOT_RELEASE}](https://github.com/${UBOOT_REPO}/releases/tag/${UBOOT_RELEASE}) ([\`${UBOOT_TAG}\`](https://github.com/${UBOOT_REPO}/releases/tag/${UBOOT_TAG}))
Armbian: [${ARMBIAN_REPO}@${ARMBIAN_REF}](https://github.com/${ARMBIAN_REPO}/tree/${ARMBIAN_REF}) ([\`${ARMBIAN_SHA}\`](https://github.com/${ARMBIAN_REPO}/tree/${ARMBIAN_SHA}))
${PATCHES:+$(
echo "# Patches"
echo "${PATCHES}" | tr ',' '\n' | sed -E 's|(.*)|[armbian/build#\1](http://github.com/armbian/build/pull/\1)|'
)}
# SHA256
$(cat sha256sum | awk '{printf "%s: `%s`\n", $2, $1}')
EOF
tag="ci-$(date -d "$TIME" -u +'%Y%m%d-%H%M%S-%Z')"
hub release create -t "$GITHUB_SHA" "$tag" -F Release.md \
-a sha256sum \
$(for a in artifacts/*/Armbian_*; do echo -a $a; done) \
$(for a in artifacts/*/linux-{image,headers,dtb}-*; do echo -a $a; done)
env:
GITHUB_TOKEN: ${{ github.token }}