Skip to content

refactor: unify http client creation (#448) #1474

refactor: unify http client creation (#448)

refactor: unify http client creation (#448) #1474

Workflow file for this run

---
name: CI
on:
workflow_dispatch:
workflow_call:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
sztp-client-push:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: docker/setup-qemu-action@v3
- uses: docker/[email protected]
- name: Log in to Docker Hub
if: github.event_name != 'pull_request'
uses: docker/[email protected]
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Log in to the GH Container registry
if: github.event_name != 'pull_request'
uses: docker/[email protected]
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract Docker metadata
id: meta
uses: docker/[email protected]
with:
images: |
${{ github.repository }}
ghcr.io/${{ github.repository_owner }}/opi-sztp-client
- name: Build and push Docker image
id: build-and-push
uses: docker/[email protected]
with:
context: sztp-agent
platforms: linux/amd64,linux/arm64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
sztp-ci:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
# Workaround: https://github.com/docker/build-push-action/issues/461
- name: Setup Docker buildx
uses: docker/setup-buildx-action@abe89fb761023d1d963c81f6b5e0df54236dc097
- name: Start containers
run: docker compose up -d
- name: Run Tests
run: ./scripts/tests.sh
- name: Logs
if: always()
run: docker compose logs
- name: Stop containers
if: always()
run: docker compose down