Skip to content

Commit

Permalink
chore: better CI
Browse files Browse the repository at this point in the history
  • Loading branch information
stephane-segning committed Feb 11, 2025
1 parent e233767 commit f9bda04
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 29 deletions.
37 changes: 9 additions & 28 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,27 +23,14 @@ jobs:
runs-on: ubuntu-latest

permissions:
contents: read
packages: write
contents: read

steps:
- uses: actions/checkout@v4
name: Checkout repository

# Cache Rust dependencies
- name: Cache Rust dependencies
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-
- name: Build Server
working-directory: wazuh-cert-oauth2
run: cargo build --verbose && cargo test --verbose
fetch-depth: "0"

- name: Set up QEMU
uses: docker/setup-qemu-action@v3
Expand All @@ -69,37 +56,31 @@ jobs:
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ steps.lowercase.outputs.lowercase }}
tags: |
type=raw,value=latest,enable={{is_default_branch}}
type=raw,value={{branch}}
type=raw,value={{sha}}
type=schedule,pattern={{date 'YYYYMMDD-hhmmss' tz='Europe/Berlin'}}
type=sha,format=long
type=sha,format=long,prefix={{branch}}
images: ${{ env.REGISTRY }}/${{ steps.lowercase.outputs.lowercase }}

- name: Cache Docker layers
uses: actions/cache@v4
if: always()
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Build and push Docker image
uses: docker/build-push-action@v5
- name: Build and push
uses: docker/build-push-action@v6
if: github.event_name != 'pull_request'
with:
push: "true"
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64
annotations: ${{ steps.meta.outputs.annotations }}
platforms: linux/amd64,linux/arm64
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache

# Save the updated Docker cache
- name: Save Docker cache
if: always()
uses: actions/upload-artifact@v4
with:
name: buildx-cache
path: /tmp/.buildx-cache
9 changes: 8 additions & 1 deletion compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,11 @@ services:
context: .
dockerfile: ./Dockerfile
ports:
- "8000:8000"
- "8000:8000"
environment:
RUST_LOG: 'info'
OAUTH_ISSUER: 'https://login.wazuh.adorsys.team/realms/adorsys'
KC_AUDIENCES: 'account'
ROOT_CA_PATH: '/usr/share/wazuh-cert-oauth2/certs/root-ca.pem'
ROOT_CA_KEY_PATH: '/usr/share/wazuh-cert-oauth2/certs/root-ca-key.pem'
ROCKET_ADDRESS: '0.0.0.0'

0 comments on commit f9bda04

Please sign in to comment.