127 lines
3.5 KiB
YAML
127 lines
3.5 KiB
YAML
name: Build Deb Package
|
|
|
|
on: [push, pull_request]
|
|
|
|
concurrency:
|
|
group: ${{ github.repository }}-${{ github.event.number || github.head_ref || github.sha }}-${{ github.workflow }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
matrix:
|
|
os: [ubuntu-20.04]
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
with:
|
|
submodules: true
|
|
|
|
- name: Get time
|
|
run: |
|
|
date +'%Y-%m' > snapshot.txt
|
|
|
|
- name: Cache for cccahe
|
|
uses: actions/cache@v2
|
|
with:
|
|
path: /home/runner/.ccache
|
|
key: ${{ runner.os }}-deb-ccache-${{ hashFiles('**/snapshot.txt') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-deb-ccache-
|
|
|
|
- name: Install dependencies for Linux
|
|
if: runner.os == 'Linux'
|
|
run: |
|
|
sudo apt update -y
|
|
sudo apt install -y ca-certificates \
|
|
ccache \
|
|
cmake \
|
|
debhelper \
|
|
devscripts \
|
|
libboost-all-dev \
|
|
libcpprest-dev \
|
|
libcurl4-openssl-dev \
|
|
libssl-dev \
|
|
libz-dev \
|
|
lsb-release \
|
|
openssl \
|
|
screenfetch \
|
|
wget
|
|
|
|
- name: Install grpc for Ubuntu 20.04
|
|
if: matrix.os == 'ubuntu-20.04'
|
|
run: |
|
|
sudo apt install -y libcurl4-openssl-dev \
|
|
libprotobuf-dev \
|
|
libprotoc-dev \
|
|
libgrpc-dev \
|
|
libgrpc++-dev \
|
|
protobuf-compiler-grpc
|
|
|
|
- name: Screen fetch
|
|
run: |
|
|
screenfetch
|
|
|
|
- name: Setup tmate session
|
|
if: false
|
|
uses: mxschmitt/action-tmate@v2
|
|
|
|
- name: Prepare gpg environment
|
|
run: |
|
|
cat > gpg-script <<EOF
|
|
%echo Generating a OpenPGP key
|
|
Key-Type: DSA
|
|
Key-Length: 1024
|
|
Subkey-Type: ELG-E
|
|
Subkey-Length: 1024
|
|
Name-Real: Tao He
|
|
Name-Email: sighingnow@gmail.com
|
|
Expire-Date: 0
|
|
Passphrase: etcd-passphrase
|
|
# Do a commit here, so that we can later print "done" :-)
|
|
%commit
|
|
%echo done
|
|
EOF
|
|
|
|
gpg --batch --gen-key gpg-script
|
|
|
|
- name: CMake
|
|
run: |
|
|
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
|
|
|
|
mkdir -p build
|
|
cd build
|
|
cmake .. -DCMAKE_CXX_STANDARD=17 \
|
|
-DCMAKE_CXX_STANDARD_REQUIRED=TRUE \
|
|
-DBUILD_ETCD_TESTS=ON \
|
|
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
|
|
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache
|
|
|
|
- name: Generate PPA source tarball
|
|
if: false
|
|
run: |
|
|
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
|
|
|
|
mkdir -p build
|
|
cd build
|
|
|
|
- name: Generate Deb package
|
|
run: |
|
|
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
|
|
|
|
mkdir -p build
|
|
cd build
|
|
|
|
cpack -G DEB
|
|
|
|
- name: Upload deb package
|
|
if: always()
|
|
uses: actions/upload-artifact@v2
|
|
with:
|
|
name: deb package
|
|
path: build/*.deb
|
|
|
|
- name: Check ccache
|
|
run: |
|
|
ccache --show-stats
|