Skip to content

Commit 266eba0

Browse files
committed
Added GitHub actions
1 parent 9af4f10 commit 266eba0

File tree

6 files changed

+80
-5
lines changed

6 files changed

+80
-5
lines changed

.github/workflows/build.yml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
name: build
2+
3+
on:
4+
push:
5+
branches: [ "main" ]
6+
pull_request:
7+
branches: [ "main" ]
8+
9+
env:
10+
CARGO_TERM_COLOR: always
11+
12+
jobs:
13+
build-linux:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v4
17+
- name: Build
18+
run: cargo build --release --verbose
19+
- name: Run tests
20+
run: cargo test --verbose
21+
- name: Archive csaf-validator (linux amd64)
22+
uses: actions/upload-artifact@v4
23+
with:
24+
name: csaf-validator-linux-amd64
25+
path: target/csaf-validator
26+
build-macos:
27+
runs-on: macos-latest
28+
steps:
29+
- uses: actions/checkout@v4
30+
- name: Build
31+
run: cargo build --release --verbose
32+
- name: Run tests
33+
run: cargo test --verbose
34+
- name: Archive csaf-validator (macos arm64)
35+
uses: actions/upload-artifact@v4
36+
with:
37+
name: csaf-validator-macos-arm64
38+
path: target/csaf-validator
39+
publish:
40+
runs-on: ubuntu-latest
41+
needs:
42+
- build-macos
43+
- build-linux
44+
if: startsWith(github.ref, 'refs/tags/v') && !contains(github.ref, 'beta') && !contains(github.ref, 'alpha')
45+
steps:
46+
- name: Determine Version
47+
run: |
48+
# determine version from tag
49+
export VERSION=$(echo "${GITHUB_REF}" | cut -d "/" -f3)
50+
if [[ $VERSION != v* ]]
51+
then
52+
export VERSION=""
53+
echo "Building version-less (main or feature branch)"
54+
else
55+
echo "Building as ${VERSION}"
56+
fi
57+
# store version in GitHub environment file
58+
echo "version=$VERSION" >> $GITHUB_ENV
59+
- uses: actions/download-artifact@v4
60+
with:
61+
name: csaf-validator-linux-amd64
62+
path: .
63+
- uses: actions/download-artifact@v4
64+
with:
65+
name: csaf-validator-macos-arm64
66+
path: .
67+
- name: Create Release
68+
id: create_release
69+
uses: softprops/action-gh-release@v2
70+
with:
71+
token: ${{ secrets.GITHUB_TOKEN }}
72+
name: ${{ env.version }}
73+
draft: false
74+
prerelease: false
75+
files: |
76+
csaf-validator-linux-amd64
77+
csaf-validator-macos-arm64

csaf-lib/src/csaf/csaf2_0/loader.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
use super::schema::CommonSecurityAdvisoryFramework;
2-
use crate::csaf::validation::Validatable;
32
use std::{fs::File, io::BufReader};
43

54
pub fn load_document(path: &str) -> std::io::Result<CommonSecurityAdvisoryFramework> {

csaf-lib/src/csaf/csaf2_0/validation.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use super::product_helper::*;
22
use super::schema::CommonSecurityAdvisoryFramework;
3-
use crate::csaf::validation::{Test, Validatable, Validate, ValidationProfile};
3+
use crate::csaf::validation::{Test, Validatable, ValidationProfile};
44
use std::collections::{HashMap, HashSet};
55
use crate::csaf::helpers::find_duplicates;
66

csaf-lib/src/csaf/csaf2_1/loader.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
use std::{fs::File, io::BufReader};
2-
use crate::csaf::validation::Validatable;
32
use super::schema::CommonSecurityAdvisoryFramework;
43

54
pub fn load_document(path: &str) -> std::io::Result<CommonSecurityAdvisoryFramework> {

csaf-lib/src/csaf/csaf2_1/validation.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use super::product_helper::*;
22
use super::schema::CommonSecurityAdvisoryFramework;
33
use crate::csaf::helpers::find_duplicates;
4-
use crate::csaf::validation::{Test, Validatable, Validate, ValidationProfile};
4+
use crate::csaf::validation::{Test, Validatable, ValidationProfile};
55
use std::collections::{HashMap, HashSet};
66

77
impl Validatable<CommonSecurityAdvisoryFramework> for CommonSecurityAdvisoryFramework {

csaf-lib/src/csaf/validation.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ pub trait Validate {
3131
fn validate_by_test(&self, version: &str);
3232
}
3333

34-
pub type Test<VersionedDocument: Validatable<VersionedDocument>> =
34+
pub type Test<VersionedDocument> =
3535
fn(&VersionedDocument) -> Result<(), String>;
3636

3737
/// Represents something which is validatable according to the CSAF standard.

0 commit comments

Comments
 (0)