Skip to content

Commit 6a1e86b

Browse files
authored
Add GitHub Pipelines (#1)
* ci: create workflows * temp: test workflows * ci: fix miri and reporter * ci: fmt and clippy is already installed * ci: fix outdated syntax * ci: add caching to service app build * ci: fix results permissions * ci: fix outpus * ci: dont reinstall cargo-expand * ci: workdir instead of cd * ci: bring back workflow conditions * ci: move gitlab pipeline
1 parent 0d9d553 commit 6a1e86b

File tree

12 files changed

+273
-10
lines changed

12 files changed

+273
-10
lines changed

.github/workflows/cargo-deny.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Cargo Dependencies
2+
on:
3+
pull_request:
4+
branches: [$default-branch]
5+
paths:
6+
- "**/Cargo.lock"
7+
- "**/Cargo.toml"
8+
- "**/deny.toml"
9+
10+
env:
11+
CARGO_TERM_COLOR: always
12+
13+
jobs:
14+
cargo-deny:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- name: Check Cargo Dependencies
20+
uses: EmbarkStudios/cargo-deny-action@v2
21+
with:
22+
command: check
23+
manifest-path: safe-stage/Cargo.toml

.github/workflows/release.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Build and Release Service Application
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*.*.*"
7+
8+
jobs:
9+
service-app-release:
10+
runs-on: windows-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
14+
- name: Set up Rust
15+
run: rustup default stable
16+
17+
- name: Add cargo-expand
18+
run: cargo install cargo-expand
19+
20+
- name: Build Safe Stage
21+
run: |
22+
cargo run -p bindings
23+
cargo build --release -F ffi
24+
working-directory: ./safe-stage
25+
26+
- name: Publish Service Application
27+
run: |
28+
dotnet publish
29+
working-directory: ./service-app
30+
31+
- name: Archive Publish Directory
32+
run: Compress-Archive -Path service-app/ServiceApp/bin/Release/net8.0-windows/publish -DestinationPath service-app_publish.zip
33+
34+
- name: Create GitHub Release
35+
id: create_release
36+
uses: actions/create-release@v1
37+
env:
38+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
39+
with:
40+
tag_name: ${{ github.ref_name }}
41+
release_name: Release ${{ github.ref_name }}
42+
draft: true
43+
prerelease: false
44+
45+
- name: Upload Release Assets
46+
uses: actions/upload-release-asset@v1
47+
env:
48+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
49+
with:
50+
upload_url: ${{ steps.create_release.outputs.upload_url }}
51+
asset_path: service-app_publish.zip
52+
asset_name: service-app_publish.zip
53+
asset_content_type: application/zip
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Check Safe Stage Safety
2+
on:
3+
push:
4+
branches: [$default-branch]
5+
paths:
6+
- "safe-stage/src/*"
7+
pull_request:
8+
branches: [$default-branch]
9+
paths:
10+
- "safe-stage/src/*"
11+
12+
env:
13+
CARGO_TERM_COLOR: always
14+
15+
jobs:
16+
safe-stage-miri:
17+
runs-on: ubuntu-latest
18+
permissions:
19+
checks: write
20+
steps:
21+
- uses: actions/checkout@v4
22+
23+
- name: Install Rust with miri
24+
uses: taiki-e/github-actions/install-rust@main
25+
with:
26+
toolchain: nightly
27+
component: miri
28+
29+
- name: Add nextest
30+
uses: taiki-e/install-action@nextest
31+
32+
- name: Run Tests with Miri
33+
run: cargo miri nextest run --locked --config-file .nextest.toml -F ffi
34+
working-directory: ./safe-stage
35+
36+
- name: Finalize Test Report
37+
uses: dorny/test-reporter@v1
38+
if: success() || failure()
39+
with:
40+
name: Results for miri tests
41+
reporter: java-junit
42+
path: safe-stage/target/nextest/default-miri/junit-report.xml

.github/workflows/safe-stage.yml

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
name: Check Safe Stage
2+
on:
3+
push:
4+
branches: [$default-branch]
5+
paths:
6+
- "safe-stage/*"
7+
pull_request:
8+
branches: [$default-branch]
9+
paths:
10+
- "safe-stage/*"
11+
12+
env:
13+
CARGO_TERM_COLOR: always
14+
15+
jobs:
16+
safe-stage-build:
17+
runs-on: ubuntu-latest
18+
strategy:
19+
matrix:
20+
FEATURES: ["--all", "-F ffi"]
21+
steps:
22+
- uses: actions/checkout@v4
23+
- uses: actions/cache@v4
24+
with:
25+
path: |
26+
~/.cargo/bin/
27+
~/.cargo/registry/index/
28+
~/.cargo/registry/cache/
29+
~/.cargo/git/db/
30+
./safe-stage/target/
31+
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
32+
33+
- name: Check Formatting
34+
run: cargo fmt --all --check
35+
working-directory: ./safe-stage
36+
37+
- name: Build with Features "${{ matrix.FEATURES }}"
38+
run: cargo build --locked ${{ matrix.FEATURES }}
39+
working-directory: ./safe-stage
40+
41+
- name: Run clippy with Features "${{ matrix.FEATURES }}"
42+
run: cargo clippy --locked ${{ matrix.FEATURES }} -- -D warnings
43+
working-directory: ./safe-stage
44+
45+
safe-stage-test:
46+
runs-on: ubuntu-latest
47+
permissions:
48+
checks: write
49+
strategy:
50+
matrix:
51+
PROFILE_FEATURES:
52+
[
53+
"ci-default;--all",
54+
"ci-features-serde;--all -F serde",
55+
"ci-features-linear;-p collisions --no-default-features -F rayon-bvh-linear",
56+
"ci-features-ffi;-F ffi",
57+
]
58+
steps:
59+
- uses: actions/checkout@v4
60+
- uses: actions/cache@v4
61+
with:
62+
path: |
63+
~/.cargo/bin/
64+
~/.cargo/registry/index/
65+
~/.cargo/registry/cache/
66+
~/.cargo/git/db/
67+
./safe-stage/target/
68+
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
69+
70+
- name: Add nextest
71+
uses: taiki-e/install-action@nextest
72+
73+
- name: Extract Profile and Features
74+
id: extraction
75+
run: |
76+
PROFILE_FEATURES="${{ matrix.PROFILE_FEATURES }}"
77+
78+
# Split the string at the semicolon
79+
IFS=';' read -r PROFILE FEATURES <<< "$PROFILE_FEATURES"
80+
81+
echo "PROFILE=$PROFILE"
82+
echo "FEATURES=$FEATURES"
83+
84+
# Set the outputs for use in subsequent steps
85+
echo "profile=$PROFILE" >> "$GITHUB_OUTPUT"
86+
echo "features=$FEATURES" >> "$GITHUB_OUTPUT"
87+
88+
- name: Run Documentation Tests with Profile "${{ steps.extraction.outputs.profile }}"
89+
run: cargo test --locked --doc ${{ steps.extraction.outputs.features }}
90+
working-directory: ./safe-stage
91+
92+
- name: Run Tests with Profile "${{ steps.extraction.outputs.profile }}"
93+
run: cargo nextest run --locked --config-file .nextest.toml -P ${{ steps.extraction.outputs.profile }} ${{ steps.extraction.outputs.features }}
94+
working-directory: ./safe-stage
95+
96+
- name: Finalize Test Report
97+
uses: dorny/test-reporter@v1
98+
if: success() || failure()
99+
with:
100+
name: Results for ${{ steps.extraction.outputs.profile }}
101+
reporter: java-junit
102+
path: safe-stage/target/nextest/${{ steps.extraction.outputs.profile }}/junit-report.xml

.github/workflows/service-app.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Build Service Application
2+
on:
3+
push:
4+
branches: [$default-branch]
5+
pull_request:
6+
branches: [$default-branch]
7+
8+
env:
9+
CARGO_TERM_COLOR: always
10+
11+
jobs:
12+
service-app-build:
13+
runs-on: windows-latest
14+
steps:
15+
- uses: actions/checkout@v4
16+
- uses: actions/cache@v4
17+
id: cache-cargo
18+
with:
19+
path: |
20+
~/.cargo/bin/
21+
~/.cargo/registry/index/
22+
~/.cargo/registry/cache/
23+
~/.cargo/git/db/
24+
./safe-stage/target/
25+
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
26+
27+
- name: Set up Rust
28+
run: rustup default stable
29+
30+
- name: Add cargo-expand
31+
if: steps.cache-cargo.outputs.cache-hit != 'true'
32+
run: cargo install cargo-expand
33+
34+
- name: Build Safe Stage
35+
run: |
36+
cargo run -p bindings
37+
cargo build --release -F ffi
38+
working-directory: ./safe-stage
39+
40+
- name: Build Service Application
41+
run: |
42+
dotnet build
43+
working-directory: ./service-app

.gitlab-ci.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ stages:
1212
- test
1313

1414
include:
15-
- ci/templates.yml
16-
- ci/bindings.yml
17-
- ci/caching.yml
18-
- ci/repo.yml
19-
- ci/safe-stage.yml
20-
- ci/service-app.yml
15+
- .gitlab/templates.yml
16+
- .gitlab/bindings.yml
17+
- .gitlab/caching.yml
18+
- .gitlab/repo.yml
19+
- .gitlab/safe-stage.yml
20+
- .gitlab/service-app.yml

ci/bindings.yml renamed to .gitlab/bindings.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
include:
2-
- ci/templates.yml
2+
- .gitlab/templates.yml
33

44
.rust-template-cache: &rust-template-cache
55
key:

ci/caching.yml renamed to .gitlab/caching.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
include:
2-
- ci/templates.yml
2+
- .gitlab/templates.yml
33

44
cargo:cache:
55
extends: .rust-template

ci/repo.yml renamed to .gitlab/repo.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
include:
2-
- ci/templates.yml
2+
- .gitlab/templates.yml
33

44
repo:check:cargo:
55
extends: .rust-template

ci/safe-stage.yml renamed to .gitlab/safe-stage.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
include:
2-
- ci/templates.yml
2+
- .gitlab/templates.yml
33

44
.safe-stage-template:
55
extends: .rust-template

0 commit comments

Comments
 (0)