Skip to content
Snippets Groups Projects
Commit f7633a49 authored by Theisen, Lambert's avatar Theisen, Lambert :fire:
Browse files

Finalise

parent 02e2c23e
No related branches found
No related tags found
No related merge requests found
Pipeline #1986 passed
...@@ -8,11 +8,11 @@ ...@@ -8,11 +8,11 @@
1. **Clone the Repository:** 1. **Clone the Repository:**
``` ```
git clone https://github.com/username/project-name.git git clone git@gitlab.mathematik.uni-stuttgart.de:theiselt/SustainableSoftwareEngineering.jl.git
``` ```
2. **Navigate to the Project Directory:** 2. **Navigate to the Project Directory:**
``` ```
cd project-name cd SustainableSoftwareEngineering.jl
``` ```
## Running the Project ## Running the Project
......
...@@ -24,6 +24,52 @@ Git is a distributed version control system designed to handle everything from s ...@@ -24,6 +24,52 @@ Git is a distributed version control system designed to handle everything from s
Source: https://merely-useful.tech/py-rse/figures/git-cmdline/git-remote.png Source: https://merely-useful.tech/py-rse/figures/git-cmdline/git-remote.png
Here's a concise guide to a basic Git workflow, covering cloning a repository, creating a file, adding it to the repository, committing, and pushing the changes:
## Basic Git Workflow
0. Create Repo on the Gitlab instance in the Webbrowser
1. **Clone the Repository**
Clone the remote repository to your local machine:
```
git clone https://gitlab.mathematik.uni-stuttgart.de/user1234/repository
```
2. **Create a New File**
Navigate to the cloned repository directory and create a new file:
```
cd repository
touch newfile.txt
```
3. **Add the File to Staging**
Add the new file to the staging area, preparing it for a commit:
```
git add newfile.txt
```
4. **Commit the File**
Commit the staged file with a descriptive message:
```
git commit -m "Add newfile.txt 😎"
```
5. **Push the Commit to Remote Repository**
Push the commit to the remote repository:
```
git push origin main
```
## Gitignore
- The `.gitignore`-file to ignore files in the Git (automatically generated files, build folders, ...)
```bash
# content of .gitignore (dot means hidden file)
docs/build/* # (star/asterix is placeholder/wildcard to ignore everything in that folder)
```
## Getting Started ## Getting Started
To start using Git, first [install it](https://git-scm.com/downloads) on your machine. Then, set up your user name and email with the following commands: To start using Git, first [install it](https://git-scm.com/downloads) on your machine. Then, set up your user name and email with the following commands:
......
...@@ -5,7 +5,6 @@ This lecture focuses on the structure and management of Julia-specific projects. ...@@ -5,7 +5,6 @@ This lecture focuses on the structure and management of Julia-specific projects.
## Creating a Project Using Package Manager ## Creating a Project Using Package Manager
- Steps to create a new Julia project
- Using the Julia REPL and the Package Manager (`Pkg`) - Using the Julia REPL and the Package Manager (`Pkg`)
- Example command: - Example command:
...@@ -20,20 +19,25 @@ pkg> generate MyProject ...@@ -20,20 +19,25 @@ pkg> generate MyProject
- The `src` folder: Where the source code lives - The `src` folder: Where the source code lives
- Structure and naming conventions for source files - Structure and naming conventions for source files
- Can contain multiple files (modules)
### `docs` Folder ### `docs` Folder
- Purpose of the `docs` folder: Documentation of the project - Where the Documentation of the project lives
- Tools for generating documentation in Julia, e.g., Documenter.jl - Tools for generating documentation in Julia, e.g., `Documenter.jl`
### `examples` Folder ### `examples` Folder
- The `examples` folder: Contains example scripts and notebooks - The `examples` folder: Contains example scripts and notebooks
- Demonstrating usage and features of the project - Demonstrating usage and features of the project
### `test` Folder
- The folder containing unit tests in the file `runtests.jl`, explained later
## README File ## README File
- Importance of a `README.md` file in a project - Every Git needs a `README.md` file, first starting point when someone opens the repo
- Key elements to include: project description, installation instructions, usage examples, contact info, ... - Key elements to include: project description, installation instructions, usage examples, contact info, ...
## Project.toml and Manifest.toml ## Project.toml and Manifest.toml
...@@ -45,10 +49,9 @@ using Pkg ...@@ -45,10 +49,9 @@ using Pkg
Pkg.activate(".") # or press "]" to go into pkg mode and then type "actiavate" and hit enter Pkg.activate(".") # or press "]" to go into pkg mode and then type "actiavate" and hit enter
# Activating project at `~/Desktop/gits/nmh/SustainableSoftwareEngineering.jl` # Activating project at `~/Desktop/gits/nmh/SustainableSoftwareEngineering.jl`
``` ```
- `Manifest.toml`: Detailed state of the environment for reproducibility - `Manifest.toml`: Detailed state of the environment for reproducibility (not necessarily needed in Git)
- Understanding the role of these files in dependency management and version control
### TOML ### What, what is TOML?
TOML (Tom's Obvious, Minimal Language) is a simple, easy-to-read configuration file format. Designed by Tom Preston-Werner in 2013, it aims to be more human-readable and writable than formats like XML or JSON. TOML (Tom's Obvious, Minimal Language) is a simple, easy-to-read configuration file format. Designed by Tom Preston-Werner in 2013, it aims to be more human-readable and writable than formats like XML or JSON.
```toml ```toml
# This is a TOML document # This is a TOML document
......
...@@ -6,15 +6,14 @@ In this lecture, we'll explore how to effectively document Julia code. We'll cov ...@@ -6,15 +6,14 @@ In this lecture, we'll explore how to effectively document Julia code. We'll cov
### Basics of Doc Strings ### Basics of Doc Strings
- What are doc strings and why they are important - Docstrings: Documentation that lives side-by-side with the source code
- Basic syntax for writing doc strings in Julia
### Advanced Features in Doc Strings ### Advanced Features in Doc Strings
- Including mathematical expressions using LaTeX syntax - Including mathematical expressions using LaTeX syntax
- Adding code examples within doc strings - Adding code examples within doc strings
- Documenting function signatures for clarity - Documenting function signatures for clarity
- Best practices for writing informative and clear doc strings - It's best practice to write informative and clear doc strings
## Code Example: Writing a Doc String ## Code Example: Writing a Doc String
...@@ -56,6 +55,7 @@ Documenter.jl is a tool for producing documentation in Julia. We'll look at how ...@@ -56,6 +55,7 @@ Documenter.jl is a tool for producing documentation in Julia. We'll look at how
- Organizing your documentation structure - Organizing your documentation structure
- Writing an index.md file to serve as the entry point - Writing an index.md file to serve as the entry point
- See example docu (live)
## Including Additional Markdown Files ## Including Additional Markdown Files
...@@ -69,19 +69,14 @@ Documenter.jl is a tool for producing documentation in Julia. We'll look at how ...@@ -69,19 +69,14 @@ Documenter.jl is a tool for producing documentation in Julia. We'll look at how
## Inspecting the resulting index.html ## Inspecting the resulting index.html
- Generating the HTML documentation locally - Generating the HTML documentation locally, and open in local webbrowser
- Tips for inspecting and testing the `index.html` file
## Building a Documentation Website ## Optional: Building a Documentation Website
### Hosting Documentation Files ### Optional: Continuous Integration for Documentation Updates
- Options for hosting the build files to create a publicly accessible documentation website - Setting up CI workflows to automatically update documentation and host it
- Platforms like GitHub Pages and ReadTheDocs - Rather needed for big open source projects
### Continuous Integration for Documentation Updates
- Setting up CI workflows to automatically update documentation
--- ---
......
# Julia: Testing # Julia: Testing
This lecture aims to provide a comprehensive guide on testing practices in Julia. We will explore the importance of unit tests, delve into coverage aspects, and discuss the integration of automatic testing using continuous integration (CI) tools.
## Importance of Testing ## Importance of Testing
- Why testing is crucial in software development. - Why testing is crucial in software development: Have working version in Git, document intended behavior of functions
- Types of tests: Unit tests, integration tests, etc. - Types of tests: Unit tests, integration tests, etc.
## Unit Tests in Julia ## Unit Tests in Julia
- Overview of unit testing in Julia.
- Using the `Test` standard library. - Using the `Test` standard library.
### Writing Unit Tests ### Writing Unit Tests
- Basic structure of a unit test. - Basic structure of a unit test: Valid Julia code with macro annotations (`@`)
- Assertions: `@test`, `@test_throws`, `@testset`, etc. - Assertions: `@test`, `@test_throws`, `@testset`, etc.
### Example: Unit Test Tutorial ### Example: Unit Test Tutorial
...@@ -36,7 +35,7 @@ Create a file named `test_add.jl`: ...@@ -36,7 +35,7 @@ Create a file named `test_add.jl`:
```julia ```julia
using Test using Test
include("add.jl") # Include the file containing the `add` function include("add.jl") # Include the file containing the `add` function, or load package
@testset "Addition Tests" begin @testset "Addition Tests" begin
@test add(2, 2) == 4 @test add(2, 2) == 4
...@@ -65,10 +64,12 @@ Once you have written your tests, it's important to know how to run them to chec ...@@ -65,10 +64,12 @@ Once you have written your tests, it's important to know how to run them to chec
Alternatively, you can run your tests directly from the command line without entering the REPL: Alternatively, you can run your tests directly from the command line without entering the REPL:
- Navigate to your project directory. - Navigate to your project directory.
- Run `julia --project=@. -e 'using Pkg; Pkg.test()'`. - Run `julia --project=@. -e 'using Pkg; Pkg.test()'` (`@.` means to search for a folder with a `Project.toml` btw)
This command will execute all tests defined in your project's `test` directory. This command will execute all tests defined in your project's `test` directory.
#### An example output
```julia ```julia
# Addition Tests: Test Failed at XXX/gits/nmh/SustainableSoftwareEngineering.jl/test/test_add.jl:7 # Addition Tests: Test Failed at XXX/gits/nmh/SustainableSoftwareEngineering.jl/test/test_add.jl:7
# Expression: add(0, 0) == 1 # Expression: add(0, 0) == 1
...@@ -87,21 +88,14 @@ This command will execute all tests defined in your project's `test` directory. ...@@ -87,21 +88,14 @@ This command will execute all tests defined in your project's `test` directory.
# Addition Tests | 3 1 4 0.8s # Addition Tests | 3 1 4 0.8s
``` ```
## Test Coverage ## Optional
### Understanding Test Coverage
- What is test coverage and why it matters.
- Tools for measuring test coverage in Julia, e.g., Codecov or Coveralls.
### Optional: Incorporating Coverage into Tests
### Test Coverage
- Adding coverage metrics to your test suite. - Adding coverage metrics to your test suite.
- Interpreting coverage reports to improve test quality. - Interpreting coverage reports to improve test quality.
## Optional: Automatic Testing with Continuous Integration ### Automatic Testing with Continuous Integration
- Using CI for automatic testing whenever a commit happened in Git
- Using CI for automatic testing.
## Further reading ## Further reading
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment