Skip to content

Commit

Permalink
try Reusing workflows
Browse files Browse the repository at this point in the history
Signed-off-by: Boris Glimcher <Boris.Glimcher@emc.com>
  • Loading branch information
glimchb committed Feb 18, 2023
1 parent b271f67 commit c29b6d5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 78 deletions.
80 changes: 3 additions & 77 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,80 +10,6 @@ on:
branches: [ main ]

jobs:
build:

runs-on: ubuntu-latest
permissions:
contents: read
packages: write
# This is used to complete the identity challenge
# with sigstore/fulcio when running outside of PRs.
id-token: write

steps:
- uses: actions/checkout@v3
- uses: docker/setup-qemu-action@v2
- uses: docker/setup-buildx-action@v2.4.1

- name: Log in to Docker Hub
if: github.event_name != 'pull_request'
uses: docker/login-action@v2.1.0
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/login-action@v2.1.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v4.3.0
with:
images: |
${{ github.repository }}
ghcr.io/${{ github.repository }}
- name: Build and push Docker image
id: build-and-push
uses: docker/build-push-action@v4.0.0
with:
context: .
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

test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: docker/setup-qemu-action@v2
- uses: docker/setup-buildx-action@2dd22fa31c04297d369158eb483250f578504a9f

- name: Start containers
run: docker-compose up --build --force-recreate --detach

- name: Run Tests
run: |
set -x
name=$(docker-compose ps | grep device | awk '{print $1}')
rc=$(docker wait "${name}")
if [ "${rc}" != "0" ]; then
echo "device failed:"
docker logs "${name}"
exit 1
fi
- name: Logs
if: always()
run: docker-compose logs

- name: Stop containers
if: always()
run: docker-compose down --volumes --remove-orphans
call:
uses: opiproject/opi-smbios-bridge/.github/workflows/docker-publish.yml@main
secrets: inherit
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ services:
start_period: 20s
timeout: 10s

device:
opi-test:
image: docker.io/curlimages/curl:7.87.0
depends_on:
bootstrap:
Expand Down

0 comments on commit c29b6d5

Please sign in to comment.