diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml new file mode 100644 index 0000000..a5be64b --- /dev/null +++ b/.github/workflows/docker.yml @@ -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 }} diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..4a7c1b1 --- /dev/null +++ b/.github/workflows/lint.yml @@ -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