Files
kumomta/.github/workflows/centos7.yml
T

113 lines
3.3 KiB
YAML

name: CentOS7
on:
push:
branches: [ "main" ]
paths-ignore:
- "docs/*"
- ".github/workflows/pages.yml"
- ".github/workflows/verify-pages.yml"
- ".github/ISSUE_TEMPLATE/*"
- "**/*.md"
- "**/*.markdown"
pull_request:
branches: [ "main" ]
paths-ignore:
- "docs/*"
- ".github/workflows/pages.yml"
- ".github/workflows/verify-pages.yml"
- ".github/ISSUE_TEMPLATE/*"
- "**/*.md"
- "**/*.markdown"
env:
CARGO_TERM_COLOR: always
jobs:
build:
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"
- 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 Rust"
uses: actions-rs/toolchain@v1
with:
profile: "minimal"
toolchain: "stable"
override: true
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: "true"
- uses: actions/checkout@v3
- name: Install cargo-nextest
uses: baptiste0928/cargo-install@v1
with:
crate: cargo-nextest
args: --locked
- uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
env-vars: "CARGO RUST"
- 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"
run: "./assets/build-rpm.sh"
- name: "Move RPM"
run: "mv ~/rpmbuild/RPMS/*/*.rpm ."
- name: "Sign"
if: ${{ github.ref == 'refs/heads/main' }}
env:
PUB: ${{ secrets.OPENREPO_GPG_PUBLIC }}
PRIV: ${{ secrets.OPENREPO_GPG_PRIVATE }}
TOKEN: ${{ secrets.OPENREPO_API_TOKEN }}
shell: bash
run: |
t=$(mktemp)
printenv PUB > $t
gpg --batch --import $t
printenv PRIV > $t
gpg --batch --import $t
rpmsign --define '_signature gpg' --define '_gpg_name KumoMTA Signing Key' --addsign *.rpm
printenv TOKEN > $t
for rpm in *.rpm ; do
curl -X POST https://openrepo.kumomta.com/api/kumomta-centos7-dev/upload/ \
-H "Authorization: Token $(< $t)" \
-F "package_file=@$rpm" -i
done
- name: "Upload artifact"
uses: actions/upload-artifact@v3
with:
name: "centos7"
path: "kumomta-*.rpm"