diff --git a/.github/workflows/actions/ubuntu-build-deps/action.yml b/.github/workflows/actions/ubuntu-build-deps/action.yml new file mode 100644 index 00000000..9ca76039 --- /dev/null +++ b/.github/workflows/actions/ubuntu-build-deps/action.yml @@ -0,0 +1,61 @@ +name: 'ubuntu build dependencies' +description: 'install required build dependencies for ubuntu' +inputs: + SUDO: + description: "set to true to run apt as root" + required: false + default: false + + +runs: + using: 'composite' + steps: + + - name: check if sudo is set + shell: bash + run: | + if [ ${{inputs.SUDO}} = true ] + then + AS_ROOT="sudo" + else + AS_ROOT="" + fi + echo "AS_ROOT=$AS_ROOT" >> $GITHUB_ENV + + - name: apt update + shell: bash + run: ${{env.AS_ROOT}} apt update + + - name: install build tools + shell: bash + run: | + ${{env.AS_ROOT}} apt install -y \ + build-essential \ + clang \ + clang-tidy \ + ninja-build \ + iwyu \ + pkgconf \ + wget + if [ "$(lsb_release -s -r)x" == "16.04x" ]; then apt install -y clang-tools; fi + + - name: install coturn dependencies + shell: bash + run: | + ${{env.AS_ROOT}} apt install -y \ + libevent-dev \ + libssl-dev \ + libpq-dev \ + libsqlite3-dev \ + libhiredis-dev \ + libmongoc-dev \ + libmicrohttpd-dev + if [ "$(lsb_release -s -r)x" == "16.04x" ]; then apt-get install -y libmariadb-client-lgpl-dev; fi + if [ "$(lsb_release -s -r)x" == "16.04x" ]; then apt-get install -y libmariadb-dev; fi + + - name: Prometheus Support + shell: bash + run: | + wget https://github.com/digitalocean/prometheus-client-c/releases/download/v0.1.3/libprom-dev-0.1.3-Linux.deb + wget https://github.com/digitalocean/prometheus-client-c/releases/download/v0.1.3/libpromhttp-dev-0.1.3-Linux.deb + ${{env.AS_ROOT}} apt install -y ./libprom-dev-0.1.3-Linux.deb ./libpromhttp-dev-0.1.3-Linux.deb diff --git a/.github/workflows/clang-tidy.yml b/.github/workflows/clang-tidy.yml index 15acf055..87dc713d 100644 --- a/.github/workflows/clang-tidy.yml +++ b/.github/workflows/clang-tidy.yml @@ -18,14 +18,10 @@ jobs: with: fetch-depth: 0 - - name: Install dependencies - run: | - sudo apt-get update - sudo apt install -y clang clang-tidy clang-tools ninja-build iwyu - sudo apt install -y wget libevent-dev libssl-dev libpq-dev libmariadb-dev libsqlite3-dev libhiredis-dev libmongoc-dev libmicrohttpd-dev - wget https://github.com/digitalocean/prometheus-client-c/releases/download/v0.1.3/libprom-dev-0.1.3-Linux.deb - wget https://github.com/digitalocean/prometheus-client-c/releases/download/v0.1.3/libpromhttp-dev-0.1.3-Linux.deb - sudo apt install -y ./libprom-dev-0.1.3-Linux.deb ./libpromhttp-dev-0.1.3-Linux.deb + - name: install dependencies + uses: ./.github/workflows/actions/ubuntu-build-deps + with: + SUDO: true - name: Configure run: | diff --git a/.github/workflows/compiler-sanitizers.yml b/.github/workflows/compiler-sanitizers.yml index 59a6e2d6..8cc71b20 100644 --- a/.github/workflows/compiler-sanitizers.yml +++ b/.github/workflows/compiler-sanitizers.yml @@ -22,14 +22,12 @@ jobs: - uses: actions/checkout@v4 with: fetch-depth: 0 + + - name: install dependencies + uses: ./.github/workflows/actions/ubuntu-build-deps + with: + SUDO: true - - name: Install dependencies - run: | - sudo apt-get update - sudo apt install -y clang wget libevent-dev libssl-dev libpq-dev libmariadb-dev libsqlite3-dev libhiredis-dev libmongoc-dev libmicrohttpd-dev - wget https://github.com/digitalocean/prometheus-client-c/releases/download/v0.1.3/libprom-dev-0.1.3-Linux.deb - wget https://github.com/digitalocean/prometheus-client-c/releases/download/v0.1.3/libpromhttp-dev-0.1.3-Linux.deb - sudo apt install -y ./libprom-dev-0.1.3-Linux.deb ./libpromhttp-dev-0.1.3-Linux.deb - name: Configure run: | diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 88c5bf31..d733e7f3 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -11,18 +11,13 @@ jobs: runs-on: ubuntu-latest steps: - - name: Install dependencies - run: | - sudo apt update - sudo apt install -y clang-format-15 - sudo apt install -y \ - libevent-dev \ - libssl-dev \ - libpq-dev libmariadb-dev libsqlite3-dev \ - libhiredis-dev \ - libmongoc-dev \ - libmicrohttpd-dev \ - uses: actions/checkout@v4 + - name: install dependencies + uses: ./.github/workflows/actions/ubuntu-build-deps + with: + SUDO: true + - name: install clang-format-15 + run: sudo apt install -y clang-format-15 - name: configure run: ./configure - name: lint diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 0b676d09..99ace59c 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -2,7 +2,6 @@ name: C/C++ CI on: push: - branches: [ $default-branch ] pull_request: types: [ opened, reopened, synchronize ] @@ -11,33 +10,16 @@ jobs: strategy: fail-fast: false matrix: - os: [ 'ubuntu:16.04', 'ubuntu:20.04', 'ubuntu:22.04' ] + os: [ 'ubuntu:16.04', 'ubuntu:18.04', 'ubuntu:20.04', 'ubuntu:22.04' ] runs-on: ubuntu-latest container: ${{ matrix.os }} steps: + - uses: actions/checkout@v3 - name: Install dependencies # Set env variable or otherwise tzdata package requires interaction env: - DEBIAN_FRONTEND: noninteractive - run: | - apt-get update - apt-get install -y \ - build-essential pkgconf - apt-get install -y \ - wget \ - libevent-dev \ - libssl-dev \ - libpq-dev libsqlite3-dev \ - libhiredis-dev \ - libmongoc-dev \ - libmicrohttpd-dev - if [ ${{ matrix.os }} = 'ubuntu:16.04' ]; then apt-get install -y libmariadb-client-lgpl-dev; fi - if [ ${{ matrix.os }} != 'ubuntu:16.04' ]; then apt-get install -y libmariadb-dev; fi - wget https://github.com/digitalocean/prometheus-client-c/releases/download/v0.1.3/libprom-dev-0.1.3-Linux.deb && \ - wget https://github.com/digitalocean/prometheus-client-c/releases/download/v0.1.3/libpromhttp-dev-0.1.3-Linux.deb && \ - apt install ./libprom-dev-0.1.3-Linux.deb ./libpromhttp-dev-0.1.3-Linux.deb && \ - rm ./libprom-dev-0.1.3-Linux.deb ./libpromhttp-dev-0.1.3-Linux.deb - - uses: actions/checkout@v3 + DEBIAN_FRONTEND: noninteractive + uses: ./.github/workflows/actions/ubuntu-build-deps - name: configure run: ./configure - name: make