name: CI
on:
push:
branches:
- master
tags:
- '*'
pull_request:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: clone libkvmi
uses: actions/checkout@v2
with:
repository: bitdefender/libkvmi
path: libkvmi
ref: bf5776319e1801b59125c994c459446f0ed6837e
- name: build and install libkvmi
run: |
./bootstrap
./configure
make
sudo make install
working-directory: libkvmi
- name: install stable toolchain with clippy
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
components: clippy
- uses: actions/checkout@v1
- name: build and check for clippy warnings
uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: -- -D warnings
format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: rustfmt check
uses: actions-rs/cargo@v1
with:
command: fmt
args: -- --check
debian_package:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v1
- name: clone libkvmi
uses: actions/checkout@v2
with:
repository: bitdefender/libkvmi
path: libkvmi
ref: bf5776319e1801b59125c994c459446f0ed6837e
- name: build and install libkvmi
run: |
./bootstrap
./configure
make
sudo make install
working-directory: libkvmi
- name: install cargo deb dependencies
run: sudo apt-get install -y dpkg liblzma-dev
- uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo
- name: install cargo deb
run: cargo install cargo-deb
- name: build debian package
run: cargo deb -- --examples
- name: upload artifact
uses: actions/upload-artifact@v4
with:
name: kvmi_deb
path: target/debian/*
release:
needs: [ format, build, debian_package ]
runs-on: ubuntu-20.04
outputs:
upload_url: ${{ steps.step_upload_url.outputs.upload_url }}
version: ${{ steps.get_version.outputs.version }}
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
steps:
- uses: actions/checkout@v1
- name: Get the version
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
- uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo
- name: install cargo changelog
run: cargo install changelog
- name: generate changelog
run: changelog -o changelog.md
- name: Create a Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.get_version.outputs.version }}
release_name: ${{ steps.get_version.outputs.version }}
body_path: changelog.md
- id: step_upload_url
run: echo "::set-output name=upload_url::${{ steps.create_release.outputs.upload_url }}"
release_debian:
needs: [release]
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: actions/download-artifact@v2
id: download
with:
name: kvmi_deb
- name: get artifact path and name
id: artefact
run: |
PATHNAME=$(find . -maxdepth 1 -name '*.deb')
NAME=$(basename $PATHNAME)
echo ::set-output name=path::${PATHNAME}
echo ::set-output name=name::${NAME}
- name: Upload Debian package as Release asset
uses: actions/upload-release-asset@v1.0.2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.release.outputs.upload_url }}
asset_path: ${{ steps.artefact.outputs.path }}
asset_name: ${{ steps.artefact.outputs.name }}
asset_content_type: application/vnd.debian.binary-package
publish:
needs: [release]
runs-on: ubuntu-20.04
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
steps:
- name: clone libkvmi
uses: actions/checkout@v2
with:
repository: bitdefender/libkvmi
path: libkvmi
ref: bf5776319e1801b59125c994c459446f0ed6837e
- name: build and install libkvmi
run: |
./bootstrap
./configure
make
sudo make install
working-directory: libkvmi
- uses: actions/checkout@v1
- name: Publish
shell: bash
run: |
cargo publish --token ${{ secrets.CRATES_TOKEN }}