Skip to content

Commit

Permalink
First pass at a GHA run matrix on Ubuntu for build-and-test
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolasff committed Nov 3, 2023
1 parent ea01d68 commit e419b20
Showing 1 changed file with 64 additions and 9 deletions.
73 changes: 64 additions & 9 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,80 @@
name: Build
name: Build and test (Ubuntu matrix)

# trigger the workflow on push or pull requests
on: [push, pull_request, workflow_dispatch]
# on: [push, pull_request, workflow_dispatch]
on: [workflow_dispatch]

jobs:
build-and-run-tests:
runs-on: ubuntu-20.04 # this is a GitHub Runner, hosting the execution
container: ubuntu:20.04 # but this is a Docker Hub container, in which everything runs
# build-and-run-tests:
# runs-on: ubuntu-20.04 # this is a GitHub Runner, hosting the execution
# container: ubuntu:20.04 # but this is a Docker Hub container, in which everything runs

# services:
# redis:
# image: redis:7.0.12-alpine # Docker Hub image used as a sidecar

# steps:
# - uses: actions/checkout@v3
# - name: Install dependencies
# run: |
# apt-get -y update
# DEBIAN_FRONTEND=noninteractive apt-get -y --allow-unauthenticated --allow-downgrades --allow-remove-essential --allow-change-held-packages \
# install make gcc libevent-dev libmsgpack-dev python3.8 python3-pip curl nodejs
# update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8 1
# - name: Build
# run: make
# - name: Run Webdis and test
# run: |
# ./webdis .github/workflows/webdis-ci.json
# sleep 2
# ./tests/basic.py
# ./tests/curl-tests.sh
# pip3 --no-cache-dir install -r tests/requirements.txt
# ./tests/ws-tests.py
# - name: Archive logs
# uses: actions/upload-artifact@v3
# with:
# name: webdis.log
# path: webdis.log


build-and-test-ubuntu-matrix:
runs-on: ubuntu-20.04
strategy:
matrix:
include:
- container: ubuntu:18.04
version: "18.04"
- container: ubuntu:20.04
version: "20.04"
- container: ubuntu:22.04
version: "22.04"
- container: ubuntu:23.04
version: "23.04"

services:
redis:
image: redis:7.0.12-alpine # Docker Hub image used as a sidecar

# Specifies to run each job in the container from the matrix
container:
image: ${{ matrix.container }}

steps:
- uses: actions/checkout@v3

- name: Fetch package lists
run: apt-get -y update

- name: Install dependencies
run: |
apt-get -y update
DEBIAN_FRONTEND=noninteractive apt-get -y --allow-unauthenticated --allow-downgrades --allow-remove-essential --allow-change-held-packages \
install make gcc libevent-dev libmsgpack-dev python3.8 python3-pip curl nodejs
update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8 1
install make gcc libevent-dev libmsgpack-dev curl nodejs python3 python3-pip
- name: Fix pip3 on Ubuntu 23.04
if: matrix.container == 'ubuntu:23.04'
run: rm -f /usr/lib/python$(python3 --version | cut -d ' ' -f 2 | cut -d '.' -f 1,2)/EXTERNALLY-MANAGED

- name: Build
run: make
- name: Run Webdis and test
Expand All @@ -33,5 +88,5 @@ jobs:
- name: Archive logs
uses: actions/upload-artifact@v3
with:
name: webdis.log
name: webdis-${{ matrix.version }}.log
path: webdis.log

0 comments on commit e419b20

Please sign in to comment.