mirror of
https://github.com/mailscope/kumomta.git
synced 2026-09-10 20:42:14 +00:00
115 lines
3.4 KiB
YAML
115 lines
3.4 KiB
YAML
name: CentOS7
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- "20*"
|
|
branches: [ "main" ]
|
|
paths:
|
|
- "crates/**/*.rs"
|
|
- ".github/workflows/centos7.yml"
|
|
- "**/Cargo.toml"
|
|
- "get-deps.sh"
|
|
- "assets/build-rpm.sh"
|
|
- "assets/sign-rpm.sh"
|
|
- "assets/upload-package.sh"
|
|
|
|
pull_request:
|
|
branches: [ "main" ]
|
|
paths:
|
|
- "crates/**/*.rs"
|
|
- ".github/workflows/centos7.yml"
|
|
- "**/Cargo.toml"
|
|
- "get-deps.sh"
|
|
- "assets/build-rpm.sh"
|
|
- "assets/sign-rpm.sh"
|
|
- "assets/upload-package.sh"
|
|
|
|
env:
|
|
CARGO_TERM_COLOR: always
|
|
|
|
jobs:
|
|
build-centos7:
|
|
runs-on: ubuntu-latest
|
|
container: "quay.io/centos/centos:centos7"
|
|
|
|
steps:
|
|
- name: "Install SCL"
|
|
run: "yum install -y centos-release-scl-rh"
|
|
- name: "Update compiler"
|
|
run: "yum install -y llvm-toolset-7 devtoolset-9-gcc devtoolset-9-gcc-c++"
|
|
- name: "More deps"
|
|
run: "yum install -y wget curl-devel expat-devel gettext-devel openssl-devel zlib-devel gcc perl-ExtUtils-MakeMaker make curl snappy snappy-devel zlib zlib-devel bzip2 bzip2-devel lz4-devel gflags rpm-build rpm-sign epel-release"
|
|
- name: "Cache Git installation"
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: "/usr/local/git"
|
|
key: "centos7-git-2.26.2"
|
|
- name: "Install Git from source"
|
|
shell: bash
|
|
run: |
|
|
if test ! -x /usr/local/git/bin/git ; then
|
|
cd /tmp
|
|
wget https://github.com/git/git/archive/v2.26.2.tar.gz
|
|
tar xzf v2.26.2.tar.gz
|
|
cd git-2.26.2
|
|
make prefix=/usr/local/git install
|
|
fi
|
|
ln -s /usr/local/git/bin/git /usr/local/bin/git
|
|
- name: "Install Rustup"
|
|
shell: bash
|
|
run: |
|
|
if ! command -v rustup &>/dev/null; then
|
|
curl --proto '=https' --tlsv1.2 --retry 10 -fsSL "https://sh.rustup.rs" | sh -s -- --default-toolchain none -y
|
|
echo "${CARGO_HOME:-$HOME/.cargo}/bin" >> $GITHUB_PATH
|
|
fi
|
|
- name: "Setup Toolchain"
|
|
shell: bash
|
|
run: |
|
|
rustup toolchain install stable --profile minimal --no-self-update
|
|
rustup default stable
|
|
- uses: actions/checkout@v3
|
|
- uses: Swatinem/rust-cache@v2
|
|
with:
|
|
cache-on-failure: true
|
|
env-vars: "CARGO RUST"
|
|
- name: Get Deps
|
|
run: bash ./get-deps.sh
|
|
- name: Install cargo-nextest
|
|
uses: baptiste0928/cargo-install@v2
|
|
with:
|
|
crate: cargo-nextest
|
|
- name: Build
|
|
run: |
|
|
source /opt/rh/devtoolset-9/enable
|
|
source /opt/rh/llvm-toolset-7/enable
|
|
cargo build --release
|
|
- name: Run tests
|
|
run: |
|
|
source /opt/rh/devtoolset-9/enable
|
|
source /opt/rh/llvm-toolset-7/enable
|
|
cargo nextest run --release
|
|
- name: "Build RPM"
|
|
env:
|
|
REF_TYPE: ${{ github.ref_type }}
|
|
run: "./assets/build-rpm.sh"
|
|
- name: "Move RPM"
|
|
run: "mv ~/rpmbuild/RPMS/*/*.rpm ."
|
|
- name: "Sign"
|
|
if: ${{ github.ref == 'refs/heads/main' || github.ref_type == 'tag' }}
|
|
env:
|
|
PUB: ${{ secrets.OPENREPO_GPG_PUBLIC }}
|
|
PRIV: ${{ secrets.OPENREPO_GPG_PRIVATE }}
|
|
TOKEN: ${{ secrets.OPENREPO_API_TOKEN }}
|
|
REF_TYPE: ${{ github.ref_type }}
|
|
shell: bash
|
|
run: |
|
|
./assets/sign-rpm.sh *.rpm
|
|
./assets/upload-package.sh centos:7 *.rpm
|
|
- name: "Upload artifact"
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: "centos7"
|
|
path: "kumomta*.rpm"
|
|
|