Skip to content

Commit

Permalink
Merge pull request #13 from nicolas-van/github-actions
Browse files Browse the repository at this point in the history
Replaced Drone CI configuration by Github Actions. Added multiple dif…
  • Loading branch information
nicolas-van authored Dec 2, 2021
2 parents 677b29d + 1714038 commit 1bd3062
Show file tree
Hide file tree
Showing 4 changed files with 149 additions and 76 deletions.
54 changes: 0 additions & 54 deletions .drone.yml

This file was deleted.

123 changes: 123 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
name: Build

on:
push:

jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Install and configure dependencies
run: |
sudo apt-get install -qq bats
- uses: actions/checkout@v2
- name: Build
run: |
cmake .
cmake --build .
- name: Test
run: bats tests.bats

build:
strategy:
fail-fast: false
matrix:
include:
- TARGET: x86_64-linux-gnu # the native build, tested in a container on a mac
OS: ubuntu-latest
CC: cc
- TARGET: x86_64-linux-musl # tested in an alpine container on a mac
OS: ubuntu-latest
CC: x86_64-linux-musl-gcc
- TARGET: aarch64-linux-gnu # tested on aws t4g.nano
OS: ubuntu-latest
CC: aarch64-linux-gnu-gcc
- TARGET: aarch64-linux-musl # tested in an alpine container on aws t4g.nano
OS: ubuntu-latest
CC: aarch64-linux-musl-gcc
- TARGET: arm-linux-gnueabihf # tested on a Raspberry Pi 400
OS: ubuntu-latest
CC: arm-linux-gnueabihf-gcc
- TARGET: arm-linux-musl # tested in an alphine container on a Raspberry Pi 400
OS: ubuntu-latest
CC: arm-linux-musleabihf-gcc
- TARGET: x86_64-apple-darwin # tested on a mac, is not properly signed so there are security warnings
OS: macos-latest
CC: cc
needs: test
runs-on: ${{ matrix.OS }}
env:
NAME: multirun
TARGET: ${{ matrix.TARGET }}
OS: ${{ matrix.OS }}
CC: ${{ matrix.CC }}
steps:
- name: Musl compilers cache
uses: actions/cache@v2
with:
path: |
~/musl-compilers
key: build-musl-compilers-dir
- name: Install and configure dependencies
run: |
# dependencies are only needed on ubuntu as that's the only place where
# we make cross-compilation
if [[ $OS =~ ^ubuntu.*$ ]]; then
sudo apt-get install -qq crossbuild-essential-arm64 crossbuild-essential-armhf
fi
# download musl compilers
mkdir -p $HOME/musl-compilers
pushd $HOME/musl-compilers
if [[ ! -d x86_64-linux-musl-cross ]]; then
wget -q -c http://musl.cc/x86_64-linux-musl-cross.tgz -O - | tar -xz
fi
if [[ ! -d aarch64-linux-musl-cross ]]; then
wget -q -c http://musl.cc/aarch64-linux-musl-cross.tgz -O - | tar -xz
fi
if [[ ! -d arm-linux-musleabihf-cross ]]; then
wget -q -c http://musl.cc/arm-linux-musleabihf-cross.tgz -O - | tar -xz
fi
popd
- uses: actions/checkout@v2
- name: List
run: find .
- name: Build
run: |
export PATH=$PATH:$HOME/musl-compilers/x86_64-linux-musl-cross/bin
export PATH=$PATH:$HOME/musl-compilers/aarch64-linux-musl-cross/bin
export PATH=$PATH:$HOME/musl-compilers/arm-linux-musleabihf-cross/bin
cmake .
cmake --build .
- name: Compress
run: |
mkdir -p ./artifacts
if [[ $GITHUB_REF_TYPE =~ ^tag$ ]]; then
TAG=$GITHUB_REF_NAME
else
TAG=$GITHUB_SHA
fi
tar -czf ./artifacts/$NAME-$TARGET-${{github.ref_name}}.tar.gz $NAME
- name: Archive artifact
uses: actions/upload-artifact@v2
with:
name: result
path: |
./artifacts
# deploys to github releases on tag
deploy:
if: startsWith(github.ref, 'refs/tags/')
needs: build
runs-on: ubuntu-latest
steps:
- name: Download artifacts
uses: actions/download-artifact@v2
with:
name: result
path: ./artifacts
- name: List
run: find ./artifacts
- name: Release
uses: softprops/action-gh-release@v1
with:
files: ./artifacts/*.tar.gz
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.10)
set(CMAKE_C_STANDARD 99)

# set the project name
project(multirun VERSION 1.0.0 LANGUAGES C)
project(multirun VERSION 1.0.1 LANGUAGES C)

configure_file(config.h.in config.h)

Expand Down
46 changes: 25 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

# multirun

[![Build Status](https://cloud.drone.io/api/badges/nicolas-van/multirun/status.svg)](https://cloud.drone.io/nicolas-van/multirun)
[![Build](https://github.com/nicolas-van/multirun/actions/workflows/build.yml/badge.svg)](https://github.com/nicolas-van/multirun/actions/workflows/build.yml)

A simple Unix utility in C to run multiple commands concurrently.

Expand All @@ -20,44 +20,48 @@ Unlink most process managers multirun never attempts to restart one of its child

## Installation

### Alpine
### Package manager

#### Package manager
Currently, multirun is only present in Alpine's distribution

```bash
apk add multirun
```
#### Alpine

#### Binary install

```bash
wget https://github.com/nicolas-van/multirun/releases/download/1.0.0/multirun-musl-1.0.0.tar.gz && \
tar -zxvf multirun-musl-1.0.0.tar.gz && \
mv multirun /bin && \
rm multirun-musl-1.0.0.tar.gz
apk add multirun
```

### Ubuntu, Debian, Red Hat, Centos...
### Binary install

#### Binary install
The [release page](https://github.com/nicolas-van/multirun/releases) lists all provided binaries.

Here is an example install script for an x86_64 Linux using GNU libc. Replace the URL with another one if you use another system.

```bash
wget https://github.com/nicolas-van/multirun/releases/download/1.0.0/multirun-glibc-1.0.0.tar.gz && \
tar -zxvf multirun-glibc-1.0.0.tar.gz && \
mv multirun /bin && \
rm multirun-glibc-1.0.0.tar.gz
wget -c https://github.com/nicolas-van/multirun/releases/download/1.0.1/multirun-x86_64-linux-gnu-1.0.1.tar.gz -O - | tar -xz && \
mv multirun /bin
```

We provide binaries for the following systems:

* x86_64 Linux, both using glibc (for most systems) and musl libc (for Alpine containers)
* aarch64 Linux (for cheaper servers like AWS EC2 t4g line), both using glibc and musl libc
* arm Linux (for Raspberry Pi), both using glibc and musl libc
* x86_64 Mac OS X

### From sources

This project necessitates CMake.

```bash
git clone --branch 1.0.0 https://github.com/nicolas-van/multirun.git && \
cd multirun && \
wget -c https://github.com/nicolas-van/multirun/archive/refs/tags/1.0.1.tar.gz -O - | tar -xz && \
mv multirun-1.0.1 multirun-src && \
cd multirun-src && \
cmake . && \
cmake --build . && \
cp multirun /bin && \
cd .. && \
rm -rf multirun
rm -rf multirun-src
```

## FAQ
Expand All @@ -78,7 +82,7 @@ Here are some good use cases where multirun can be useful:

Here is an example of bad use case:

* You want to pack a web server, a scheduler, a message queue, some workers and a database in a single container to make it "easy" to deploy: No no no, you're doing it wrong. Go learn about docker-compose, modify a little bit your application to properly use environment variables for things like database address and credentials, create a proper documentation, split everything into separate containers in an example `docker-compose.yml` file and send it to persons that need to deploy your application. It may seem more complicated but it's not. On the long run you will be much more effective in your Docker usage.
* You want to pack a web server, a scheduler, a message queue, some workers and a database in a single container to make it "easy" to deploy: No no no, you're doing it wrong. Go learn about docker-compose, modify a little bit your application to properly use environment variables for things like database address and credentials, create a proper documentation, split everything into separate containers in an example `docker-compose.yml` file and send it to the persons that need to deploy your application. It may seem more complicated but it's not. On the long run you will be much more effective in your Docker usage.

## Contributing

Expand Down

0 comments on commit 1bd3062

Please sign in to comment.