mirror of
https://github.com/mailscope/kumomta.git
synced 2026-09-09 20:12:13 +00:00
113 lines
3.3 KiB
YAML
113 lines
3.3 KiB
YAML
name: Ubuntu LTS
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- "20*"
|
|
branches: [ "main" ]
|
|
paths:
|
|
- "crates/**/*.rs"
|
|
- ".github/workflows/ubuntu.yml"
|
|
- "get-deps.sh"
|
|
- "assets/upload-package.sh"
|
|
- "assets/build-deb.sh"
|
|
- "assets/policy-extras/**"
|
|
- "assets/bounce_classifier/**"
|
|
- "**/Cargo.toml"
|
|
|
|
pull_request:
|
|
branches: [ "main" ]
|
|
paths:
|
|
- "crates/**/*.rs"
|
|
- ".github/workflows/ubuntu.yml"
|
|
- "get-deps.sh"
|
|
- "assets/upload-package.sh"
|
|
- "assets/build-deb.sh"
|
|
- "assets/policy-extras/**"
|
|
- "assets/bounce_classifier/**"
|
|
- "**/Cargo.toml"
|
|
|
|
env:
|
|
CARGO_TERM_COLOR: always
|
|
|
|
jobs:
|
|
build-ubuntu:
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
container: ["ubuntu:20.04", "ubuntu:22.04"]
|
|
|
|
container:
|
|
image: ${{ matrix.container }}
|
|
options: --privileged
|
|
|
|
steps:
|
|
- name: "set APT to non-interactive"
|
|
shell: bash
|
|
run: "echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections"
|
|
- name: "Update APT"
|
|
shell: bash
|
|
run: "apt update"
|
|
- name: "Install git"
|
|
shell: bash
|
|
run: "apt-get install -y git"
|
|
- name: "Install more deps"
|
|
shell: bash
|
|
# some build stuff is needed to support cargo install used below
|
|
run: "apt-get install -y curl gcc g++"
|
|
- name: "Update APT"
|
|
shell: bash
|
|
run: "apt update"
|
|
- name: "Install Hashicorp Vault"
|
|
run: |
|
|
apt-get install -y gpg lsb-release
|
|
curl -fsSL https://apt.releases.hashicorp.com/gpg | gpg --yes --dearmor -o /usr/share/keyrings/hashicorp-archive-keyring.gpg
|
|
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com $(lsb_release -cs) main" | tee /etc/apt/sources.list.d/hashicorp.list
|
|
apt update
|
|
apt install -y vault
|
|
- name: "Install Rust"
|
|
uses: dtolnay/rust-toolchain@stable
|
|
- uses: actions/checkout@v3
|
|
- name: workaround git permission guff
|
|
run: git config --global --add safe.directory /__w/kumomta/kumomta
|
|
- name: Get Deps
|
|
run: bash ./get-deps.sh
|
|
- name: Install cargo-nextest
|
|
uses: baptiste0928/cargo-install@v2
|
|
with:
|
|
crate: cargo-nextest
|
|
cache-key: ${{ matrix.container }}
|
|
- uses: Swatinem/rust-cache@v2
|
|
with:
|
|
cache-on-failure: true
|
|
env-vars: "CARGO RUST"
|
|
key: ${{ matrix.container }}
|
|
- name: Build
|
|
run: cargo build --release
|
|
- name: Run tests
|
|
run: cargo nextest run --release
|
|
- name: Build Package
|
|
env:
|
|
REF_TYPE: ${{ github.ref_type }}
|
|
run: "./assets/build-deb.sh"
|
|
- name: Verify Package is installable
|
|
run: "apt-get install ./kumomta*.deb"
|
|
- name: Make artifact name
|
|
id: artifact-name
|
|
run: echo "name=${{ matrix.container }}" | tr ':' '-' >> $GITHUB_OUTPUT
|
|
- name: "Upload artifact"
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: ${{ steps.artifact-name.outputs.name }}
|
|
path: "kumomta*.deb"
|
|
- name: "Publish"
|
|
if: ${{ github.ref == 'refs/heads/main' || github.ref_type == 'tag' }}
|
|
env:
|
|
TOKEN: ${{ secrets.OPENREPO_API_TOKEN }}
|
|
REF_TYPE: ${{ github.ref_type }}
|
|
shell: bash
|
|
run: |
|
|
./assets/upload-package.sh ${{ matrix.container }} kumomta*.deb
|
|
|