Add macOS and FreeBSD CI jobs #3
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: C Build and Test | |
on: | |
push: | |
branches: | |
- '**' | |
pull_request: | |
branches: | |
- '**' | |
jobs: | |
build-and-test-ubuntu: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@main | |
- name: Install dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y build-essential make perl default-jre | |
- name: Verify installations | |
run: | | |
make --version | |
perl --version | |
java -version | |
- name: Compile the project | |
run: make | |
- name: Run tests | |
run: make test | |
build-and-test-macos: | |
runs-on: macos-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@main | |
- name: Install dependencies | |
run: | | |
brew install make | |
brew install perl | |
brew install openjdk | |
- name: Verify installations | |
run: | | |
make --version | |
perl --version | |
java -version | |
- name: Compile the project | |
run: make | |
- name: Run tests | |
run: make test | |
build-and-test-freebsd: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Install QEMU and FreeBSD | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y qemu-system qemu-utils | |
curl -O https://download.freebsd.org/ftp/releases/VM-IMAGES/13.0-RELEASE/amd64/Latest/FreeBSD-13.0-RELEASE-amd64.qcow2 | |
qemu-img create -f qcow2 -b FreeBSD-13.0-RELEASE-amd64.qcow2 freebsd.qcow2 10G | |
- name: Start FreeBSD VM and build/test | |
run: | | |
sudo qemu-system-x86_64 \ | |
-m 2G \ | |
-hda freebsd.qcow2 \ | |
-net user,hostfwd=tcp::2222-:22 \ | |
-net nic \ | |
-nographic & | |
sleep 60 | |
ssh-keyscan -p 2222 localhost >> ~/.ssh/known_hosts | |
scp -P 2222 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -r ./* freebsd@localhost:~ | |
ssh -p 2222 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null freebsd@localhost 'cd ~/ && sudo pkg install -y gmake perl openjdk && gmake && gmake test' | |
- name: Verify installations | |
run: ssh -p 2222 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null freebsd@localhost 'gmake --version && perl --version && java -version' |