By email to jack.hale@uni.lu, Subject: Computational Research Workflows Homework.
Please ask questions on the Etherpad.
Deadline: Monday 19th December 2022 1800
You must have attended the course and complete the homework to receive the ECTS credits.
The email should contain a link to a GitHub repository with:
-
a modified version of this file
README.mdfile containing the specific commands that you used to complete the exercises. You do not have to include everything, just the key commands. I have left placeholders where these commands should go:# Add your commands here -
A
wallet.pyfile that passes the unit tests. -
A
Dockerfile. -
A working GitHub Actions file
.github/workflows/test.ymlthat runs the unit tests inside the built image.
At the end of this homework, you will have a computational workflow consisting of:
-
A git repository hosted at https://github.com.
-
A
Dockerfiledescribing an environment containingpythonand the Python modulepytest. -
A Docker image built from the
Dockerfileand uploaded to the Dockerhub. -
A simple Python program describing a simple Wallet class and a set of unit tests.
-
A continuous integration setup using GitHub Actions.
For reference, you can use my notes that I used during the course here and the references listed at the bottom of the main course page.
-
Go to GitHub. Click on the plus icon in the top right hand corner of the screen. Then click on New Repository.
-
Create a public repository called e.g.
jhale/computational-workflows-homework. -
Clone your repository. In a terminal run, e.g.:
git clone git@github.com:jhale/computational-workflows-homework.git
substituting with the correct location of your repository.
-
Copy this
README.mdtext file to your new repository.git add,git commitandgit pushit to your repository.
- Create a file
Dockerfilein the repository containing the following text.
FROM ubuntu:21.04
RUN apt-get -y update && \
apt-get install -y python3-minimal python3-ipython python3-pytest python3-numpy && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
git addandgit pushthe fileDockerfileto the repository.
# Add your commands here
docker build,docker loginanddocker pushthe image described by theDockerfileto the Dockerhub. Tag your Docker image<yourdockerhubusername>/computational-workflows.
# Add your commands here
docker runthe image. Use the-vflag to share the root of the git repository to/root/sharedinside the container. Use the-tiflag to get an interactive prompt inside the running container.
# Add your commands here
- In a terminal running on the host (outside the container), copy across the
files
wallet.pyandtest_wallet.pyto the root of your homework repository.git add,git commitandgit pushthem.
# Add your commands here
- Start a Docker container using your image and share your repository into a
directory
/root/sharedinto the container.
# Add your commands here
-
Run the tests inside the container by going to
/root/sharedand running the commandpy.test-3. The tests should fail. -
In a terminal on the host modify
wallet.pyuntil the tests intest_wallet.pyall pass. -
git add,git commitandgit pushthe workingwallet.pyfile.
-
Using the example in the class notes make a
.github/workflows/test.ymlfile that checks out your repository and runs the unit tests inside the Docker image that you pushed to the DockerHub. -
Push the
.github/workflows/test.ymlfile to GitHub. Check that you get the green tick showing that your tests pass.