-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #154 from Teingi/master
github Action build obdiag rpm
- Loading branch information
Showing
2 changed files
with
50 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
name: build rpm | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- master | ||
push: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
build-and-package-x86_64: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v3 | ||
with: | ||
python-version: '3.8' | ||
|
||
- name: Install dependencies | ||
run: | | ||
python3 -m pip install --upgrade pip setuptools wheel | ||
pip3 install -r requirements3.txt | ||
- name: Set up RPM build env | ||
run: | | ||
sudo apt-get update && sudo apt-get install -y rpm | ||
- name: Build package | ||
run: | | ||
pwd | ||
ls -lh | ||
export RELEASE=`date +%Y%m%d%H%M` | ||
cat ./rpm/oceanbase-diagnostic-tool.spec | ||
rpmbuild -bb ./rpm/oceanbase-diagnostic-tool.spec | ||
- name: 'Upload Artifact' | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: obdiag | ||
path: /home/runner/rpmbuild/RPMS/x86_64/oceanbase-diagnostic-tool-*.rpm | ||
retention-days: 3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
Name: oceanbase-diagnostic-tool | ||
Version:2.0.0 | ||
Release: %(echo $RELEASE)%{?dist} | ||
Release: 1%{?dist} | ||
Summary: oceanbase diagnostic tool program | ||
Group: Development/Tools | ||
Url: [email protected]:oceanbase/oceanbase-diagnostic-tool.git | ||
|
@@ -16,23 +16,15 @@ oceanbase diagnostic tool program | |
|
||
%install | ||
RPM_DIR=$OLDPWD | ||
SRC_DIR=$OLDPWD/.. | ||
SRC_DIR=$OLDPWD | ||
BUILD_DIR=$OLDPWD/rpmbuild | ||
cd $SRC_DIR/ | ||
rm -rf build.log build dist oceanbase-diagnostic-tool.spec | ||
if [ `git log |head -n1 | awk -F' ' '{print $2}'` ]; then | ||
CID=`git log |head -n1 | awk -F' ' '{print $2}'` | ||
BRANCH=`git rev-parse --abbrev-ref HEAD` | ||
else | ||
CID='UNKNOWN' | ||
BRANCH='UNKNOWN' | ||
fi | ||
DATE=`date '+%b %d %Y %H:%M:%S'` | ||
DATE=`date` | ||
VERSION="$RPM_PACKAGE_VERSION" | ||
|
||
source py-env-activate py38 | ||
cd $SRC_DIR | ||
pip install -r requirements3.txt -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com | ||
pwd | ||
cp -f main.py obdiag.py | ||
sed -i "s/<B_TIME>/$DATE/" ./common/version.py && sed -i "s/<VERSION>/$VERSION/" ./common/version.py | ||
mkdir -p $BUILD_DIR/SOURCES ${RPM_BUILD_ROOT} | ||
|