Skip to content

Commit

Permalink
ci: add required checks and fix builds (#228)
Browse files Browse the repository at this point in the history
* ci: add required checks and fix builds

Signed-off-by: Patrick Stephens <[email protected]>

* ci: add codeowners

Signed-off-by: Patrick Stephens <[email protected]>

* workflows: use correct action versions

Signed-off-by: Patrick Stephens <[email protected]>

* workflows: use correct cmake for Debian

Signed-off-by: Patrick Stephens <[email protected]>

* workflows: use submodule checkout

Signed-off-by: Patrick Stephens <[email protected]>

* workflows: update git version

Signed-off-by: Patrick Stephens <[email protected]>

---------

Signed-off-by: Patrick Stephens <[email protected]>
  • Loading branch information
patrick-stephens authored Dec 19, 2024
1 parent 679397b commit 5319174
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 39 deletions.
65 changes: 60 additions & 5 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
name: Build PR(s) and master branch.
on:
workflow_dispatch:
push:
branches:
- master
pull_request:
branches:
- master
types: [opened, reopened, synchronize]

jobs:
build-windows:
name: Build sources on amd64 for ${{ matrix.os }}
Expand Down Expand Up @@ -46,8 +46,8 @@ jobs:
run: |
sed -i -e "s/^mirrorlist=http:\/\/mirrorlist.centos.org/#mirrorlist=http:\/\/mirrorlist.centos.org/g" /etc/yum.repos.d/CentOS-Base.repo
sed -i -e "s/^#baseurl=http:\/\/mirror.centos.org/baseurl=http:\/\/vault.centos.org/g" /etc/yum.repos.d/CentOS-Base.repo
yum -y update && \
yum install -y ca-certificates cmake gcc gcc-c++ git make wget && \
yum -y update
yum install -y ca-certificates cmake gcc gcc-c++ git make wget
yum install -y epel-release
yum install -y cmake3
shell: bash
Expand All @@ -57,13 +57,42 @@ jobs:
git clone --recursive https://github.com/calyptia/cmetrics.git
shell: bash

- name: Check out the branch (1.8.3 version of Git)
env:
BRANCH_NAME: ${{ github.head_ref }}
run: |
git checkout "$BRANCH_NAME"
shell: bash
working-directory: cmetrics

- name: Run compilation
run: |
cmake3 -DCMT_TESTS=on -DCMT_DEV=on .
make
shell: bash
working-directory: cmetrics

build-debian:
name: Debian Buster build to confirm no issues once used downstream
runs-on: ubuntu-latest
container: debian:buster
steps:
- name: Set up base image dependencies
run: |
apt-get update
apt-get install -y build-essential cmake make git
shell: bash

- uses: actions/checkout@v4
with:
submodules: true

- name: Run compilation
run: |
cmake -DCMT_TESTS=on -DCMT_DEV=on .
make
shell: bash

build-unix-arm64:
name: Build sources on arm64 for ${{ matrix.os }} - ${{ matrix.compiler }}
runs-on: ${{ matrix.os }}
Expand All @@ -80,10 +109,10 @@ jobs:
submodules: true

- name: Build on ${{ matrix.os }} with ${{ matrix.compiler }}
uses: uraimo/run-on-arch-action@v2.5.0
uses: uraimo/run-on-arch-action@v2.8.1
with:
arch: aarch64
distro: ubuntu20.04
distro: ubuntu_latest
run: |
apt-get update && \
apt-get install -y --no-install-recommends \
Expand Down Expand Up @@ -148,3 +177,29 @@ jobs:
# dependencies_debian: ''
cmakeflags: '-DCMT_TESTS=On -DCMT_DEV=on .'
build_command: make all

# this job provides the single required status for PRs to be merged into main.
# instead of updating the protected branch status in github, developers can update the needs section below
# to require additional status checks to protect main.
# the job uses the alls-green action to get around the github issue that treats a "skipped" required status check
# as passed. github will skip a job if an upstream needed job fails, which would defeat the purpose of this required
# status check.
test-required-checks-complete:
# note: this step always has to run in order to check if the dependent jobs passed. by default github skips running a job
# if the needed jobs upstream failed.
if: always()
needs:
- build-windows
- build-centos
- build-debian
- build-unix-arm64
- build-unix-amd64
- build-analysis-tests
name: Required checks complete
runs-on: ubuntu-latest
permissions: {}
steps:
- name: Decide whether the needed jobs succeeded or failed
uses: re-actors/alls-green@release/v1
with:
jobs: ${{ toJSON(needs) }}
40 changes: 6 additions & 34 deletions .github/workflows/packages.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ jobs:
with:
submodules: true

- uses: uraimo/run-on-arch-action@v2.5.0
- uses: uraimo/run-on-arch-action@v2.8.1
name: Build the ${{matrix.format}} packages
with:
arch: aarch64
distro: ubuntu20.04
distro: ubuntu_latest
run: |
apt-get update && \
apt-get install -y --no-install-recommends \
Expand All @@ -51,7 +51,8 @@ jobs:
fail-fast: true
matrix:
format: [ rpm, deb ]
runs-on: ubuntu-latest

runs-on: [ ubuntu-latest ]
steps:
- uses: actions/checkout@v4
with:
Expand All @@ -69,33 +70,6 @@ jobs:
path: |
./*.${{matrix.format}}
build-macos-packages-amd64:
name: build macOS intel packages
strategy:
fail-fast: true
matrix:
config:
- format: productbuild
arch: intel
ext: pkg
runs-on: macos-12
steps:
- uses: actions/checkout@v3
with:
submodules: true

- name: Build the ${{matrix.config.format}} packages
run: |
cmake . -DCPACK_GENERATOR=${{ matrix.config.format }}
echo ${{ matrix.config.format }} | xargs -I{} cpack -G {}
- name: Store the master package artifacts
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.config.format }}-${{matrix.config.arch}}
path: |
./*-${{matrix.config.arch}}.${{matrix.config.ext}}
build-macos-packages-arm64:
name: build macOS Apple Silicon packages
strategy:
Expand All @@ -107,7 +81,7 @@ jobs:
ext: pkg
runs-on: macos-14
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: true

Expand All @@ -117,7 +91,7 @@ jobs:
echo ${{ matrix.config.format }} | xargs -I{} cpack -G {}
- name: Store the master package artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.config.format }}-${{matrix.config.arch}}
path: |
Expand All @@ -128,7 +102,6 @@ jobs:
needs:
- build-distro-packages-amd64
- build-distro-packages-arm64
- build-macos-packages-amd64
- build-macos-packages-arm64

runs-on: ubuntu-latest
Expand Down Expand Up @@ -160,6 +133,5 @@ jobs:
if: startsWith(github.ref, 'refs/tags/')
with:
generate_release_notes: true
draft: false
files: |
artifacts/**/*
7 changes: 7 additions & 0 deletions CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Global Owners
# -------------
* @edsiper @leonardo-albertovich

# CI
# -------------------------
/.github/ @niedbalski @patrick-stephens @celalettin1286

0 comments on commit 5319174

Please sign in to comment.