Skip to content

Commit

Permalink
chore: test docker
Browse files Browse the repository at this point in the history
  • Loading branch information
zeeshanlakhani committed Oct 8, 2023
1 parent fcfca11 commit 70d5516
Show file tree
Hide file tree
Showing 2 changed files with 85 additions and 14 deletions.
97 changes: 84 additions & 13 deletions .github/workflows/builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,18 @@ on:
type: boolean
description: Publish Builds at Anytime

release:
types: [published]
pull_request:
branches: [ '**' ]

# release:
# types: [published]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

permissions:
contents: write

jobs:
builds:
binary-builds:
strategy:
fail-fast: false
matrix:
Expand All @@ -36,6 +36,9 @@ jobs:
os: windows-latest
- target: x86_64-unknown-freebsd

permissions:
contents: write

timeout-minutes: 60
runs-on: ${{ matrix.os || 'ubuntu-latest' }}
steps:
Expand Down Expand Up @@ -83,11 +86,79 @@ jobs:
path: target/${{ matrix.target }}/release/homestar*
if-no-files-found: error

- uses: taiki-e/upload-rust-binary-action@v1
# - uses: taiki-e/upload-rust-binary-action@v1
# with:
# bin: homestar
# target: ${{ matrix.target }}
# tar: all
# zip: windows
# include: LICENSE,README.md
# token: ${{ secrets.GITHUB_TOKEN }}

docker-builds:
runs-on: ubuntu-latest

env:
DOCKER_BUILDKIT: '1'
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

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

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

- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
bin: homestar
target: ${{ matrix.target }}
tar: all
zip: windows
include: LICENSE,README.md
token: ${{ secrets.GITHUB_TOKEN }}
registry: ${{ env.REGISTRY }}
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

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

- name: Setup Buildx
uses: docker/setup-buildx-action@v3
with:
buildkitd-flags: "--debug"

- name: Metadata
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
flavor: latest=true
tags: |
type=semver,pattern=v{{version}}
type=sha
- name: Test Docker Build
uses: docker/build-push-action@v5
with:
cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
cache-to: type=inline
file: docker/Dockerfile
context: .
load: true
tags: ${{ github.repository_owner }}/homestar:test

- name: Test Check
run: |
docker run --rm ${{ github.repository_owner }}/homestar:test
- name: Docker Build
uses: docker/build-push-action@v5
with:
cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
cache-to: type=inline
file: docker/Dockerfile
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
2 changes: 1 addition & 1 deletion .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
cache-to: type=gha,mode=max
file: docker/Dockerfile
context: .
platforms: linux/amd64
platforms: linux/amd64,linux/arm64
push: false
tags: |
${{ github.repository_owner }}/homestar:latest

0 comments on commit 70d5516

Please sign in to comment.