update0905 #10
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
name: build package | |
on: | |
pull_request: | |
branches: | |
- master | |
push: | |
branches: | |
- master | |
- jingyd6_obdiag240 | |
env: | |
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true | |
jobs: | |
build-rpm: | |
name: Run on CentOS 7 | |
runs-on: ubuntu-latest | |
container: | |
image: "centos:7" | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Install dependencies | |
run: | | |
rm -rf /etc/yum.repos.d/* | |
curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo | |
yum install -y wget | |
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh --no-check-certificate | |
sh Miniconda3-latest-Linux-x86_64.sh -p /opt/miniconda3 -b | |
export PATH=/opt/miniconda3/bin:$PATH | |
conda init | |
conda create --name obdiag python=3.8 -y | |
source activate obdiag | |
ldd --version | |
python3 -m pip install --upgrade pip setuptools wheel | |
pip3 install -r requirements3.txt | |
python3 --version | |
yum install rpm-build -y | |
- name: Build package | |
run: | | |
export PATH=/opt/miniconda3/bin:$PATH | |
source activate obdiag | |
pwd | |
ls -lh | |
export RELEASE=`date +%Y%m%d%H%M` | |
sed -i 's/pip install -r requirements3.txt/curl https:\/\/bootstrap.pypa.io\/get-pip.py -o get-pip.py\n\ | |
python3 get-pip.py\n\ | |
pip3 install -r requirements3.txt/' ./rpm/oceanbase-diagnostic-tool.spec | |
cat ./rpm/oceanbase-diagnostic-tool.spec | |
python3 -m pip install --upgrade pip setuptools wheel | |
python3 --version | |
rpmbuild -bb ./rpm/oceanbase-diagnostic-tool.spec | |
- name: Find rpm | |
run: | | |
find / -name oceanbase-diagnostic-tool-*.rpm | |
- name: "Upload rpm" | |
uses: actions/upload-artifact@v3 | |
with: | |
name: obdiag-rpm-packages | |
path: | | |
/github/home/rpmbuild/RPMS/x86_64/oceanbase-diagnostic-tool-*.rpm | |
retention-days: 3 | |
debug: true | |
convert-to-deb: | |
needs: build-rpm | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Download RPM Artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: obdiag-rpm-packages | |
path: . | |
- name: Install Alien | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y alien | |
- name: Convert RPM to DEB | |
run: | | |
sudo alien -k --scripts oceanbase-diagnostic-tool-*.rpm | |
pwd | |
- name: Upload DEB Artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: obdiag-deb-package | |
path: ./oceanbase-diagnostic-tool_*.deb | |
retention-days: 3 |