## Problem - follow-up to #2493 - https://trello.com/c/czY7e3c0 For SLES16 the minimal system can be without libzypp. If it is case together with onlyRequires flag, then software service crashes when trying to load zypp.conf. ## Solution Add check if file exists and if not, just log it and continue. Also change as agreed modification of zypp.conf to explicitly write onlyRequires if user explicitly mention it in profile to not just use libzypp default. ## Testing - *Tested manually* ## Documentation *Remember to look at it from the user's perspective. Yes you have made the compiler happy.* *But will the **humans** even know about your contribution? Sometimes they cannot miss it,* *other times they need advertisement and explanation.* *Look for relevant sections and adjust:* - The description parts of the [JSON schema][profile.schema.json] - Is the CLI affected? See [cli.md][] for a complete overview, change the `///` comments (rust doc) and update the .md with `cargo xtask markdown` - <https://agama-project.github.io/> ([source][gh.io]) - Run: `git ls-files '*.md'` [cli.md]: https://github.com/agama-project/agama-project.github.io/blob/main/docs/user/cli.md [profile.schema.json]: https://github.com/agama-project/agama/blob/master/rust/agama-lib/share/profile.schema.json [gh.io]: https://github.com/agama-project/agama-project.github.io/ --------- Co-authored-by: Ladislav Slezák <lslezak@suse.com>
246 lines
6.8 KiB
YAML
246 lines
6.8 KiB
YAML
name: CI - Rust
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
on:
|
|
push:
|
|
paths:
|
|
# NOTE: GitHub Actions do not allow using YAML references, the same path
|
|
# list is used below for the pull request event. Keep both lists in sync!!
|
|
|
|
# this file as well
|
|
- .github/workflows/ci-rust.yml
|
|
# any change in the rust subfolder
|
|
- rust/**
|
|
# except Markdown documentation
|
|
- "!rust/**.md"
|
|
# except the packaging
|
|
- "!rust/package/**"
|
|
# except the DBus configuration
|
|
- "!rust/share/**"
|
|
|
|
pull_request:
|
|
paths:
|
|
# NOTE: GitHub Actions do not allow using YAML references, the same path
|
|
# list is used above for the push event. Keep both lists in sync!!
|
|
|
|
# this file as well
|
|
- .github/workflows/ci-rust.yml
|
|
# any change in the rust subfolder
|
|
- rust/**
|
|
# except Markdown documentation
|
|
- "!rust/**.md"
|
|
# except the packaging
|
|
- "!rust/package/**"
|
|
# except the DBus configuration
|
|
- "!rust/share/**"
|
|
|
|
# allow running manually
|
|
workflow_dispatch:
|
|
|
|
env:
|
|
CARGO_TERM_COLOR: always
|
|
# this makes the build slightly faster and the saved cache smaller
|
|
CARGO_INCREMENTAL: 0
|
|
|
|
jobs:
|
|
fmt:
|
|
# the default timeout is 6 hours, that's too much if the job gets stuck
|
|
timeout-minutes: 10
|
|
runs-on: ubuntu-latest
|
|
|
|
defaults:
|
|
run:
|
|
working-directory: ./rust
|
|
|
|
steps:
|
|
|
|
- name: Git Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Rust toolchain
|
|
run: |
|
|
rustup show
|
|
cargo --version
|
|
|
|
- name: Run rustfmt
|
|
run: cargo fmt --all -- --check
|
|
|
|
clippy:
|
|
# the default timeout is 6 hours, that's too much if the job gets stuck
|
|
timeout-minutes: 20
|
|
runs-on: ubuntu-latest
|
|
|
|
defaults:
|
|
run:
|
|
working-directory: ./rust
|
|
|
|
steps:
|
|
|
|
- name: Git Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Rust toolchain
|
|
run: |
|
|
rustup show
|
|
cargo --version
|
|
|
|
- name: Install packages
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get -y install libclang-18-dev libpam0g-dev
|
|
|
|
- name: Installed packages
|
|
run: apt list --installed
|
|
|
|
- name: Rust cache
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: |
|
|
~/.cargo
|
|
rust/target
|
|
key: ${{ runner.os }}-cargo-clippy-${{ hashFiles('**/Cargo.lock') }}
|
|
|
|
- name: Run clippy linter
|
|
run: cargo clippy
|
|
|
|
tests:
|
|
# the default timeout is 6 hours, that's too much if the job gets stuck
|
|
timeout-minutes: 30
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
COVERAGE: 1
|
|
|
|
defaults:
|
|
run:
|
|
working-directory: ./rust
|
|
|
|
steps:
|
|
|
|
- name: Git Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Rust toolchain
|
|
run: |
|
|
rustup show
|
|
cargo --version
|
|
|
|
- name: Install packages
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get -y install libclang-18-dev libpam0g-dev python3-langtable jsonnet
|
|
|
|
- name: Prepare for tests
|
|
run: |
|
|
# the langtable data location is different in SUSE/openSUSE, create a symlink
|
|
sudo mkdir -p /usr/share/langtable
|
|
sudo ln -s /usr/lib/python3/dist-packages/langtable/data /usr/share/langtable/data
|
|
# create the /etc/agama.d/locales file with list of locales
|
|
sudo mkdir /etc/agama.d
|
|
sudo bash -c 'ls -1 -d /usr/share/i18n/locales/* | sed -e "s#/usr/share/i18n/locales/##" >/etc/agama.d/locales'
|
|
|
|
- name: Installed packages
|
|
run: apt list --installed
|
|
|
|
- name: Rust cache
|
|
id: cache-tests
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: |
|
|
~/.cargo
|
|
rust/target-coverage
|
|
key: ${{ runner.os }}-cargo-tests-${{ hashFiles('**/Cargo.lock') }}
|
|
|
|
- name: Install Tarpaulin (for code coverage)
|
|
# skip the step completely if the cache has been restored
|
|
# this avoids refreshing the crates index and saves few seconds
|
|
if: steps.cache-tests.outputs.cache-hit != 'true'
|
|
run: cargo install cargo-tarpaulin
|
|
|
|
- name: Run the tests
|
|
# Compile into the ./target-coverage directory because tarpaulin uses special compilation
|
|
# flags, to avoid reusing the previous builds it always starts from scratch.
|
|
# The --skip-clean skips the cleanup and allows using the cached results.
|
|
# See https://github.com/xd009642/tarpaulin/discussions/772
|
|
run: cargo tarpaulin --workspace --all-targets --doc --out xml --target-dir target-coverage --skip-clean -- --nocapture
|
|
env:
|
|
# use the "stable" tool chain (installed by default) instead of the "nightly" default in tarpaulin
|
|
RUSTC_BOOTSTRAP: 1
|
|
RUSTUP_TOOLCHAIN: stable
|
|
RUST_BACKTRACE: 1
|
|
RUSTFLAGS: --cfg ci
|
|
|
|
# send the code coverage for the Rust part to the coveralls.io
|
|
- name: Send coverage data to Coveralls
|
|
timeout-minutes: 10
|
|
# ignore errors in this step
|
|
continue-on-error: true
|
|
uses: coverallsapp/github-action@v2
|
|
with:
|
|
flag-name: rust
|
|
base-path: ./rust
|
|
format: cobertura
|
|
|
|
# Close the parallel build and inherit the Web parts (it needs a separate step, the "carryforward" flag can be used
|
|
# only with the "parallel-finished: true" option)
|
|
- name: Close the Coveralls build
|
|
timeout-minutes: 10
|
|
# ignore errors in this step
|
|
continue-on-error: true
|
|
uses: coverallsapp/github-action@v2
|
|
with:
|
|
parallel-finished: true
|
|
carryforward: "rust,service,web"
|
|
|
|
openapi:
|
|
# the default timeout is 6 hours, that's too much if the job gets stuck
|
|
timeout-minutes: 30
|
|
runs-on: ubuntu-latest
|
|
|
|
defaults:
|
|
run:
|
|
working-directory: ./rust
|
|
|
|
steps:
|
|
|
|
- name: Git Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Rust toolchain
|
|
run: |
|
|
rustup show
|
|
cargo --version
|
|
|
|
- name: Configure system
|
|
# disable updating initramfs (the system is not booted again)
|
|
# disable updating man db (to save some time)
|
|
run: |
|
|
sudo sed -i "s/yes/no/g" /etc/initramfs-tools/update-initramfs.conf
|
|
sudo rm -f /var/lib/man-db/auto-update
|
|
|
|
- name: Install packages
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get -y install libclang-18-dev libpam0g-dev
|
|
# uninstall the python3-jsonschema package, openapi-spec-validator wants
|
|
# to install a newer version which would conflict with that
|
|
sudo apt-get purge python3-jsonschema
|
|
sudo pip install openapi-spec-validator
|
|
|
|
- name: Installed packages
|
|
run: apt list --installed
|
|
|
|
- name: Rust cache
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: |
|
|
~/.cargo
|
|
rust/target
|
|
key: ${{ runner.os }}-cargo-openapi-${{ hashFiles('**/Cargo.lock') }}
|
|
|
|
- name: Generate the OpenAPI specification
|
|
run: cargo xtask openapi
|
|
|
|
- name: Validate the OpenAPI specification
|
|
run: openapi-spec-validator out/openapi/*
|