mirror of https://github.com/sysown/proxysql
parent
f2b39f11a3
commit
4f4cd87407
@ -1,194 +0,0 @@
|
||||
name: CI-package-build
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
workflow_call:
|
||||
inputs:
|
||||
trigger:
|
||||
type: string
|
||||
|
||||
env:
|
||||
SHA: ${{ inputs.trigger && fromJson(inputs.trigger).event.workflow_run.head_sha || github.sha }}
|
||||
BRANCH: ${{ inputs.trigger && fromJson(inputs.trigger).event.workflow_run.head_branch || github.ref_name }}
|
||||
BIN_PKG:
|
||||
|
||||
jobs:
|
||||
clean:
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- name: Clean packages
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
# gh release delete-asset ${BRANCH}-head
|
||||
gh release delete ${BRANCH}-head --repo ${{ github.repository }} --cleanup-tag || true
|
||||
gh release create ${BRANCH}-head --repo ${{ github.repository }} --title ${BRANCH}-head --draft --prerelease --notes-file - << EOF
|
||||
## Development Snapshot
|
||||
|
||||
GH-Action Package-Build on ${BRANCH} merge
|
||||
|
||||
Version : **${GIT_VERSION}**
|
||||
|
||||
Started : **$(date '+%Y-%m-%d %H:%M:%S %Z')**
|
||||
|
||||
Status : **Build in progress**
|
||||
|
||||
[](https://github.com/${{ github.repository }}/actions/workflows/CI-package-build.yml)
|
||||
|
||||
EOF
|
||||
|
||||
select:
|
||||
runs-on: ubuntu-22.04
|
||||
outputs:
|
||||
dists: ${{ steps.select.outputs.dists }}
|
||||
steps:
|
||||
- name: Select distros
|
||||
id: select
|
||||
run: |
|
||||
set -x
|
||||
fn_get_targets () {
|
||||
# make -n amd64-packages | grep -i binaries/proxysql | wc -l
|
||||
# make -n arm64-packages | grep -i binaries/proxysql | wc -l
|
||||
# recursive get targets
|
||||
[[ -z ${MKFL} ]] && MKFL=$(curl -sL https://raw.githubusercontent.com/sysown/proxysql/${BRANCH}/Makefile)
|
||||
for TRG in ${@}; do
|
||||
local SUBTRG=$(echo "${MKFL}" | grep "${TRG}:")
|
||||
if [[ "${SUBTRG#*:}" =~ (arm64|amd64) ]]; then
|
||||
fn_get_targets ${SUBTRG#*:}
|
||||
else
|
||||
echo "${SUBTRG#*: }" | sed 's/ /\n/g'
|
||||
fi
|
||||
done
|
||||
}
|
||||
echo "dists=$(fn_get_targets amd64-packages | sed 's/-clang//g; s/-dbg//g' | sort | uniq | jq -Rcs 'split("\n") | .[:-1]')" >> $GITHUB_OUTPUT
|
||||
#echo "dists=$(fn_get_targets arm64-packages | sed 's/-clang//g; s/-dbg//g' | sort | uniq | jq -Rcs 'split("\n") | .[:-1]')" >> $GITHUB_OUTPUT
|
||||
#echo "dists=$(make pkglist | sed 's/proxysql[_0-9.-]*//g; s/[._].*//; s/dbg-//; s/-clang//' | sort | uniq | jq -Rcs 'split("\n") | .[:-1]')" >> $GITHUB_OUTPUT
|
||||
|
||||
build:
|
||||
needs: [ clean, select ]
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
# # v2.7
|
||||
# dist: [ 'almalinux8','almalinux9','centos7','centos8','centos9','debian10','debian11','debian12','fedora38','fedora39','fedora40','fedora41','opensuse15','ubuntu16','ubuntu18','ubuntu20','ubuntu22','ubuntu24' ]
|
||||
# # v3.0
|
||||
# dist: [ 'almalinux8','almalinux9','centos9','debian12','fedora40','fedora41','opensuse15','ubuntu22','ubuntu24' ]
|
||||
arch: [ '', '-arm' ]
|
||||
dist: ${{ fromJson(needs.select.outputs.dists) }}
|
||||
type: [ '','-dbg','-clang' ]
|
||||
exclude:
|
||||
# broken - clang too old
|
||||
- dist: 'centos7'
|
||||
type: '-clang'
|
||||
- dist: 'debian10'
|
||||
type: '-clang'
|
||||
- dist: 'ubuntu16'
|
||||
type: '-clang'
|
||||
- dist: 'ubuntu18'
|
||||
type: '-clang'
|
||||
|
||||
runs-on: ubuntu-24.04${{ matrix.arch }}
|
||||
env:
|
||||
ARCH: ${{ runner.arch }}
|
||||
DIST: ${{ matrix.dist }}
|
||||
TYPE: ${{ matrix.type }}
|
||||
MATRIX: '(${{ matrix.dist }},${{ matrix.type }},${{ runner.arch }})'
|
||||
|
||||
steps:
|
||||
|
||||
- uses: LouisBrunner/checks-action@v2.0.0
|
||||
id: checks
|
||||
if: always()
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
name: '${{ github.workflow }} / ${{ github.job }} ${{ env.MATRIX }}'
|
||||
repo: ${{ github.repository }}
|
||||
sha: ${{ env.SHA }}
|
||||
status: 'in_progress'
|
||||
# action_url: 'https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}'
|
||||
details_url: 'https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}'
|
||||
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
repository: ${{ github.repository }}
|
||||
ref: ${{ env.SHA }}
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Set GIT_VERSION
|
||||
run: |
|
||||
git fetch --tags --force
|
||||
echo "GIT_VERSION=$(git describe --long --abbrev=7)" >> $GITHUB_ENV
|
||||
|
||||
- name: Update release
|
||||
if: ${{ !cancelled() }}
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
if [[ "${{ matrix.dist }}" = "centos9" ]] && [[ "${{ matrix.type }}" = "" && [[ "${{ runner.arch }}" = "X64" ]]; then
|
||||
gh release edit ${BRANCH}-head --draft --prerelease --repo ${{ github.repository }} --tag ${BRANCH}-head --title "${BRANCH}-head - ${GIT_VERSION}" --notes-file - << EOF
|
||||
## Development Snapshot
|
||||
|
||||
GH-Action Package-Build on ${BRANCH} merge
|
||||
|
||||
Version : **${GIT_VERSION}**
|
||||
|
||||
Updated : **$(date '+%Y-%m-%d %H:%M:%S %Z')**
|
||||
|
||||
Status : **Build in progress**
|
||||
|
||||
[](https://github.com/${{ github.repository }}/actions/workflows/CI-package-build.yml)
|
||||
|
||||
EOF
|
||||
fi
|
||||
|
||||
- name: Build package
|
||||
run: |
|
||||
make ${{ matrix.dist }}${{ matrix.type }}
|
||||
echo "BIN_PKG=$(ls -1 binaries/*[mb])" >> $GITHUB_ENV
|
||||
echo "BIN_HASH=$(ls -1 binaries/*.id-hash)" >> $GITHUB_ENV
|
||||
|
||||
- name: Push packages
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
# git tag --force -a ${BRANCH}-head -m 'GH-Actions - Development Snapshot Build'
|
||||
# git push origin --tags
|
||||
# gh release upload ${BRANCH}-head --repo ${{ github.repository }} --clobber binaries/proxysql*${{ matrix.dist }}*[mb]
|
||||
gh release upload ${BRANCH}-head --repo ${{ github.repository }} --clobber ${{ env.BIN_PKG }}
|
||||
|
||||
- uses: LouisBrunner/checks-action@v2.0.0
|
||||
if: always()
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
check_id: ${{ steps.checks.outputs.check_id }}
|
||||
repo: ${{ github.repository }}
|
||||
sha: ${{ env.SHA }}
|
||||
conclusion: ${{ job.status }}
|
||||
# action_url: 'https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}'
|
||||
details_url: 'https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}'
|
||||
|
||||
finalize:
|
||||
runs-on: ubuntu-22.04
|
||||
needs: [ build ]
|
||||
steps:
|
||||
- name: Update release
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
GIT_VERSION=$(gh release --repo ${{ github.repository }} view ${BRANCH}-head | tr -d '*' | grep -Po "(?<=Version : ).*")
|
||||
gh release edit ${BRANCH}-head --draft --prerelease --repo ${{ github.repository }} --tag ${BRANCH}-head --notes-file - << EOF
|
||||
## Development Snapshot
|
||||
|
||||
GH-Action Package-Build on ${BRANCH} merge
|
||||
|
||||
Version : **${GIT_VERSION}**
|
||||
|
||||
Finished : **$(date '+%Y-%m-%d %H:%M:%S %Z')**
|
||||
|
||||
Status : **Build is finished**
|
||||
|
||||
[](https://github.com/${{ github.repository }}/actions/workflows/CI-package-build.yml)
|
||||
|
||||
EOF
|
||||
|
||||
Loading…
Reference in new issue