Skip to content

Commit dda0a4f

Browse files
committed
Merge branch 'AN-205-ghcr-build-update' into v29
2 parents 7f45b50 + 67b67dd commit dda0a4f

File tree

4 files changed

+268
-121
lines changed

4 files changed

+268
-121
lines changed

.github/workflows/ci.yml

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
name: Coordinate Core - Build and Push to GHCR
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- dev
8+
9+
permissions:
10+
contents: write
11+
pull-requests: write
12+
packages: write
13+
14+
env:
15+
IMAGE_NAME: coordinate-core
16+
17+
jobs:
18+
build-and-push:
19+
name: Build and Push Docker Image
20+
runs-on: governance-testenv-github-self-hosted
21+
22+
steps:
23+
- name: Checkout Code
24+
uses: actions/checkout@v4
25+
26+
- name: Set environment based on branch
27+
id: env
28+
run: |
29+
if [[ "${{ github.ref_name }}" == "main" ]]; then
30+
echo "tag_suffix=latest" >> $GITHUB_OUTPUT
31+
echo "release_branch=main" >> $GITHUB_OUTPUT
32+
else
33+
echo "tag_suffix=beta" >> $GITHUB_OUTPUT
34+
echo "release_branch=dev" >> $GITHUB_OUTPUT
35+
fi
36+
37+
- name: Create new tag (semantic versioning)
38+
id: tag
39+
uses: mathieudutour/[email protected]
40+
with:
41+
github_token: ${{ secrets.GITHUB_TOKEN }}
42+
release_branches: ${{ steps.env.outputs.release_branch }}
43+
default_bump: patch
44+
45+
- name: Set lowercase owner name
46+
id: lowercase
47+
run: |
48+
echo "owner=$(echo ${{ github.repository_owner }} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_OUTPUT
49+
50+
- name: Install Dependencies
51+
run: |
52+
# Wait for apt lock to be released
53+
while sudo fuser /var/lib/dpkg/lock-frontend >/dev/null 2>&1; do
54+
echo "Waiting for other apt processes to finish..."
55+
sleep 5
56+
done
57+
58+
sudo apt-get update && sudo apt-get install -y \
59+
build-essential \
60+
libtool \
61+
autotools-dev \
62+
automake \
63+
pkg-config \
64+
bsdmainutils \
65+
python3 \
66+
libevent-dev \
67+
libboost-dev \
68+
libsqlite3-dev \
69+
libminiupnpc-dev \
70+
libnatpmp-dev \
71+
libzmq3-dev \
72+
systemtap-sdt-dev \
73+
curl
74+
75+
- name: autogen
76+
run: ./autogen.sh
77+
78+
- name: configure
79+
run: ./configure --without-gui
80+
81+
- name: make
82+
run: make
83+
84+
- name: Fix Docker socket permissions
85+
run: sudo chmod 666 /var/run/docker.sock
86+
87+
- name: Set up QEMU
88+
uses: docker/setup-qemu-action@v3
89+
90+
- name: Set up Docker Buildx
91+
uses: docker/setup-buildx-action@v3
92+
93+
- name: Log in to GitHub Container Registry
94+
uses: docker/login-action@v3
95+
with:
96+
registry: ghcr.io
97+
username: ${{ github.actor }}
98+
password: ${{ secrets.GITHUB_TOKEN }}
99+
100+
- name: Extract metadata (tags, labels) for Docker
101+
id: meta
102+
uses: docker/metadata-action@v5
103+
with:
104+
images: ghcr.io/${{ steps.lowercase.outputs.owner }}/${{ env.IMAGE_NAME }}
105+
tags: |
106+
type=raw,value=${{ steps.tag.outputs.new_tag }}
107+
type=raw,value=${{ steps.env.outputs.tag_suffix }}
108+
109+
- name: Build and Push Docker Image
110+
uses: docker/build-push-action@v5
111+
with:
112+
context: .
113+
push: true
114+
platforms: linux/amd64,linux/arm64
115+
tags: ${{ steps.meta.outputs.tags }}
116+
labels: ${{ steps.meta.outputs.labels }}
117+
cache-from: type=gha
118+
cache-to: type=gha,mode=max

.github/workflows/dev-build-push-ecr.yml

