Skip to content

Commit

Permalink
Try running tests on freebsd
Browse files Browse the repository at this point in the history
use vagrant on mac to run in a freebsd vm
  • Loading branch information
minrk committed Feb 17, 2022
1 parent e9c4afd commit bc08675
Show file tree
Hide file tree
Showing 3 changed files with 86 additions and 1 deletion.
60 changes: 60 additions & 0 deletions .github/workflows/test-vm.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: test-vm
# run tests in a VM via vagrant
# GHA doesn't support freebsd, but we can test there

on:
pull_request:
push:
branches:
- "main"

jobs:
test:
# ref: https://github.com/jonashackt/vagrant-github-actions
# MIT License
runs-on: macos-10.15

strategy:
fail-fast: true
matrix:
box:
- freebsd
steps:
- uses: actions/checkout@v2

- name: Cache Vagrant boxes
uses: actions/cache@v2
with:
path: ~/.vagrant.d/boxes
key: ${{ runner.os }}-vagrant-${{ hashFiles('Vagrantfile') }}
restore-keys: |
${{ runner.os }}-vagrant-
- name: Show Vagrant version
run: vagrant --version

- name: Run vagrant up
run: vagrant up ${{ matrix.box }}

- name: install dependencies
run: |
vagrant ssh ${{ matrix.box }} -c "
cd /vagrant
pip install --upgrade pip
pip install --upgrade --pre -r dev-requirements.txt .
pip freeze
"
- name: Run tests
run: |
vagrant ssh ${{ matrix.box }} -c "
cd /vagrant
pytest -v --color=yes --cov=wurlitzer test.py
"
- name: Submit codecov report
run: |
vagrant ssh ${{ matrix.box }} -c "
cd /vagrant
codecov
"
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -60,5 +60,8 @@ docs/_build/
# PyBuilder
target/

#Ipython Notebook
# Notebooks
.ipynb_checkpoints

# vagrant
.vagrant
22 changes: 22 additions & 0 deletions Vagrantfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
Vagrant.configure("2") do |config|
config.vm.synced_folder ".", "/vagrant", type: "rsync"
config.ssh.forward_env = [
# for codecov, from
# https://github.com/codecov/uploader/blob/b561fe71e0262aa606b7391014ff01228adfac3d/src/ci_providers/provider_githubactions.ts#L113-L124
'GITHUB_ACTION',
'GITHUB_HEAD_REF',
'GITHUB_REF',
'GITHUB_REPOSITORY',
'GITHUB_RUN_ID',
'GITHUB_SERVER_URL',
'GITHUB_SHA',
'GITHUB_WORKFLOW',
]

config.vm.define "freebsd" do |bsd|
vm = bsd.vm
vm.box = "generic/freebsd12"
vm.provision "shell", inline: "pkg install -y git py38-pip py38-sqlite3", privileged: true
vm.provision "shell", inline: "echo 'export PATH=$HOME/.local/bin:$PATH' >> $HOME/.bash_profile", privileged: false
end
end

0 comments on commit bc08675

Please sign in to comment.