Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 70 additions & 0 deletions .github/workflows/_auth_broker_code.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: Auth Broker Code

on:
workflow_call:

jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout source
uses: actions/checkout@v6

- name: Install stable toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1.16.1
with:
cache: false
components: clippy,rustfmt

- name: Cache Rust Build
uses: Swatinem/rust-cache@v2.9.1
with:
shared-key: backend/auth-broker
workspaces: backend

- name: Check Formatting
working-directory: backend/auth-broker
run: >
cargo fmt
--check

- name: Lint with Clippy
working-directory: backend/auth-broker
run: >
cargo clippy
--all-targets
--all-features
--no-deps
--
--deny warnings

- name: Check Dependencies with Cargo Deny
uses: EmbarkStudios/cargo-deny-action@v2.0.20
with:
command: check licenses ban
manifest-path: backend/Cargo.toml

test:
runs-on: ubuntu-latest
steps:
- name: Checkout source
uses: actions/checkout@v6

- name: Install stable toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1.16.1
with:
cache: false
components: rustfmt

- name: Cache Rust Build
uses: Swatinem/rust-cache@v2.9.1
with:
shared-key: backend/auth-broker
workspaces: backend

- name: Run Tests
working-directory: backend/auth-broker
run: >
cargo test
--all-targets
--all-features
53 changes: 53 additions & 0 deletions .github/workflows/_auth_broker_container.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Auth Broker Container
on:
workflow_call:

jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout Code
uses: actions/checkout@v6

- name: Generate Image Name
run: echo IMAGE_REPOSITORY=ghcr.io/$(echo "${{ github.repository }}" | tr '[:upper:]' '[:lower:]' | tr '[_]' '[\-]')-auth-broker >> $GITHUB_ENV

- name: Log in to GitHub Docker Registry
if: github.event_name != 'pull_request'
uses: docker/login-action@v4.2.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract Version from Tag
id: tags
run: echo version=$(echo "${{ github.ref }}" | awk -F '[@v]' '{print $3}') >> $GITHUB_OUTPUT

- name: Docker Metadata
id: meta
uses: docker/metadata-action@v6.1.0
with:
images: ${{ env.IMAGE_REPOSITORY }}
tags: |
type=raw,value=${{ steps.tags.outputs.version }}
type=raw,value=staging

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4.0.0

- name: Build Image
uses: docker/build-push-action@v6.18.0
with:
context: backend
file: backend/Dockerfile.auth-broker
target: deploy
push: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/auth-broker@') }}
load: ${{ !(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/auth-broker@')) }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
14 changes: 14 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,20 @@ jobs:
contents: read
packages: write

auth_broker_code:
# Deduplicate jobs from pull requests and branch pushes within the same repo.
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository
uses: ./.github/workflows/_auth_broker_code.yaml

auth_broker_container:
# Deduplicate jobs from pull requests and branch pushes within the same repo.
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository
needs: auth_broker_code
uses: ./.github/workflows/_auth_broker_container.yaml
permissions:
contents: read
packages: write

auth_gateway_code:
# Deduplicate jobs from pull requests and branch pushes within the same repo.
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository
Expand Down
Loading
Loading