Skip to content

Commit

Permalink
Add GitHub action for vagrant up + a few fixes (#19)
Browse files Browse the repository at this point in the history
  • Loading branch information
MakisH authored Apr 28, 2021
1 parent 7b8ef99 commit 4c440df
Show file tree
Hide file tree
Showing 9 changed files with 52 additions and 13 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Build and package
on:
pull_request:
types: [ready_for_review]
jobs:
vagrant-up:
runs-on: macos-10.15

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

- name: Package Vagrant box
run: vagrant package --base "preCICE-VM" --output preCICE.box

- name: Generate Vagrant box SHA256 hash
run: shasum -a 256 preCICE.box

- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
name: precice-vagrant-box
path: preCICE.box
retention-days: 7

2 changes: 1 addition & 1 deletion Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ Vagrant.configure("2") do |config|
config.vm.provision "file", source: "provisioning/get-started.desktop", destination: "~/Desktop/get-started.desktop"

# Pre-packaging steps
# config.vm.provision "shell", path: "provisioning/cleanup.sh", privileged: false
config.vm.provision "shell", path: "provisioning/cleanup.sh", privileged: false
# Add the default Vagrant insecure public key to the authorized keys
config.vm.provision "file", source: "provisioning/vagrant.pub", destination: "~/.ssh/vagrant.pub"
config.vm.provision "shell", inline: <<-SHELL
Expand Down
2 changes: 1 addition & 1 deletion provisioning/cleanup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ set -ex
sudo apt-get clean

# Cleanup all object files from compilation
find /home/vagrant/ -type f -name '*.o' -exec rm -fv {} \;
find "${HOME}" -type f -name '*.o' -exec rm -fv {} \;
3 changes: 2 additions & 1 deletion provisioning/install-calculix.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ sudo apt-get install -y libarpack2-dev libspooles-dev libyaml-cpp-dev
# Install CalculiX
wget --quiet http://www.dhondt.de/ccx_2.16.src.tar.bz2
tar xvjf ccx_2.16.src.tar.bz2
rm -fv ccx_2.16.src.tar.bz2

# Get the CalculiX-preCICE adapter
if [ ! -d "calculix-adapter/" ]; then
Expand All @@ -19,4 +20,4 @@ fi
)

# Add the CalculiX adapter to PATH
echo "export PATH=\"~/calculix-adapter/bin:\${PATH}\"" >>~/.bashrc
echo "export PATH=\"\${HOME}/calculix-adapter/bin:\${PATH}\"" >>~/.bashrc
2 changes: 1 addition & 1 deletion provisioning/install-config-visualizer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ fi
pip3 install --user -e config-visualizer

# Add the config-visualizer to PATH
echo "export PATH=\"~/config-visualizer/bin:\${PATH}\"" >>~/.bashrc
echo "export PATH=\"\${HOME}/config-visualizer/bin:\${PATH}\"" >>~/.bashrc

# By default, there is no `python` executable, there is only `python3`,
# which causes issues to the config-visualizer
Expand Down
2 changes: 1 addition & 1 deletion provisioning/install-dealii.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ fi
)

# Add the deal.II adapter to PATH
echo "export PATH=\"~/dealii-adapter:\${PATH}\"" >>~/.bashrc
echo "export PATH=\"\${HOME}/dealii-adapter:\${PATH}\"" >>~/.bashrc
6 changes: 2 additions & 4 deletions provisioning/install-openfoam.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@ wget -q -O - https://dl.openfoam.com/add-debian-repo.sh | sudo bash

# Install OpenFOAM v2012:
sudo apt-get install -y openfoam2012-dev
# Enable OpenFOAM by default and apply now:
# Enable OpenFOAM by default:
echo ". /usr/lib/openfoam/openfoam2012/etc/bashrc" >> ~/.bashrc
# shellcheck source=/dev/null
# . /usr/lib/openfoam/openfoam2012/etc/bashrc

# Get the OpenFOAM-preCICE adapter
if [ ! -d "openfoam-adapter/" ]; then
Expand All @@ -18,5 +16,5 @@ fi
(
cd openfoam-adapter
git pull
./Allwmake
openfoam2012 ./Allwmake
)
2 changes: 1 addition & 1 deletion provisioning/install-paraview.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ if [ ! -d "paraview" ]; then
wget --no-check-certificate --quiet -O - "${PARAVIEW_URL}" | tar -xz -C paraview
ln -sf ~/paraview/ParaView-5.8.1-MPI-Linux-Python3.7-64bit/bin/paraview ~/Desktop/
# Add ParaView to PATH
echo "export PATH=\"~/paraview/ParaView-5.8.1-MPI-Linux-Python3.7-64bit/bin:\${PATH}\"" >>~/.bashrc
echo "export PATH=\"\${HOME}/paraview/ParaView-5.8.1-MPI-Linux-Python3.7-64bit/bin:\${PATH}\"" >>~/.bashrc
fi
8 changes: 5 additions & 3 deletions provisioning/install-su2.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,20 @@
set -ex

# Get SU2 6.0.0 from GitHub
wget --quiet https://github.com/su2code/SU2/archive/v6.0.0.tar.gz && tar -xzf v6.0.0.tar.gz
wget --quiet https://github.com/su2code/SU2/archive/v6.0.0.tar.gz
tar -xzf v6.0.0.tar.gz
rm -fv v6.0.0.tar.gz

# Add SU2 to PATH and apply.
# We first export to a separate script, so that we can load it here (non-interactive shell).
{
echo "export SU2_HOME=\"/home/vagrant/SU2-6.0.0\""
echo "export SU2_HOME=\"\${HOME}/SU2-6.0.0\""
echo "export SU2_RUN=\"\${SU2_HOME}/SU2_CFD/bin\""
echo "export PATH=\"\${SU2_RUN}:\${PATH}\""
echo "export PYTHONPATH=\"\${SU2_RUN}:\${PYTHONPATH}\""
} >> ~/.su2-bashrc

echo ". ~/.su2-bashrc" >> ~/.bashrc
echo ". \${HOME}/.su2-bashrc" >> ~/.bashrc
# shellcheck source=/dev/null
. ~/.su2-bashrc

Expand Down

0 comments on commit 4c440df

Please sign in to comment.