Skip to content

CI Update Golang version #11

CI Update Golang version

CI Update Golang version #11

Workflow file for this run

name: CI
on:
workflow_dispatch:
push:
jobs:
build:
runs-on: ubuntu-20.04
steps:
- name: Free disk space
run: |
sudo rm -rf /usr/share/dotnet /usr/local/lib/android
- name: Install dependencies
run: |
sudo add-apt-repository ppa:npalix/coccinelle
sudo apt update
sudo apt install build-essential clang flex g++ gawk gcc-multilib gettext \
git libncurses5-dev libssl-dev python3-distutils rsync unzip zlib1g-dev \
coccinelle
- name: Checkout
uses: actions/checkout@v3
- name: Hook the openwrt_core URL for opkg
run: |
OWNER="${GITHUB_REPOSITORY%%/*}"
REPO="${GITHUB_REPOSITORY#*/}"
TIME="$(curl "https://api.github.com/repos/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}" | jq -r .created_at)"
echo "ci-$(date -d "${TIME}" -u +'%Y%m%d-%H%M%S')-${GITHUB_SHA:0:8}" >version
sed -i "s|%U/targets/%S/packages|https://${OWNER}.github.io/${REPO}/${GITHUB_REF_NAME}/%R|" include/feeds.mk
- name: Update and install feeds
run: |
./scripts/feeds update -a
./scripts/feeds install -a
# update golang
rm -rf feeds/packages/lang/golang
git clone https://github.com/sbwml/packages_lang_golang -b 22.x feeds/packages/lang/golang
# - name: CR880x Configure
# run: |
# cat <<EOF | sed -E 's/^ //' >.config
# CONFIG_TARGET_ipq50xx=y
# CONFIG_TARGET_ipq50xx_arm=y
# CONFIG_TARGET_MULTI_PROFILE=y
# CONFIG_TARGET_ALL_PROFILES=y
# CONFIG_TARGET_PER_DEVICE_ROOTFS=y
# CONFIG_ATH11K_MEM_PROFILE_256M=y
# CONFIG_IB=y
# # CONFIG_IB_STANDALONE is not set
# CONFIG_SDK=y
# CONFIG_MAKE_TOOLCHAIN=y
# CONFIG_ALL_NONSHARED=y
# CONFIG_REPRODUCIBLE_DEBUG_INFO=y
# CONFIG_PACKAGE_kmod-bonding=y
# CONFIG_PACKAGE_kmod-qca-nss-ecm-standard=y
# CONFIG_PACKAGE_kmod-qca-nss-drv-pppoe=y
# CONFIG_PACKAGE_luci=y
# EOF
# make defconfig
# - name: Merge custom config
# run: |
# ./scripts/diffconfig.sh
- name: Download
run: |
make -j8 download
# - name: Build tools
# run: |
# make -j$(nproc) tools/install
# - name: Build toolchain
# run: |
# make -j$(nproc) toolchain/install
- name: Build all with error handle
run: |
# make -j$(nproc) IGNORE_ERRORS=1
make -j$(nproc) download && make -j$(nproc) tools/install && make -j$(nproc) toolchain/install && make -j$(nproc) IGNORE_ERRORS=1 || make -j1 V=s
- name: Upload bin to artifacts
uses: actions/upload-artifact@v3
with:
name: bin-ipq50xx-arm
path: bin/targets/ipq50xx/arm/*
- name: Upload dl to artifacts
uses: actions/upload-artifact@v3
with:
name: dl
path: dl/*
gh-pages:
needs: [build]
runs-on: ubuntu-20.04
permissions:
contents: write
steps:
- name: Checkout gh-pages
uses: actions/checkout@v3
with:
path: "gh-pages"
ref: "gh-pages"
fetch-depth: 0
- name: Configure the git user
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
- name: Drop old versions
run: |
cd gh-pages
readarray -t old_version < <(git log --format='%h' -- "${GITHUB_REF_NAME}" | tail -n +10)
GIT_SEQUENCE_EDITOR="sed -i '1 i break'" git rebase --interactive --committer-date-is-author-date --root
for commit in "${old_version[@]}"; do
sed -i "/${commit}/d" .git/rebase-merge/git-rebase-todo
done
git rebase --continue
- name: Download bin from artifacts
uses: actions/download-artifact@v3
with:
name: bin-ipq50xx-arm
path: bin/
- name: Copy contents
run: |
version="$(cat "bin/version.buildinfo")"
mkdir -p "gh-pages/${GITHUB_REF_NAME}/${version}/"
cp -avr bin/packages/* "gh-pages/${GITHUB_REF_NAME}/${version}/"
- name: Commit
run: |
cd gh-pages
git add .
git commit -m "Add: ${GITHUB_REF_NAME}: $(cat ../bin/version.buildinfo)"
- name: Publish
run: |
cd gh-pages
git push -f origin gh-pages
release:
needs: [build]
runs-on: ubuntu-20.04
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Download dl from artifacts
uses: actions/download-artifact@v3
with:
name: dl
path: dl/
- name: Download bin from artifacts
uses: actions/download-artifact@v3
with:
name: bin-ipq50xx-arm
path: bin/targets/ipq50xx/arm/
- name: Tar
run: |
tar cvf dl.tar -C dl/ .
tar cvf bin-ipq50xx.tar -C bin/targets/ipq50xx/arm/ .
- name: Generate release informations
run: |
TIME="$(curl "https://api.github.com/repos/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}" | jq -r .created_at)"
TAG="ci-${GITHUB_REF_NAME}-$(date -d "${TIME}" -u +'%Y%m%d-%H%M%S-%Z')"
echo "TAG=$TAG" >>$GITHUB_ENV
cat <<EOF | sed -E 's/^ //' >Release.md
CI ${GITHUB_REF_NAME} $(date -d "${TIME}" -u +'%Y-%m-%d %H:%M:%S %Z(%:z)')
# ${GITHUB_REF_NAME}
Build time: \`$(date -d "${TIME}" -u +'%Y-%m-%d %H:%M:%S %Z(%:z)')\`
Release version: ${TAG}
## Sources
$(cat bin/targets/ipq50xx/arm/feeds.buildinfo | awk -F'[ ^]' '{printf "%s: `%s`\n", $2, $4}')
## SHA256
$(cat bin/targets/ipq50xx/arm/sha256sums | awk '{printf "%s: `%s`\n", $2, $1}' | sed -E 's/^\*//')
EOF
echo "NAME=$(head --line=1 Release.md)" >>$GITHUB_ENV
tail --line=+2 Release.md >Body.md
- name: Release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ env.TAG }}
target_commitish: ${{ github.sha }}
name: ${{ env.NAME }}
body_path: Body.md
files: |
bin/targets/ipq50xx/arm/sha256sums
bin/targets/ipq50xx/arm/*.*
*.tar