Skip to content

Commit

Permalink
ci: add workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
sjinks committed Jan 13, 2024
1 parent b223930 commit d349692
Show file tree
Hide file tree
Showing 2 changed files with 92 additions and 0 deletions.
68 changes: 68 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: Build OCI Image

on:
push:
branches:
- master
pull_request:
branches:
- master
workflow_dispatch:

permissions:
contents: none

jobs:
build:
name: Build ${{ matrix.variant.name }} image
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
variant:
- name: Alpine
tag: alpine
dockerfile: Dockerfile.alpine
- name: Ubuntu
tag: ubuntu
dockerfile: Dockerfile
steps:
- name: Check out code
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

- name: Login to GHCR
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0
with:
registry: https://ghcr.io
username: ${{ github.actor }}
password: ${{ github.token }}
if: ${{ github.event_name != 'pull_request' }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0

- name: Set up Docker Metadata
id: meta
uses: docker/metadata-action@dbef88086f6cef02e264edb7dbf63250c17cef6c # v5.5.0
with:
images: ${{ github.repository }}
flavor:
latest=auto
prefix=${{ matrix.variant.tag }}-,onlatest=true
tags: |
type=edge
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
- name: Build and push
uses: docker/build-push-action@4a13e500e55cf31b7a5d59a38ab2040ab0f42f56 # v5.1.0
with:
push: ${{ github.event_name != 'pull_request' }}
cache-from: type=gha,scope=${{ matrix.variant.tag }}
cache-to: type=gha,mode=max,scope=${{ matrix.variant.tag }}
context: .
file: ${{ matrix.variant.dockerfile }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
24 changes: 24 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Lint C++ code

on:
push:
workflow_dispatch:

permissions:
contents: none

jobs:
lint:
name: clang-format
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Check out code
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

- name: clang-format Check
uses: jidicula/clang-format-action@v4.11.0
with:
clang-format-version: 17
check-path: src

0 comments on commit d349692

Please sign in to comment.