mirror of
https://github.com/trussed-dev/piv-authenticator.git
synced 2026-06-20 04:16:15 -07:00
Add gitlab ci
This commit is contained in:
@@ -1,2 +1,4 @@
|
||||
/target
|
||||
Cargo.lock
|
||||
tarpaulin-report.html
|
||||
cobertura.xml
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
# Copyright (C) 2022 Nitrokey GmbH
|
||||
# SPDX-License-Identifier: CC0-1.0
|
||||
|
||||
include: 'https://raw.githubusercontent.com/Nitrokey/common-ci-jobs/master/common_jobs.yml'
|
||||
|
||||
stages:
|
||||
- pull-github
|
||||
- build
|
||||
- deploy
|
||||
|
||||
variables:
|
||||
GIT_STRATEGY: clone
|
||||
GIT_DEPTH: 0
|
||||
GIT_SUBMODULE_STRATEGY: recursive
|
||||
REPO_NAME: piv-authenticator
|
||||
MAIN_BRANCH: main
|
||||
COMMON_PULL: "true"
|
||||
COMMON_UPLOAD_NIGHTLY: "false"
|
||||
COMMON_GITHUB_RELEASE: "false"
|
||||
COMMON_UPLOAD_FILES: "false"
|
||||
|
||||
build:
|
||||
image: registry.git.nitrokey.com/nitrokey/piv-authenticator/piv-authenticator-build:latest
|
||||
rules:
|
||||
- if: '$CI_PIPELINE_SHOULD_NOT_BUILD == "true"'
|
||||
when: never
|
||||
- if: '$CI_PIPELINE_SOURCE == "push"'
|
||||
- if: '$CI_PIPELINE_SOURCE == "web"'
|
||||
- if: '$CI_PIPELINE_SOURCE == "schedule"'
|
||||
tags:
|
||||
- docker
|
||||
stage: build
|
||||
before_script:
|
||||
- cargo --version
|
||||
script:
|
||||
- make ci
|
||||
after_script:
|
||||
- cp /app/.cache/scdaemon.log scdaemon.log
|
||||
- wget $icon_server/checkmark/$CI_COMMIT_REF_NAME/$CI_COMMIT_SHA/$CI_JOB_NAME/$CI_JOB_STATUS/${CI_JOB_URL#*/*/*/}
|
||||
coverage: '/^\d+.\d+% coverage/'
|
||||
artifacts:
|
||||
when: always
|
||||
paths:
|
||||
- "scdaemon.log"
|
||||
- "cobertura.xml"
|
||||
- "tarpaulin-report.html"
|
||||
reports:
|
||||
coverage_report:
|
||||
coverage_format: cobertura
|
||||
path: cobertura.xml
|
||||
@@ -14,7 +14,6 @@ test:
|
||||
check:
|
||||
cargo fmt --check
|
||||
cargo check --all-targets --all-features
|
||||
cargo check --target thumbv7em-none-eabi
|
||||
cargo clippy --all-targets --all-features -- -Dwarnings
|
||||
RUSTDOCFLAGS='-Dwarnings' cargo doc --all-features
|
||||
|
||||
@@ -25,3 +24,7 @@ tarpaulin:
|
||||
.PHONY: example
|
||||
example:
|
||||
cargo run --example virtual --features virtual
|
||||
|
||||
.PHONY: ci
|
||||
ci: check tarpaulin
|
||||
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
# Copyright (C) 2022 Nitrokey GmbH
|
||||
# SPDX-License-Identifier: CC0-1.0
|
||||
|
||||
FROM docker.io/rust:latest
|
||||
|
||||
RUN apt update && apt install --yes scdaemon libclang-dev llvm python3-pip vsmartcard-vpcd pkg-config nettle-dev libpcsclite-dev
|
||||
|
||||
RUN rustup component add clippy rustfmt && rustup target add thumbv7em-none-eabi
|
||||
RUN cargo install cargo-tarpaulin --profile release && rm -rf "$CARGO_HOME"/registry
|
||||
# initialize cargo cache
|
||||
RUN cargo search
|
||||
|
||||
ENV CARGO_HOME=/app/.cache/cargo
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY entrypoint.sh /entrypoint.sh
|
||||
ENTRYPOINT ["/bin/bash", "/entrypoint.sh"]
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
# Copyright (C) 2022 Nitrokey GmbH
|
||||
# SPDX-License-Identifier: CC0-1.0
|
||||
|
||||
-include config.mk
|
||||
|
||||
TAG := registry.git.nitrokey.com/nitrokey/piv-authenticator/piv-authenticator-build
|
||||
DOCKER ?= docker
|
||||
FUZZ_JOBS?=$(shell nproc)
|
||||
FUZZ_DURATION?="0"
|
||||
|
||||
.PHONY: build
|
||||
build:
|
||||
$(DOCKER) build . --tag $(TAG)
|
||||
|
||||
.PHONY: push
|
||||
push:
|
||||
$(DOCKER) push $(TAG)
|
||||
|
||||
.PHONY: run
|
||||
run:
|
||||
$(DOCKER) run --interactive --rm --volume "$(PWD)/..:/app" --env RUST_LOG $(TAG) make ci
|
||||
|
||||
.PHONY: test
|
||||
test:
|
||||
$(DOCKER) run --interactive --rm --volume "$(PWD)/..:/app" --env RUST_LOG $(TAG) make test
|
||||
|
||||
.PHONY: fuzz
|
||||
fuzz:
|
||||
$(DOCKER) run --interactive --rm --volume "$(PWD)/..:/app" --env RUST_LOG $(TAG) make fuzz FUZZ_JOBS=${FUZZ_JOBS} FUZZ_DURATION=${FUZZ_DURATION}
|
||||
@@ -0,0 +1,12 @@
|
||||
#!/bin/sh
|
||||
# Copyright (C) 2022 Nitrokey GmbH
|
||||
# SPDX-License-Identifier: CC0-1.0
|
||||
|
||||
set -e
|
||||
mkdir -p /app/.cache
|
||||
if [ ! -e "$CARGO_HOME" ]
|
||||
then
|
||||
cp -r /usr/local/cargo $CARGO_HOME
|
||||
fi
|
||||
pcscd
|
||||
exec "$@"
|
||||
Reference in New Issue
Block a user