Skip to content

OPEN-00: Add dynamic license header while ossl.rs is generated (#17) #13

OPEN-00: Add dynamic license header while ossl.rs is generated (#17)

OPEN-00: Add dynamic license header while ossl.rs is generated (#17) #13

Workflow file for this run

# SPDX-FileCopyrightText: Copyright 2025 gematik GmbH
#
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# *******
#
# For additional notes and disclaimer from gematik and in case of changes by gematik,
# find details in the "Readme" file.
name: Rust CI
on:
push:
branches: [ "main-rustffi" ]
pull_request:
branches: [ "main-rustffi" ]
env:
CARGO_TERM_COLOR: always
jobs:
branch_naming:
name: Branch naming
runs-on: ubuntu-latest
steps:
- name: Validate branch name
shell: bash
run: |
BRANCH_NAME="${GITHUB_HEAD_REF:-${GITHUB_REF_NAME}}"
if [[ -z "${BRANCH_NAME}" ]]; then
echo "No branch name detected (likely a tag). Skipping branch naming check."
exit 0
fi
case "${BRANCH_NAME}" in
main|main-rustffi|develop)
echo "Branch '${BRANCH_NAME}' is allowed."
exit 0
;;
esac
if [[ "${BRANCH_NAME}" =~ ^(feature|bugfix|hotfix|release|chore|docs|test)/open-[A-Za-z0-9._-]+$ ]]; then
echo "Branch '${BRANCH_NAME}' matches the expected naming convention."
exit 0
fi
echo "::error::Branch '${BRANCH_NAME}' does not follow the expected naming convention."
echo "::error::Branch name must match: (feature|bugfix|hotfix|release|chore|docs|test)/open-[A-Za-z0-9._-]+"
exit 1
license_compliance:
name: License compliance
runs-on: ubuntu-latest
needs: branch_naming
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install reuse
run: |
python3 -m pip install --upgrade pip
python3 -m pip install reuse
- name: Run reuse lint
run: reuse lint
build:
name: Build & Test
runs-on: ubuntu-latest
needs: [branch_naming, license_compliance]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: Swatinem/rust-cache@v2
with:
shared-key: ${{ runner.os }}-rust
- name: Install toolchains
run: |
rustup toolchain install nightly --profile minimal
rustup component add rustfmt --toolchain nightly
rustup component add clippy
- name: Check formatting
run: cargo +nightly fmt -- --check
- name: Lint with clippy
run: cargo clippy
- name: Build
run: cargo build --verbose
- name: Run tests
run: cargo test --verbose