-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
use vagrant on mac to run in a freebsd vm
- Loading branch information
Showing
3 changed files
with
86 additions
and
1 deletion.
There are no files selected for viewing
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
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 | ||
" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -60,5 +60,8 @@ docs/_build/ | |
# PyBuilder | ||
target/ | ||
|
||
#Ipython Notebook | ||
# Notebooks | ||
.ipynb_checkpoints | ||
|
||
# vagrant | ||
.vagrant |
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
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 |