From b901e185bf17b8074ee6685c8e37cca1b820b55c Mon Sep 17 00:00:00 2001 From: Ben Frederickson Date: Sun, 28 Nov 2021 15:44:24 -0800 Subject: [PATCH] Re-enable freebsd CI --- .github/workflows/build.yml | 47 +++++++++++++++++++++++++++++++++++++ ci/Vagrantfile | 39 +++++++----------------------- ci/test_freebsd.sh | 23 ++++++++++++++++-- 3 files changed, 76 insertions(+), 33 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4e64ac3e..9b6b0df6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -104,6 +104,53 @@ jobs: name: wheels path: dist + build-freebsd: + runs-on: macos-10.15 + timeout-minutes: 30 + strategy: + matrix: + box: + - fbsd_12_2 + steps: + - uses: actions/checkout@v2 + - name: Cache Vagrant box + uses: actions/cache@v2 + with: + path: ~/.vagrant.d + key: ${{ matrix.box }}-vagrant-boxes-${{ hashFiles('ci/Vagrantfile') }} + restore-keys: | + ${{ matrix.box }}-vagrant- + - name: Cache Cargo and build artifacts + uses: actions/cache@v2.1.4 + with: + path: build-artifacts.tar + key: ${{ matrix.box }}-cargo-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + ${{ matrix.box }}-cargo- + - name: Set up VM + run: | + ln -sf ci/Vagrantfile Vagrantfile + if [ ! -d ~/.vagrant.d/boxes/rbspy-VAGRANTSLASH-FreeBSD-12.2-STABLE ]; then + vagrant box add rbspy/FreeBSD-12.2-STABLE https://github.com/rbspy/freebsd-vagrant-box/releases/download/20211124/fbsd_12_2.box + fi + vagrant up ${{ matrix.box }} + - name: Build and test + run: vagrant ssh ${{ matrix.box }} -- bash /vagrant/ci/test_freebsd.sh + - name: Retrieve build artifacts for caching purposes + run: | + vagrant ssh-config --host "default" > config.txt + scp -F config.txt default:/vagrant/build-artifacts.tar . + ls -ahl build-artifacts.tar + - name: Prepare binary for upload + run: | + tar xf build-artifacts.tar target/release/py-spy + mv target/release/py-spy py-spy-x86_64-unknown-freebsd + - name: Upload Binaries + uses: actions/upload-artifact@v2 + with: + name: py-spy-x86_64-unknown-freebsd + path: py-spy-x86_64-unknown-freebsd + test-wheels: name: Test Wheels needs: [build, build-linux-cross] diff --git a/ci/Vagrantfile b/ci/Vagrantfile index 89ef74f9..aab2da91 100644 --- a/ci/Vagrantfile +++ b/ci/Vagrantfile @@ -1,40 +1,17 @@ -# This code is taken from the Vagrantfile from libjail-rs -# https://github.com/fubarnetes/libjail-rs/blob/727353bd6565c5e7a9be2664258d0197a1c8bb35/Vagrantfile -# licensed under BSD-3 Clause License: -# BSD 3-Clause License - -# Copyright (c) 2018, Fabian Freyer All rights reserved. - -# Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - -# * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - -# * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - -# * Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. - -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - Vagrant.configure("2") do |config| - config.vm.define "fbsd_13_0" do |fbsd_13_0| - fbsd_13_0.vm.box = "freebsd/FreeBSD-13.0-RELEASE" - end - config.vm.define "fbsd_12_2" do |fbsd_12_2| - fbsd_12_2.vm.box = "freebsd/FreeBSD-12.2-STABLE" + fbsd_12_2.vm.box = "rbspy/FreeBSD-12.2-STABLE" end config.vm.synced_folder ".", "/vagrant", type: "rsync", - rsync__exclude: ".git/", - rsync__auto: true + rsync__exclude: [".git", ".vagrant.d"] config.vm.provision "shell", inline: <<~SHELL - pkg bootstrap - pkg install -y curl python llvm - su vagrant <