Skip to content
Merged
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
139 changes: 139 additions & 0 deletions .github/workflows/container.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
name: Docker Build & Publish

on:
release:
types: [published]
push:
tags: ['v*']

permissions:
contents: read
packages: write
attestations: write
id-token: write

env:
REGISTRY: ghcr.io
IMAGE_NAME: authkits/authkit.server
LOCAL_TAG: authkit-server:test

jobs:
build:
name: Build Image
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build image (local, no push)
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile
load: true
tags: ${{ env.LOCAL_TAG }}
cache-from: type=gha
cache-to: type=gha,mode=max

- name: Save image artifact
run: docker save ${{ env.LOCAL_TAG }} | gzip > /tmp/image.tar.gz

- name: Upload image artifact
uses: actions/upload-artifact@v4
with:
name: docker-image
path: /tmp/image.tar.gz
retention-days: 1

test:
name: Smoke Test
runs-on: ubuntu-latest
needs: build
steps:
- name: Download image artifact
uses: actions/download-artifact@v4
with:
name: docker-image
path: /tmp

- name: Load image
run: docker load < /tmp/image.tar.gz

- name: Run container
run: docker run -d -p 8080:80 --name authkit ${{ env.LOCAL_TAG }}

- name: Wait for startup
run: sleep 15

- name: Verify container is running
run: |
STATE=$(docker inspect -f '{{.State.Running}}' authkit)
if [ "$STATE" != "true" ]; then
echo "Container is not running"
docker logs authkit
exit 1
fi

- name: Show logs
if: always()
run: docker logs authkit

- name: HTTP smoke check
run: |
curl -fsS http://localhost:8080/ -o /dev/null \
&& echo "HTTP OK" \
|| echo "No HTTP endpoint (non-fatal)"

- name: Stop container
if: always()
run: docker stop authkit || true

publish:
name: Publish to GHCR
runs-on: ubuntu-latest
needs: test
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Log in to GHCR
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=raw,value=latest

- name: Build and push image
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile
push: true
platforms: linux/amd64,linux/arm64
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
provenance: true
sbom: true
58 changes: 58 additions & 0 deletions .github/workflows/plugin-validation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Plugin Contract Validation

on:
push:
branches: [main, development]
tags: ['v*']
paths:
- 'src/Plugins/**'
- 'tools/PluginContractValidator/**'
- '.github/workflows/plugin-validation.yml'
pull_request:
branches: [main, development]
paths:
- 'src/Plugins/**'
- 'tools/PluginContractValidator/**'
- '.github/workflows/plugin-validation.yml'
workflow_dispatch:

env:
DOTNET_VERSION: '10.0.x'
VALIDATOR_PROJECT: 'tools/PluginContractValidator/PluginContractValidator.csproj'
PLUGINS_STAGING: 'out/plugins'

permissions:
contents: read

jobs:
validate:
name: Validate Plugin Contracts
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup .NET SDK
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ env.DOTNET_VERSION }}

- name: Publish plugins
run: |
mkdir -p "${{ env.PLUGINS_STAGING }}"
for proj in $(find src/Plugins -name '*.csproj' \
-not -path '*/Abstractions/*' \
-not -path '*/obj/*' \
-not -path '*/bin/*'); do
name=$(basename "$proj" .csproj)
echo "Publishing plugin: $name"
dotnet publish "$proj" -c Release -o "${{ env.PLUGINS_STAGING }}/$name" --nologo
done

- name: Build contract validator
run: dotnet build "${{ env.VALIDATOR_PROJECT }}" -c Release --nologo

- name: Run contract validation
run: |
VALIDATOR_DLL="tools/PluginContractValidator/bin/Release/net10.0/PluginContractValidator.dll"
dotnet "$VALIDATOR_DLL" "${{ github.workspace }}/${{ env.PLUGINS_STAGING }}"
Loading
Loading