Lines changed: 0 additions & 89 deletions
This file was deleted.
Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
name: DEV - Build and Push to GHCR
2+
3+
on:
4+
pull_request:
5+
types:
6+
- closed
7+
branches:
8+
- dev
9+
10+
permissions:
11+
contents: write
12+
pull-requests: write
13+
packages: write
14+
15+
env:
16+
IMAGE_NAME: coordinatecore
17+
ENV_TYPE: dev
18+
19+
jobs:
20+
build-and-push:
21+
name: Build and Push Docker Image
22+
if: ${{ github.event.pull_request.merged == true }}
23+
runs-on: governance-testenv-github-self-hosted
24+
25+
steps:
26+
- name: Checkout Code
27+
uses: actions/checkout@v4
28+
29+
- name: Cache CMake build
30+
uses: actions/cache@v3
31+
with:
32+
path: |
33+
build
34+
~/.cache
35+
key: ${{ runner.os }}-cmake-${{ hashFiles('**/CMakeLists.txt') }}-${{ hashFiles('**/*.cpp', '**/*.h') }}
36+
restore-keys: |
37+
${{ runner.os }}-cmake-${{ hashFiles('**/CMakeLists.txt') }}-
38+
${{ runner.os }}-cmake-
39+
40+
- name: Cache apt packages
41+
uses: actions/cache@v3
42+
with:
43+
path: /var/cache/apt/archives
44+
key: ${{ runner.os }}-apt-${{ hashFiles('.github/workflows/*.yml') }}
45+
restore-keys: |
46+
${{ runner.os }}-apt-
47+
48+
- name: Create new tag (semantic versioning)
49+
id: tag
50+
uses: mathieudutour/[email protected]
51+
with:
52+
github_token: ${{ secrets.GITHUB_TOKEN }}
53+
release_branches: dev,main
54+
default_bump: patch # can be major/minor/patch
55+
56+
- name: Set lowercase owner name
57+
id: lowercase
58+
run: |
59+
echo "owner=$(echo ${{ github.repository_owner }} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_OUTPUT
60+
61+
- name: Install Dependencies
62+
run: |
63+
# Wait for apt lock to be released
64+
while sudo fuser /var/lib/dpkg/lock-frontend >/dev/null 2>&1; do
65+
echo "Waiting for other apt processes to finish..."
66+
sleep 5
67+
done
68+
69+
sudo apt-get update && sudo apt-get install -y \
70+
build-essential \
71+
cmake \
72+
libtool \
73+
autotools-dev \
74+
automake \
75+
pkg-config \
76+
bsdmainutils \
77+
python3 \
78+
libevent-dev \
79+
libboost-dev \
80+
libsqlite3-dev \
81+
libminiupnpc-dev \
82+
libnatpmp-dev \
83+
libzmq3-dev \
84+
systemtap-sdt-dev \
85+
curl
86+
87+
- name: Configure with CMake
88+
run: cmake -B build -DWITH_ZMQ=ON
89+
90+
- name: Build with CMake
91+
run: cmake --build build
92+
93+
- name: Verify build artifacts
94+
run: ls -la build/bin/
95+
96+
- name: Fix Docker socket permissions
97+
run: |
98+
sudo chmod 666 /var/run/docker.sock
99+
100+
- name: Set up Docker Buildx
101+
uses: docker/setup-buildx-action@v3
102+
103+
- name: Log in to GitHub Container Registry
104+
uses: docker/login-action@v3
105+
with:
106+
registry: ghcr.io
107+
username: ${{ github.actor }}
108+
password: ${{ secrets.GITHUB_TOKEN }}
109+
110+
- name: Extract metadata (tags, labels) for Docker
111+
id: meta
112+
uses: docker/metadata-action@v5
113+
with:
114+
images: ghcr.io/${{ steps.lowercase.outputs.owner }}/${{ env.IMAGE_NAME }}
115+
tags: |
116+
type=raw,value=${{ steps.tag.outputs.new_tag }}
117+
type=raw,value=latest
118+
type=ref,event=branch
119+
120+
- name: Build and Push Docker Image
121+
uses: docker/build-push-action@v5
122+
with:
123+
context: .
124+
push: true
125+
tags: ${{ steps.meta.outputs.tags }}
126+
labels: ${{ steps.meta.outputs.labels }}
127+
cache-from: type=registry,ref=ghcr.io/${{ steps.lowercase.outputs.owner }}/${{ env.IMAGE_NAME }}:buildcache
128+
cache-to: type=registry,ref=ghcr.io/${{ steps.lowercase.outputs.owner }}/${{ env.IMAGE_NAME }}:buildcache,mode=max

0 commit comments

Comments
 (0)