Initial attempt with CI
This commit is contained in:
50
.github/workflows/ghcr-push.yml
vendored
Normal file
50
.github/workflows/ghcr-push.yml
vendored
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
name: Deploy to GHCR
|
||||||
|
|
||||||
|
# only run most recent workflow in branch
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}-${{ github.ref }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [ "master" ]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-16:
|
||||||
|
name: Build + Publish 16
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
packages: write
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
name: Checkout
|
||||||
|
|
||||||
|
- name: Build
|
||||||
|
run: |
|
||||||
|
docker build -f clang-format-16.dockerfile -t ghcr.io/cwpearson/clang-format-16:latest .
|
||||||
|
|
||||||
|
- name: Publish to GHCR
|
||||||
|
run: |
|
||||||
|
echo '${{secrets.GHCR_TOKEN}}' | docker login ghcr.io -u cwpearson --password-stdin
|
||||||
|
docker push ghcr.io/cwpearson/clang-format-16:latest
|
||||||
|
build-8:
|
||||||
|
name: Build + Publish 8
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
packages: write
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
name: Checkout
|
||||||
|
|
||||||
|
- name: Build
|
||||||
|
run: |
|
||||||
|
docker build -f clang-format-8.dockerfile -t ghcr.io/cwpearson/clang-format-8:latest .
|
||||||
|
|
||||||
|
- name: Publish to GHCR
|
||||||
|
run: |
|
||||||
|
echo '${{secrets.GHCR_TOKEN}}' | docker login ghcr.io -u cwpearson --password-stdin
|
||||||
|
docker push ghcr.io/cwpearson/clang-format-8:latest
|
12
README.md
Normal file
12
README.md
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
#
|
||||||
|
|
||||||
|
```bash
|
||||||
|
podman build -f clang-format-16.dockerfile -t clang-format-16:latest
|
||||||
|
podman build -f clang-format-8.dockerfile -t clang-format-8:latest
|
||||||
|
```
|
||||||
|
|
||||||
|
## Deploy
|
||||||
|
|
||||||
|
1. Create a "personal access token (classic)" with `write:packages`
|
||||||
|
* account > settings > developer settings > personal access tokens
|
||||||
|
2. Put that personal access token as the repository secret `GHCR_TOKEN`.
|
34
clang-format-16.dockerfile
Normal file
34
clang-format-16.dockerfile
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
# Stage 1: Build environment
|
||||||
|
FROM docker.io/redhat/ubi8 AS builder
|
||||||
|
|
||||||
|
LABEL org.opencontainers.image.source https://github.com/cwpearson/clang-format
|
||||||
|
|
||||||
|
RUN dnf install -y \
|
||||||
|
cmake \
|
||||||
|
gcc \
|
||||||
|
gcc-c++ \
|
||||||
|
python3 \
|
||||||
|
wget \
|
||||||
|
xz \
|
||||||
|
&& dnf clean all
|
||||||
|
|
||||||
|
RUN wget -q https://github.com/llvm/llvm-project/releases/download/llvmorg-16.0.6/llvm-project-16.0.6.src.tar.xz \
|
||||||
|
&& tar -xf llvm-project-16.0.6.src.tar.xz
|
||||||
|
RUN cmake -S llvm-project-16.0.6.src/llvm -B build \
|
||||||
|
-DLLVM_ENABLE_PROJECTS='clang' \
|
||||||
|
-DCMAKE_BUILD_TYPE=MinSizeRel \
|
||||||
|
-DLLVM_TARGETS_TO_BUILD=""
|
||||||
|
RUN make -C build -j$(nproc) install
|
||||||
|
|
||||||
|
# base final image off ubi8-micro
|
||||||
|
FROM docker.io/redhat/ubi8-micro
|
||||||
|
|
||||||
|
# clang-format-16 links this
|
||||||
|
COPY --from=builder /lib64/libstdc++.so.6 /lib64/libstdc++.so.6
|
||||||
|
# keep clang-format binary only
|
||||||
|
COPY --from=builder /usr/local/bin/clang-format /usr/local/bin/clang-format
|
||||||
|
# also provide clang-format-16
|
||||||
|
RUN ln -s /usr/local/bin/clang-format /usr/local/bin/clang-format-16
|
||||||
|
|
||||||
|
# expect caller to map $PWD into /src with -v flag
|
||||||
|
WORKDIR /src
|
37
clang-format-8.dockerfile
Normal file
37
clang-format-8.dockerfile
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
# Stage 1: Build environment
|
||||||
|
FROM docker.io/redhat/ubi8 AS builder
|
||||||
|
|
||||||
|
LABEL org.opencontainers.image.source https://github.com/cwpearson/clang-format
|
||||||
|
|
||||||
|
RUN dnf install -y \
|
||||||
|
cmake \
|
||||||
|
gcc \
|
||||||
|
gcc-c++ \
|
||||||
|
python3 \
|
||||||
|
wget \
|
||||||
|
xz \
|
||||||
|
&& dnf clean all
|
||||||
|
|
||||||
|
RUN wget -q https://github.com/llvm/llvm-project/releases/download/llvmorg-8.0.1/llvm-8.0.1.src.tar.xz \
|
||||||
|
&& tar -xf llvm-8.0.1.src.tar.xz --no-same-owner
|
||||||
|
RUN wget -q https://github.com/llvm/llvm-project/releases/download/llvmorg-8.0.1/cfe-8.0.1.src.tar.xz \
|
||||||
|
&& tar -xf cfe-8.0.1.src.tar.xz --no-same-owner
|
||||||
|
RUN mv cfe-8.0.1.src clang
|
||||||
|
RUN cmake -S llvm-8.0.1.src -B build \
|
||||||
|
-DLLVM_ENABLE_PROJECTS='clang' \
|
||||||
|
-DCMAKE_BUILD_TYPE=MinSizeRel \
|
||||||
|
-DLLVM_TARGETS_TO_BUILD=""
|
||||||
|
RUN make -C build -j$(nproc) install
|
||||||
|
|
||||||
|
# base final image off ubi8-micro
|
||||||
|
FROM docker.io/redhat/ubi8-micro
|
||||||
|
|
||||||
|
# clang-format-16 links this
|
||||||
|
COPY --from=builder /lib64/libstdc++.so.6 /lib64/libstdc++.so.6
|
||||||
|
# keep clang-format binary only
|
||||||
|
COPY --from=builder /usr/local/bin/clang-format /usr/local/bin/clang-format
|
||||||
|
# also provide clang-format-8
|
||||||
|
RUN ln -s /usr/local/bin/clang-format /usr/local/bin/clang-format-8
|
||||||
|
|
||||||
|
# expect caller to map $PWD into /src with -v flag
|
||||||
|
WORKDIR /src
|
Reference in New Issue
Block a user