From e87306c970b64461ee7798c104c7e41658bd3a1d Mon Sep 17 00:00:00 2001 From: Gerasimos Chourdakis Date: Wed, 28 Apr 2021 09:54:20 +0200 Subject: [PATCH 01/15] Add GitHub action for vagrant up, bsaed on ubuntu-latest This should probably fail --- .github/workflows/build.yml | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..67a3e58 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,27 @@ +name: Build (provision) +on: + pull_request: + types: [ready_for_review] +jobs: + vagrant-up: + runs-on: ubuntu-latest + + 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: ssh into box after boot + run: vagrant ssh -c "echo 'hello world!'" + From 4384480eb9c7a4786c0d887d995d31e79be6d981 Mon Sep 17 00:00:00 2001 From: Gerasimos Chourdakis Date: Wed, 28 Apr 2021 09:58:36 +0200 Subject: [PATCH 02/15] Migrate to macos-10.15 --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 67a3e58..d94fb94 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -4,7 +4,7 @@ on: types: [ready_for_review] jobs: vagrant-up: - runs-on: ubuntu-latest + runs-on: macos-10.15 steps: - uses: actions/checkout@v2 From e19832fe6b1e86997fb51e27d6e174181feaa8de Mon Sep 17 00:00:00 2001 From: Gerasimos Chourdakis Date: Wed, 28 Apr 2021 10:26:02 +0200 Subject: [PATCH 03/15] Source OpenFOAM bashrc in install-openfoam.sh --- provisioning/install-openfoam.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/provisioning/install-openfoam.sh b/provisioning/install-openfoam.sh index f34d403..0a0e664 100644 --- a/provisioning/install-openfoam.sh +++ b/provisioning/install-openfoam.sh @@ -9,7 +9,7 @@ sudo apt-get install -y openfoam2012-dev # Enable OpenFOAM by default and apply now: echo ". /usr/lib/openfoam/openfoam2012/etc/bashrc" >> ~/.bashrc # shellcheck source=/dev/null -# . /usr/lib/openfoam/openfoam2012/etc/bashrc +. /usr/lib/openfoam/openfoam2012/etc/bashrc # Get the OpenFOAM-preCICE adapter if [ ! -d "openfoam-adapter/" ]; then From 284d9cfeda76e1a816b7c48db1c13aa6e7c59fb5 Mon Sep 17 00:00:00 2001 From: Gerasimos Chourdakis Date: Wed, 28 Apr 2021 10:29:48 +0200 Subject: [PATCH 04/15] Add actions to package and upload artifacts --- .github/workflows/build.yml | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d94fb94..b9c73ad 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -22,6 +22,13 @@ jobs: - name: Run vagrant up run: vagrant up - - name: ssh into box after boot - run: vagrant ssh -c "echo 'hello world!'" + - name: Package Vagrant box + run: vagrant package --base "preCICE-VM" --output preCICE.box + + - name: Upload artifacts + uses: actions/upload-artifact@v2 + with: + name: precice-vagrant-box + path: | + preCICE.box From 5c8bbb6a0f031c8a297fb3113fe01b93ebd9ec01 Mon Sep 17 00:00:00 2001 From: Gerasimos Chourdakis Date: Wed, 28 Apr 2021 10:33:15 +0200 Subject: [PATCH 05/15] Configure artifact retention time to 1 week --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b9c73ad..18adf6e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -29,6 +29,6 @@ jobs: uses: actions/upload-artifact@v2 with: name: precice-vagrant-box - path: | - preCICE.box + path: preCICE.box + retention-days: 7 From 9412b9f56983acd1dc4cc72fcb21724642f72ea7 Mon Sep 17 00:00:00 2001 From: Gerasimos Chourdakis Date: Wed, 28 Apr 2021 10:38:28 +0200 Subject: [PATCH 06/15] Add step to generate sha256sum --- .github/workflows/build.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 18adf6e..7343adc 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -25,6 +25,9 @@ jobs: - name: Package Vagrant box run: vagrant package --base "preCICE-VM" --output preCICE.box + - name: Generate Vagrant box hash + run: sha256sum preCICE.box + - name: Upload artifacts uses: actions/upload-artifact@v2 with: From 115bf7e4412184ec0a90f4f58a85594aac8de752 Mon Sep 17 00:00:00 2001 From: Gerasimos Chourdakis Date: Wed, 28 Apr 2021 11:10:51 +0200 Subject: [PATCH 07/15] OpenFOAM: instead of loading the environment (which crashes), use an openfoam2012 session --- provisioning/install-openfoam.sh | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/provisioning/install-openfoam.sh b/provisioning/install-openfoam.sh index 0a0e664..64c6a5f 100644 --- a/provisioning/install-openfoam.sh +++ b/provisioning/install-openfoam.sh @@ -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 @@ -18,5 +16,5 @@ fi ( cd openfoam-adapter git pull - ./Allwmake + openfoam2012 ./Allwmake ) From c50cb5aca3c7d1fa73dcbbcd71c4cad11fecf8fa Mon Sep 17 00:00:00 2001 From: Gerasimos Chourdakis Date: Wed, 28 Apr 2021 11:32:37 +0200 Subject: [PATCH 08/15] Rename workflow --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7343adc..b9ed492 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,4 +1,4 @@ -name: Build (provision) +name: Build and package on: pull_request: types: [ready_for_review] From 8ae3f23ffe2006e2be7050c23004fe87e6e3ce33 Mon Sep 17 00:00:00 2001 From: Gerasimos Chourdakis Date: Wed, 28 Apr 2021 12:17:03 +0200 Subject: [PATCH 09/15] Enable cleanup by default --- Vagrantfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Vagrantfile b/Vagrantfile index 9dadf78..8d949da 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -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 From 9ffd870fc9a3311aa8b91c5741cce141e6164062 Mon Sep 17 00:00:00 2001 From: Gerasimos Chourdakis Date: Wed, 28 Apr 2021 12:22:27 +0200 Subject: [PATCH 10/15] Switch from sha256sum to md5sum --- .github/workflows/build.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b9ed492..c3ef2ca 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -16,6 +16,10 @@ jobs: key: ${{ runner.os }}-vagrant-${{ hashFiles('Vagrantfile') }} restore-keys: | ${{ runner.os }}-vagrant- + + - name: Generate Vagrantfile MD5 hash + run: md5sum Vagrantfile + - name: Show Vagrant version run: vagrant --version @@ -25,8 +29,8 @@ jobs: - name: Package Vagrant box run: vagrant package --base "preCICE-VM" --output preCICE.box - - name: Generate Vagrant box hash - run: sha256sum preCICE.box + - name: Generate Vagrant box MD5 hash + run: md5sum preCICE.box - name: Upload artifacts uses: actions/upload-artifact@v2 From de4e3af21ee836d7d75c73e24e4119b0bb0d2a44 Mon Sep 17 00:00:00 2001 From: Gerasimos Chourdakis Date: Wed, 28 Apr 2021 12:29:09 +0200 Subject: [PATCH 11/15] sha256sum for macOS --- .github/workflows/build.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c3ef2ca..8131f47 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -17,8 +17,8 @@ jobs: restore-keys: | ${{ runner.os }}-vagrant- - - name: Generate Vagrantfile MD5 hash - run: md5sum Vagrantfile + - name: Generate Vagrantfile SHA256 hash + run: shasum -a 256 Vagrantfile - name: Show Vagrant version run: vagrant --version @@ -29,8 +29,8 @@ jobs: - name: Package Vagrant box run: vagrant package --base "preCICE-VM" --output preCICE.box - - name: Generate Vagrant box MD5 hash - run: md5sum preCICE.box + - name: Generate Vagrant box SHA256 hash + run: shasum -a 256 preCICE.box - name: Upload artifacts uses: actions/upload-artifact@v2 From 7ec683a37b3cef53298cb6b9d93f0657a3e737ec Mon Sep 17 00:00:00 2001 From: Gerasimos Chourdakis Date: Wed, 28 Apr 2021 12:30:56 +0200 Subject: [PATCH 12/15] Remove debugging shasum step --- .github/workflows/build.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8131f47..2039489 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -17,9 +17,6 @@ jobs: restore-keys: | ${{ runner.os }}-vagrant- - - name: Generate Vagrantfile SHA256 hash - run: shasum -a 256 Vagrantfile - - name: Show Vagrant version run: vagrant --version From e3b7b7bfa15144129973d9a9997f50b82d30bfdf Mon Sep 17 00:00:00 2001 From: Gerasimos Chourdakis Date: Wed, 28 Apr 2021 14:22:53 +0200 Subject: [PATCH 13/15] Remove downloaded solver archives after extracting --- provisioning/install-calculix.sh | 1 + provisioning/install-su2.sh | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/provisioning/install-calculix.sh b/provisioning/install-calculix.sh index a90073c..3729e87 100644 --- a/provisioning/install-calculix.sh +++ b/provisioning/install-calculix.sh @@ -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 diff --git a/provisioning/install-su2.sh b/provisioning/install-su2.sh index 358e566..0e763a2 100644 --- a/provisioning/install-su2.sh +++ b/provisioning/install-su2.sh @@ -2,7 +2,9 @@ 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). From 942b403cbb96f9ed31d0d77eb6eff6ba36920deb Mon Sep 17 00:00:00 2001 From: Gerasimos Chourdakis Date: Wed, 28 Apr 2021 14:39:06 +0200 Subject: [PATCH 14/15] Replace ~ by HOME env variable for portability --- provisioning/cleanup.sh | 2 +- provisioning/install-calculix.sh | 2 +- provisioning/install-config-visualizer.sh | 2 +- provisioning/install-dealii.sh | 2 +- provisioning/install-paraview.sh | 2 +- provisioning/install-su2.sh | 4 ++-- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/provisioning/cleanup.sh b/provisioning/cleanup.sh index bbc69eb..c4643bb 100644 --- a/provisioning/cleanup.sh +++ b/provisioning/cleanup.sh @@ -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 {} \; diff --git a/provisioning/install-calculix.sh b/provisioning/install-calculix.sh index 3729e87..e75730b 100644 --- a/provisioning/install-calculix.sh +++ b/provisioning/install-calculix.sh @@ -20,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 diff --git a/provisioning/install-config-visualizer.sh b/provisioning/install-config-visualizer.sh index 3d63407..06359ac 100644 --- a/provisioning/install-config-visualizer.sh +++ b/provisioning/install-config-visualizer.sh @@ -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 diff --git a/provisioning/install-dealii.sh b/provisioning/install-dealii.sh index 07e4355..ea3ce00 100644 --- a/provisioning/install-dealii.sh +++ b/provisioning/install-dealii.sh @@ -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 diff --git a/provisioning/install-paraview.sh b/provisioning/install-paraview.sh index af7ab04..2d07842 100644 --- a/provisioning/install-paraview.sh +++ b/provisioning/install-paraview.sh @@ -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 diff --git a/provisioning/install-su2.sh b/provisioning/install-su2.sh index 0e763a2..006eca7 100644 --- a/provisioning/install-su2.sh +++ b/provisioning/install-su2.sh @@ -9,13 +9,13 @@ 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 From 1109e82ce2628a3f4a5078b903caba0aad4e7617 Mon Sep 17 00:00:00 2001 From: Gerasimos Chourdakis Date: Wed, 28 Apr 2021 14:43:06 +0200 Subject: [PATCH 15/15] Fix shellcheck --- provisioning/cleanup.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/provisioning/cleanup.sh b/provisioning/cleanup.sh index c4643bb..91dccf0 100644 --- a/provisioning/cleanup.sh +++ b/provisioning/cleanup.sh @@ -5,4 +5,4 @@ set -ex sudo apt-get clean # Cleanup all object files from compilation -find ${HOME} -type f -name '*.o' -exec rm -fv {} \; +find "${HOME}" -type f -name '*.o' -exec rm -fv {} \;