Skip to content

Commit 383b5d4

Browse files
authored
Merge pull request #3 from trustyai-explainability/bump-2.20
chore: Bump to upstream 0.9.4
2 parents 8796e59 + 8f04100 commit 383b5d4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+9217
-909
lines changed

.github/workflows/test.yml

Lines changed: 33 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -2,92 +2,44 @@ name: Test and Lint Orchestrator
22

33
on:
44
push:
5-
branches: ["main"]
5+
branches: [ "main" ]
66
pull_request:
7-
branches: ["main"]
7+
branches: [ "main" ]
8+
types: [opened, reopened, synchronize, ready_for_review]
89

910
env:
1011
CARGO_TERM_COLOR: always
11-
TEST_IMAGE_NAME: "orchestr8-tests:0"
12-
LINT_IMAGE_NAME: "orchestr8-lint:0"
13-
FMT_IMAGE_NAME: "orchestr8-fmt:0"
12+
RUSTFLAGS: "-Dwarnings" # Makes CI fail on compilation/clippy warnings
13+
PROTOC_VERSION: "26.0"
1414

1515
jobs:
16-
build:
16+
ci-checks:
1717
runs-on: ubuntu-latest
18-
permissions:
19-
packages: write
20-
contents: read
21-
env:
22-
CACHE_TEST_IMAGE: "ghcr.io/foundation-model-stack/fms-guardrails-orchestrator:test-cache"
23-
CACHE_LINT_IMAGE: "ghcr.io/foundation-model-stack/fms-guardrails-orchestrator:lint-cache"
24-
CACHE_FMT_IMAGE: "ghcr.io/foundation-model-stack/fms-guardrails-orchestrator:fmt-cache"
25-
CACHE_REGISTRY: "ghcr.io"
26-
18+
if: github.event.pull_request.draft == false
2719
steps:
28-
- uses: actions/checkout@v4
29-
- name: "Setup Docker Buildx"
30-
uses: docker/setup-buildx-action@v3
31-
- name: "Log in to cache image container registry"
32-
uses: docker/login-action@v3
33-
if: github.event_name != 'pull_request'
34-
with:
35-
registry: ${{ env.CACHE_REGISTRY }}
36-
username: ${{ github.actor }}
37-
password: ${{ secrets.GITHUB_TOKEN }}
38-
- name: "Set build cache target"
39-
run: |
40-
# For push to `main` (PR merged), push a new cache image with all layers (cache-mode=max).
41-
# For PR builds, use GitHub action cache which isolates cached layers by PR/branch.
42-
# to optimize builds for subsequent pushes to the same PR/branch.
43-
# Do not set a cache-to image for PR builds to not overwrite the `main` cache image and
44-
# to not ping-pong cache images for two or more different PRs.
45-
# Do not push cache images for each PR or multiple branches to not exceed GitHub package
46-
# usage and traffic limitations.
47-
# UPDATE: GHA cache appears to have issues, cannot use `cache-to: gha,mode=min`
48-
# if `cache-from: reg...,mode=max` but `cache-to: gha,mode=max` takes longer than uncached
49-
# build and exhausts GHA cache size limits, so use cache `type=inline` (no external cache).
50-
if [ "${{ github.event_name }}" == "pull_request" ]
51-
then
52-
#CACHE_TO="type=gha,mode=min"
53-
CACHE_TEST_TO="type=inline"
54-
CACHE_LINT_TO="type=inline"
55-
CACHE_FMT_TO="type=inline"
56-
else
57-
CACHE_TEST_TO="type=registry,ref=${{ env.CACHE_TEST_IMAGE }},mode=max"
58-
CACHE_LINT_TO="type=registry,ref=${{ env.CACHE_LINT_IMAGE }},mode=max"
59-
CACHE_FMT_TO="type=registry,ref=${{ env.CACHE_FMT_IMAGE }},mode=max"
60-
fi
61-
echo "CACHE_TEST_TO=$CACHE_TEST_TO" >> $GITHUB_ENV
62-
echo "CACHE_LINT_TO=$CACHE_LINT_TO" >> $GITHUB_ENV
63-
echo "CACHE_FMT_TO=$CACHE_FMT_TO" >> $GITHUB_ENV
64-
- name: Test
65-
uses: docker/build-push-action@v5
66-
with:
67-
context: .
68-
target: tests
69-
tags: ${{ env.TEST_IMAGE_NAME }}
70-
cache-from: type=registry,ref=${{ env.CACHE_TEST_IMAGE }}
71-
cache-to: ${{ env.CACHE_TEST_TO }}
72-
push: false
73-
platforms: linux/amd64
74-
- name: Lint with clippy
75-
uses: docker/build-push-action@v5
76-
with:
77-
context: .
78-
target: lint
79-
tags: ${{ env.LINT_IMAGE_NAME }}
80-
cache-from: type=registry,ref=${{ env.CACHE_LINT_IMAGE }}
81-
cache-to: ${{ env.CACHE_LINT_TO }}
82-
push: false
83-
platforms: linux/amd64
84-
- name: Format
85-
uses: docker/build-push-action@v5
86-
with:
87-
context: .
88-
target: format
89-
tags: ${{ env.FMT_IMAGE_NAME }}
90-
cache-from: type=registry,ref=${{ env.CACHE_FMT_IMAGE }}
91-
cache-to: ${{ env.CACHE_FMT_TO }}
92-
push: false
93-
platforms: linux/amd64
20+
- name: "Install fmt nightly"
21+
run: rustup component add --toolchain nightly-x86_64-unknown-linux-gnu rustfmt
22+
- name: "Install protoc"
23+
run: |
24+
echo "protoc version: ${PROTOC_VERSION}"
25+
cd /tmp
26+
curl -L -O https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOC_VERSION}/protoc-${PROTOC_VERSION}-linux-x86_64.zip
27+
sudo unzip protoc-*.zip -d /usr/local && rm protoc-*.zip
28+
protoc --version
29+
- uses: actions/checkout@v4
30+
- name: Cache Rust dependencies
31+
uses: actions/cache@v4
32+
with:
33+
path: |
34+
~/.cargo/registry
35+
~/.cargo/git
36+
target
37+
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
38+
- name: Build
39+
run: cargo build
40+
- name: Run formatter
41+
run: cargo +nightly fmt --check --all
42+
- name: Run linter
43+
run: cargo clippy --no-deps --all-targets --all-features
44+
- name: Run tests
45+
run: cargo test

.pre-commit-config.yaml

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,25 @@
11
repos:
2-
- repo: https://github.com/doublify/pre-commit-rust
3-
rev: v1.0
2+
- repo: local
43
hooks:
5-
- id: fmt
6-
- id: cargo-check
7-
- id: clippy
4+
- id: fmt-nightly
5+
name: fmt nightly
6+
description: Format files with cargo +nightly fmt.
7+
entry: cargo +nightly fmt
8+
language: system
9+
types: [rust]
10+
args: ["--"]
11+
- id: cargo-check
12+
name: cargo check
13+
description: Check the package for errors.
14+
entry: cargo check
15+
language: system
16+
types: [rust]
17+
pass_filenames: false
18+
- id: clippy
19+
name: clippy
20+
description: Lint rust sources
21+
entry: cargo clippy
22+
language: system
23+
args: ["--", "-D", "warnings"]
24+
types: [rust]
25+
pass_filenames: false

0 commit comments

Comments
 (0)