code(ci/rpm): Install package for each os #27
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name : Main pipeline | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
- ci/create-rpm-package | |
pull_request: | |
env: | |
os: RHEL | |
os_version: 93 | |
jobs: | |
parsing: | |
runs-on: ubuntu-latest | |
outputs: | |
compvers: ${{ steps.params.outputs.compvers }} | |
compname: ${{ steps.params.outputs.compname }} | |
comparch: ${{ steps.params.outputs.comparch }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-tags: 'true' | |
- name: Setup for alumet | |
run: | | |
mkdir -p alumet | |
- name: Checkout alumet | |
uses: actions/checkout@v4 | |
with: | |
repository: alumet-dev/alumet | |
path: "alumet" | |
- name: Parse alumet version | |
id: params | |
run: | | |
compname=$(awk '/Name/ { print $2 }' ./specs/alumet.spec) | |
comparch=$(awk '/BuildArch/ { print $2 }' ./specs/alumet.spec) | |
cd alumet/app-agent/ | |
ls -al | |
pwd | |
compvers=$(cargo pkgid | cut -d "#" -f2) | |
echo "compvers=$compvers" >> $GITHUB_OUTPUT | |
echo "compname=$compname" >> $GITHUB_OUTPUT | |
echo "comparch=$comparch" >> $GITHUB_OUTPUT | |
echo "Pipeline will build [$compname] in version [$compvers] for the architecture [$comparch]" >> $GITHUB_STEP_SUMMARY | |
packaging: | |
runs-on: ubuntu-latest | |
needs: | |
- parsing | |
strategy: | |
matrix: | |
os: [fedora-40, fedora-41, fedora-42, ubi-8, ubi-9] | |
env: | |
name: ${{ needs.parsing.outputs.compname }} | |
compvers: ${{ needs.parsing.outputs.compvers }} | |
arch: ${{ needs.parsing.outputs.comparch }} | |
container: | |
image: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install RPM on Fedora | |
if: contains(matrix.os, 'fedora') | |
run: | | |
sudo dnf install rust cargo -y -v | |
export PATH=$PATH:$HOME/.cargo/bin/ | |
sudo dnf install rpm-build rpmdevtools -y -v | |
sudo dnf install cargo-rpm-macros -y -v | |
- name: Install RPM on RHEL | |
if: contains(matrix.os, 'ubi') | |
run: | | |
sudo yum install rust cargo -y -v | |
export PATH=$PATH:$HOME/.cargo/bin/ | |
sudo yum install rpm-build rpmdevtools -y -v | |
sudo yum install cargo-rpm-macros -y -v | |
- name: Install cargo lock2rpm and protoc | |
run: | | |
cargo install cargo-lock2rpmprovides | |
PROTOC_ZIP=protoc-28.0-linux-x86_64.zip | |
curl -OL https://github.com/protocolbuffers/protobuf/releases/download/v28.0/$PROTOC_ZIP | |
sudo unzip -o $PROTOC_ZIP -d /usr/local bin/protoc | |
sudo unzip -o $PROTOC_ZIP -d /usr/local 'include/*' | |
rm -f $PROTOC_ZIP | |
- name: Setup for alumet | |
run: | | |
mkdir -p alumet | |
mkdir -p /etc/alumet | |
- name: Checkout alumet | |
uses: actions/checkout@v4 | |
with: | |
repository: alumet-dev/alumet | |
path: "alumet" | |
- uses: Swatinem/rust-cache@v2 | |
with: | |
cache-on-failure: true | |
cache-targets: "alumet" | |
- name: get Spec settings | |
id: get-spec-settings | |
env: | |
build_dir: "$(pwd)/build" | |
run: | | |
mkdir -p ${{ env.build_dir }}/SOURCES | |
tar --exclude=".[^/]*" --exclude="./build" --transform 's|.|alumet|' -zcvf ${{ env.build_dir }}/SOURCES/alumet.tar.gz . | |
rpmbuild -ba -vv --define "_topdir ${{ env.build_dir }}" --define "release ${{env.os}}${{env.os_version}}" --define "version ${{ env.compvers }}" specs/alumet.spec | |
- name: Upload artifact local agent | |
uses: actions/upload-artifact@v4 | |
with: | |
name: alumet-local-agent-${{ env.name }}-${{env.os}}${{ matrix.os }}.${{ env.arch }}.rpm | |
path: | | |
./build/RPMS/${{ env.arch }}/${{ env.name }}-alumet-local-agent-${{ env.compvers }}-${{env.os}}${{env.os_version}}.${{ env.arch }}.rpm | |
- name: Upload artifact relay client | |
uses: actions/upload-artifact@v4 | |
with: | |
name: alumet-relay-client-${{ env.name }}-${{env.os}}$${{ matrix.os }}.${{ env.arch }}.rpm | |
path: | | |
./build/RPMS/${{ env.arch }}/${{ env.name }}-alumet-relay-client-${{ env.compvers }}-${{env.os}}${{env.os_version}}.${{ env.arch }}.rpm | |
- name: Upload artifact relay server | |
uses: actions/upload-artifact@v4 | |
with: | |
name: alumet-relay-server-${{ env.name }}-${{env.os}}${{ matrix.os }}.${{ env.arch }}.rpm | |
path: | | |
./build/RPMS/${{ env.arch }}/${{ env.name }}-alumet-relay-server-${{ env.compvers }}-${{env.os}}${{env.os_version}}.${{ env.arch }}.rpm | |