@@ -10,15 +10,24 @@ permissions:
1010
1111jobs :
1212 build-rpm :
13- name : Build RPM Package
13+ name : Build RPM Package (${{ matrix.arch }})
1414 runs-on : ubuntu-latest
15+ strategy :
16+ matrix :
17+ arch : [x86_64, aarch64]
18+ fail-fast : false
1519
1620 steps :
1721 - name : Checkout code
1822 uses : actions/checkout@v4
1923 with :
2024 fetch-depth : 0 # Fetch all history for git describe
2125
26+ - name : Set up QEMU
27+ uses : docker/setup-qemu-action@v3
28+ with :
29+ platforms : arm64,amd64
30+
2231 - name : Set up Docker Buildx
2332 uses : docker/setup-buildx-action@v3
2433
@@ -27,60 +36,167 @@ jobs:
2736 run : |
2837 VERSION="${GITHUB_REF#refs/tags/v}"
2938 echo "version=$VERSION" >> $GITHUB_OUTPUT
30- echo "Building version: $VERSION"
39+ echo "Building version: $VERSION for architecture: ${{ matrix.arch }} "
3140
32- - name : Build RPM package
41+ - name : Set architecture-specific variables
42+ id : arch
43+ run : |
44+ if [ "${{ matrix.arch }}" = "x86_64" ]; then
45+ echo "docker_platform=linux/amd64" >> $GITHUB_OUTPUT
46+ echo "docker_arch=amd64" >> $GITHUB_OUTPUT
47+ else
48+ echo "docker_platform=linux/arm64" >> $GITHUB_OUTPUT
49+ echo "docker_arch=arm64" >> $GITHUB_OUTPUT
50+ fi
51+
52+ - name : Build RPM builder Docker image
3353 run : |
34- cd support/rpm
35- ./test-rpm-build.sh
54+ docker buildx build \
55+ --platform ${{ steps.arch.outputs.docker_platform }} \
56+ --load \
57+ --cache-from type=gha,scope=rpmbuild-${{ matrix.arch }} \
58+ --cache-to type=gha,mode=max,scope=rpmbuild-${{ matrix.arch }} \
59+ -f support/rpm/Dockerfile.rpmbuild \
60+ -t mygramdb-rpmbuild:${{ steps.version.outputs.version }}-${{ matrix.arch }} \
61+ .
62+
63+ - name : Build RPM packages
64+ run : |
65+ # Create output directory in workspace
66+ mkdir -p "$GITHUB_WORKSPACE/dist/rpm"
67+
68+ # Run RPM build with absolute paths
69+ docker run --rm \
70+ --platform ${{ steps.arch.outputs.docker_platform }} \
71+ -e MYGRAMDB_VERSION="${{ steps.version.outputs.version }}" \
72+ -v "$GITHUB_WORKSPACE/dist:/workspace/dist" \
73+ mygramdb-rpmbuild:${{ steps.version.outputs.version }}-${{ matrix.arch }}
3674
37- - name : List generated RPMs
75+ - name : Verify RPM packages exist
3876 run : |
77+ if ! ls dist/rpm/*.rpm 1> /dev/null 2>&1; then
78+ echo "Error: No RPM packages found in dist/rpm/"
79+ ls -la dist/rpm/ || true
80+ exit 1
81+ fi
3982 echo "Generated RPM packages:"
4083 ls -lh dist/rpm/*.rpm
4184
4285 - name : Test RPM installation (AlmaLinux 9)
4386 run : |
44- docker run --rm -v "$(pwd)/dist:/dist" almalinux:9 bash -c "
87+ # Find the main RPM package (not debuginfo/debugsource/devel)
88+ MAIN_RPM=$(find dist/rpm -name "mygramdb-${{ steps.version.outputs.version }}-*.el9.${{ matrix.arch }}.rpm" \
89+ ! -name "*debuginfo*" ! -name "*debugsource*" ! -name "*devel*" -print -quit)
90+
91+ if [ -z "$MAIN_RPM" ]; then
92+ echo "Error: Main RPM package not found for architecture ${{ matrix.arch }}"
93+ echo "Looking for: mygramdb-${{ steps.version.outputs.version }}-*.el9.${{ matrix.arch }}.rpm"
94+ echo "Available files:"
95+ ls -la dist/rpm/
96+ exit 1
97+ fi
98+
99+ echo "Testing RPM: $MAIN_RPM"
100+
101+ docker run --rm \
102+ --platform ${{ steps.arch.outputs.docker_platform }} \
103+ -v "$GITHUB_WORKSPACE/dist:/dist" \
104+ almalinux:9 bash -c "
105+ set -e
45106 echo '=== Installing Oracle MySQL 8.0 repository ==='
46- dnf install -y https://dev.mysql.com/get/mysql84-community-release-el9-1.noarch.rpm > /dev/null 2>&1
47- dnf module disable -y mysql > /dev/null 2>&1
107+ dnf install -y https://dev.mysql.com/get/mysql84-community-release-el9-1.noarch.rpm
108+ dnf module disable -y mysql
48109
49110 echo '=== Installing MygramDB RPM ==='
50- dnf install -y /dist/rpm/mygramdb-${{ steps.version.outputs.version }}-*.el9.*.rpm
111+ dnf install -y /dist/rpm/$(basename $MAIN_RPM)
51112
52113 echo '=== Verifying installation ==='
114+ echo 'Checking binaries exist...'
115+ test -x /usr/bin/mygramdb || (echo 'Error: mygramdb binary not found'; exit 1)
116+ test -x /usr/bin/mygram-cli || (echo 'Error: mygram-cli binary not found'; exit 1)
117+
53118 echo 'Checking for missing library dependencies...'
54- ldd /usr/bin/mygramdb | grep 'not found' && exit 1 || echo 'mygramdb: OK'
55- ldd /usr/bin/mygram-cli | grep 'not found' && exit 1 || echo 'mygram-cli: OK'
119+ if ldd /usr/bin/mygramdb | grep 'not found'; then
120+ echo 'Error: mygramdb has missing dependencies'
121+ exit 1
122+ fi
123+ echo 'mygramdb: OK'
124+
125+ if ldd /usr/bin/mygram-cli | grep 'not found'; then
126+ echo 'Error: mygram-cli has missing dependencies'
127+ exit 1
128+ fi
129+ echo 'mygram-cli: OK'
56130
57131 echo '=== Installation test passed! ==='
58132 "
59133
60134 - name : Upload RPM artifacts
61135 uses : actions/upload-artifact@v4
62136 with :
63- name : rpm-packages
64- path : |
65- dist/rpm/*.rpm
137+ name : rpm-packages-${{ matrix.arch }}
138+ path : dist/rpm/*.rpm
66139 retention-days : 30
140+ if-no-files-found : error
141+
142+ create-release :
143+ name : Create GitHub Release
144+ needs : build-rpm
145+ runs-on : ubuntu-latest
146+
147+ steps :
148+ - name : Checkout code
149+ uses : actions/checkout@v4
150+
151+ - name : Extract version from tag
152+ id : version
153+ run : |
154+ VERSION="${GITHUB_REF#refs/tags/v}"
155+ echo "version=$VERSION" >> $GITHUB_OUTPUT
156+
157+ - name : Download all artifacts
158+ uses : actions/download-artifact@v4
159+ with :
160+ path : dist/rpm
161+ pattern : rpm-packages-*
162+ merge-multiple : true
163+
164+ - name : List downloaded artifacts
165+ run : |
166+ echo "Downloaded RPM packages:"
167+ ls -lh dist/rpm/
67168
68169 - name : Create GitHub Release
69- uses : softprops/action-gh-release@v1
170+ uses : softprops/action-gh-release@v2
70171 with :
71172 name : Release ${{ steps.version.outputs.version }}
72173 draft : false
73174 prerelease : false
74175 generate_release_notes : true
75- files : |
76- dist/rpm/mygramdb-${{ steps.version.outputs.version }}-*.el9.*.rpm
77- dist/rpm/mygramdb-debuginfo-${{ steps.version.outputs.version }}-*.el9.*.rpm
78- dist/rpm/mygramdb-debugsource-${{ steps.version.outputs.version }}-*.el9.*.rpm
176+ files : dist/rpm/*.rpm
177+ fail_on_unmatched_files : true
79178 body : |
80179 ## MygramDB ${{ steps.version.outputs.version }}
81180
82181 ### Installation (RHEL/AlmaLinux/Rocky Linux 9)
83182
183+ #### For x86_64 (Intel/AMD):
184+ ```bash
185+ # Install Oracle MySQL 8.0 repository
186+ sudo dnf install -y https://dev.mysql.com/get/mysql84-community-release-el9-1.noarch.rpm
187+ sudo dnf module disable -y mysql
188+
189+ # Download and install MygramDB RPM
190+ wget https://github.com/${{ github.repository }}/releases/download/v${{ steps.version.outputs.version }}/mygramdb-${{ steps.version.outputs.version }}-1.el9.x86_64.rpm
191+ sudo dnf install -y ./mygramdb-${{ steps.version.outputs.version }}-1.el9.x86_64.rpm
192+
193+ # Configure and start service
194+ sudo cp /etc/mygramdb/config.yaml.example /etc/mygramdb/config.yaml
195+ sudo vi /etc/mygramdb/config.yaml # Edit configuration
196+ sudo systemctl enable --now mygramdb
197+ ```
198+
199+ #### For aarch64 (ARM64):
84200 ```bash
85201 # Install Oracle MySQL 8.0 repository
86202 sudo dnf install -y https://dev.mysql.com/get/mysql84-community-release-el9-1.noarch.rpm
98214
99215 ### Package Details
100216 - **Platform**: RHEL 9 / AlmaLinux 9 / Rocky Linux 9
101- - **Architecture **: aarch64 (ARM64)
217+ - **Architectures **: x86_64 (Intel/AMD), aarch64 (ARM64)
102218 - **Build Type**: Static linking (minimal dependencies)
103219 - **Dependencies**: libicu, MySQL client libraries (auto-installed)
104220
@@ -108,3 +224,8 @@ jobs:
108224 - Systemd service: `/usr/lib/systemd/system/mygramdb.service`
109225 - Config example: `/etc/mygramdb/config.yaml.example`
110226 - Data directory: `/var/lib/mygramdb`
227+
228+ ### Available Packages
229+ - `mygramdb-${{ steps.version.outputs.version }}-1.el9.x86_64.rpm` - Main package (x86_64)
230+ - `mygramdb-${{ steps.version.outputs.version }}-1.el9.aarch64.rpm` - Main package (aarch64)
231+ - Debug packages available for both architectures
0 commit comments