Skip to content

Run vagrant in linux #43

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,12 @@ jobs:
tests-linux:
strategy:
matrix:
os:
- 'ubuntu-20.04'
- 'macos-latest'
rust-target:
- 'x86_64-unknown-linux-musl'
cgroups:
- 'cgroup-v1'
- 'cgroup-v2'
runs-on: ${{ matrix.os }}
runs-on: 'ubuntu-20.04'
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1.0.6
Expand All @@ -59,7 +56,6 @@ jobs:
env:
CI_TARGET: ${{ matrix.rust-target }}
CI_CGROUPS: ${{ matrix.cgroups }}
CI_OS: ${{ matrix.os }}
- name: Collect logs
if: always()
run: |
Expand Down
33 changes: 16 additions & 17 deletions ci/linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,46 +2,45 @@ set -euo pipefail
echo "::group::Info"
echo "Target: $CI_TARGET"
echo "Cgroup version: $CI_CGROUPS"
echo "Operating system: $CI_OS"

echo "this is hack, ignore this file" >> ./stracez-dummy

if [[ $CI_OS == "ubuntu-20.04" ]]; then
if [[ $CI_CGROUPS == "cgroup-v2" ]]; then
echo "Skipping: cgroup v2 runs in macos"
exit 0
fi
fi
if [[ $CI_OS == "macos-latest" ]]; then
if [[ $CI_CGROUPS == "cgroup-v1" ]]; then
echo "Skipping: cgroup v1 does not need virtualization"
exit 0
fi
fi

echo "::group::Preparing"

if [[ $CI_CGROUPS == "cgroup-v2" ]] && [ -z "${CI_VM+set}" ]; then
echo "::group::Preparing virtual machine"
sudo apt-get update
sudo apt-get install qemu-system
#sudo apt-get install -y libopus0 libqt5core5a libqt5gui5 libqt5opengl5 libqt5printsupport5 \
# libqt5widgets5 libqt5x11extras5 libsdl1.2debian python
wget https://releases.hashicorp.com/vagrant/2.2.14/vagrant_2.2.14_x86_64.deb -q -O vagrant.deb
#wget https://download.virtualbox.org/virtualbox/5.2.44/virtualbox-5.2_5.2.44-139111~Ubuntu~bionic_amd64.deb -q -O vb.deb
#wget http://security.ubuntu.com/ubuntu/pool/main/libv/libvpx/libvpx5_1.7.0-3ubuntu0.18.04.1_amd64.deb -q -O libvpx.deb
#sudo dpkg -i libvpx.deb
#sudo dpkg -i vb.deb
sudo dpkg -i vagrant.deb
vagrant --version
cat > Vagrantfile <<EOF
Vagrant.configure("2") do |config|
config.vm.box = "fedora/32-cloud-base"

config.vm.provider "virtualbox" do |vb|
config.vm.provider "qemu" do |vb|
vb.memory = "900"
end
#config.vm.provider "virtualbox" do |vb|
# vb.memory = "900"
# vb.customize ["modifyvm", :id, "--hwvirtex", "off"]
#end
end
EOF
top -l 1
cat Vagrantfile
sudo vagrant up
echo "::group::Installing packages"
sudo vagrant ssh --command "sudo dnf install -y gcc gcc-c++ strace zip"
echo "::group::Installing rust"
sudo vagrant ssh --command "curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default-toolchain stable"
echo "::group::Entering VM"
sudo vagrant ssh --command "bash -c 'cd /vagrant && CI_OS=$CI_OS CI_CGROUPS=$CI_CGROUPS CI_TARGET=$CI_TARGET CI_VM=1 bash ci/linux.sh'"
sudo vagrant ssh --command "bash -c 'cd /vagrant && CI_CGROUPS=$CI_CGROUPS CI_TARGET=$CI_TARGET CI_VM=1 bash ci/linux.sh'"
echo "Host: pulling logs from VM"
sudo vagrant ssh --command "cat /vagrant/logs.zip | base64" | base64 --decode > logs.zip
rm stracez-dummy
Expand Down