Skip to content

Build package and push #5

Build package and push

Build package and push #5

name: Build package and push
permissions:
contents: write
on:
push:
tags:
- v[0-9]+.*
workflow_dispatch:
inputs:
tag:
description: 'tag'
required: true
env:
CARGO_TERM_COLOR: always
jobs:
build:
env:
SCCACHE_GHA_ENABLED: "true"
RUSTC_WRAPPER: "sccache"
strategy:
matrix:
target:
- aarch64-unknown-linux-gnu
- x86_64-unknown-linux-gnu
runs-on: ubuntu-latest
container:
image: "centos:7"
steps:
- name: Get tag
id: get-tag
run: |
if [[ "${{ github.event_name }}" = "workflow_dispatch" ]]; then
echo "TAG=${{ github.event.inputs.tag }}" >> "$GITHUB_OUTPUT"
else
echo "TAG=${{ github.ref_name }}" >> "$GITHUB_OUTPUT"
fi
- uses: actions/checkout@v1
# - name: Prepare Rust for Centos7
# uses: ./.github/actions/centos7
- name: Install build tools
shell: bash
run: |
yum install which -y
yum -y install ruby rubygems ruby-devel
curl -sSL https://rvm.io/pkuczynski.asc | gpg2 --import
curl -L http://get.rvm.io | bash -s stable
source /usr/local/rvm/scripts/rvm
rvm install 2.5.0
gem install fpm
- name: Compiler
run: |
source "$HOME/.cargo/env"
if [[ "${{ matrix.target }}" = "aarch64-unknown-linux-gnu" ]]; then
# sudo apt install gcc-aarch64-linux-gnu
# centos7
yum -y install epel-release \
&& yum -y install gcc-aarch64-linux-gnu gcc-c++-aarch64-linux-gnu \
&& yum install -y http://springdale.princeton.edu/data/springdale/7/x86_64/os/Computational/glibc-aarch64-linux-gnu-2.24-2.sdl7.2.noarch.rpm \
&& yum install -y http://springdale.princeton.edu/data/springdale/7/x86_64/os/Computational/glibc-aarch64-linux-gnu-devel-2.24-2.sdl7.2.noarch.rpm
rustup target add aarch64-unknown-linux-gnu
RUSTFLAGS="-C linker=aarch64-linux-gnu-gcc" cargo build --workspace --bins --release --target aarch64-unknown-linux-gnu
else
cargo build --workspace --bins --release --target x86_64-unknown-linux-gnu
fi
- name: Package
run: |
bash -x ./packages/build_package.sh -n cnosdb -v ${{ steps.get-tag.outputs.TAG }} -b release -t ${{ matrix.target }}
bash -x ./packages/build_package.sh -n cnosdb-meta -v ${{ steps.get-tag.outputs.TAG }} -b release -t ${{ matrix.target }}
- name: Release
uses: softprops/action-gh-release@v1
with:
files: |
*.deb
*.rpm
tag_name: ${{ steps.get-tag.outputs.TAG }}
# build-windows:
# runs-on: windows-latest
# steps:
# - name: Get tag
# id: get-tag
# shell: bash
# run: |
# if [[ "${{ github.event_name }}" = "workflow_dispatch" ]]; then
# echo "TAG=${{ github.event.inputs.tag }}" >> "$GITHUB_OUTPUT"
# else
# echo "TAG=${{ github.ref_name }}" >> "$GITHUB_OUTPUT"
# fi
# - uses: actions/checkout@v3
# - name: Install Dependencies
# shell: bash
# run: |
# TARGETPLATFORM="windows/amd64" bash ./.github/tools/install_dependencies.sh
# - name: Compiler
# run: cargo build --workspace --bins --release --target x86_64-pc-windows-msvc
# - name: Package
# run: |
# New-Item -ItemType Directory -Path .\windows
# Copy-Item -Path .\target\x86_64-pc-windows-msvc\release\cnosdb.exe -Destination .\windows\cnosdb.exe
# Copy-Item -Path .\target\x86_64-pc-windows-msvc\release\cnosdb-meta.exe -Destination .\windows\cnosdb-meta.exe
# Copy-Item -Path .\target\x86_64-pc-windows-msvc\release\cnosdb-cli.exe -Destination .\windows\cnosdb-cli.exe
# Copy-Item -Path .\config\config.toml -Destination .\windows\cnosdb.conf
# Copy-Item -Path .\meta\config\config.toml -Destination .\windows\cnosdb-meta.conf
# Compress-Archive -Path .\windows\* -Destination .\cnosdb-community-${{ steps.get-tag.outputs.TAG }}-windows_x86_64.zip
# - name: Release
# uses: softprops/action-gh-release@v1
# with:
# files: |
# *windows_x86_64.zip
# tag_name: ${{ steps.get-tag.outputs.TAG }}