Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions 05_testing_and_ci/automation_exercise.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

In this exercise, we create automated workflows and pipelines based on GitHub Actions. We are again working with our beloved diffusion Python code.

Deadline: **Wednesday, January 29th, 2025, 09:00**
Deadline: **Wednesday, January 28th, 2025, 09:00**

## Preparations

Import the [automation exercise repository](https://github.com/Simulation-Software-Engineering/automation-exercise-wt2425) in your own account/namespace on GitHub and name it `automation-exercise`. It is also easier to add badges (see below) to the `README.md` if the repository is under your control.
Import (not fork) the [automation exercise repository](https://github.com/Simulation-Software-Engineering/automation-exercise) in your own account/namespace on GitHub.

**Note**: We cannot work with forks here because GitHub Actions may not work in pull requests without explicit approval of the owner of the target repository
**Note**: We cannot work with forks here because GitHub Actions may not work in pull requests without explicit approval of the owner of the target repository. It is also easier to add badges (see below) to the `README.md` if the repository is under your control.

## Task descriptions

Expand All @@ -26,7 +26,7 @@ Once the workflow runs successfully, add a [GitHub workflow status badge](https:

## Submission

- Submit your solution via an issue in the *upstream* [automation exercise repository](https://github.com/Simulation-Software-Engineering/automation-exercise-wt2425). The issue should be named `[USERNAME] Automation exercise`, e.g., `[uekermbn] Automation exercise`. Please use your GitLab username here. Add a link to your GitHub repository in the issue. If necessary, add further explanations in the issue description.
- Submit your solution via an issue in the *upstream* [automation exercise repository](https://github.com/Simulation-Software-Engineering/automation-exercise). The issue should be named `[USERNAME] Automation exercise`, e.g., `[uekermbn] Automation exercise`. Please use your GitLab username here. Add a link to your GitHub repository in the issue. If necessary, add further explanations in the issue description.

## Bonus: GitLab CI/CD

Expand Down
4 changes: 3 additions & 1 deletion 05_testing_and_ci/automation_slides.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,11 @@ slideOptions:

- [GitHub Actions](https://github.com/features/actions)
- [GitLab CI/CD](https://docs.gitlab.com/ee/ci/)
- [Jenkins](https://www.jenkins.io/)
- [Woodpecker CI](https://woodpecker-ci.org/)
(e.g., in [Codeberg](https://docs.codeberg.org/ci/))
- [Circle CI](https://circleci.com/)
- [Travis CI](https://www.travis-ci.com/)
- [Jenkins](https://www.jenkins.io/)
- ...

---
Expand Down
26 changes: 13 additions & 13 deletions 05_testing_and_ci/github_actions_demo.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## 1. Setting up a Test Job

- Clone [automation lecture repository](https://github.com/Simulation-Software-Engineering/automation-lecture-wt2425) and run code and tests
- Clone [automation lecture repository](https://github.com/Simulation-Software-Engineering/automation-lecture) and run code and tests
- Set up workflow file

```bash
Expand All @@ -23,10 +23,10 @@
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
with:
python-version: '3.8'
python-version: '3.10'
- name: "Run unittest"
run: python -m unittest
```
Expand Down Expand Up @@ -70,10 +70,10 @@
style:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
with:
python-version: '3.8'
python-version: '3.10'
- name: "Install style checker"
run: pip install black
- name: "Run style check"
Expand All @@ -87,20 +87,20 @@
- name: "Run build phase"
run: echo "Building project $PROJECT_NAME"
test:
needs: build
# needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
with:
python-version: '3.8'
python-version: '3.10'
- name: "Run unittest"
run: python -m unittest
```

- We need to run `actions/checkout@v2` in each job
- We need to run `actions/checkout` in each job
- We could share the repository between jobs via artifacts, but that is uncommon.
- We need to run `actions/setup-python@v2` since jobs do not share the environment.
- We need to run `actions/setup-python` since jobs do not share the environment.
- We specify dependencies by `needs` such that the steps run after each other.
- We do not have a real build step since it is Python. However, this might be interesting for compiled code.

Expand Down
12 changes: 5 additions & 7 deletions 05_testing_and_ci/gitlab_ci_slides.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ From: [https://docs.gitlab.com/ee/ci/](https://docs.gitlab.com/ee/ci/)

## Components (2/2)

<img src="https://docs.gitlab.com/ee/ci/pipelines/img/manual_pipeline_v14_2.png" width=95%; style="margin-left:auto; margin-right:auto; padding-top: 25px; padding-bottom: 25px; background: #eeeeee">
<img src="https://docs.gitlab.com/ci/pipelines/img/manual_job_v17_9.png" width=95%; style="margin-left:auto; margin-right:auto; padding-top: 25px; padding-bottom: 25px; background: #eeeeee">

From [GitLab CI/CD tutorial](https://docs.gitlab.com/ee/ci/pipelines/index.html)

Expand Down Expand Up @@ -110,11 +110,11 @@ deploy job:

```yaml
variables:
TEST_VAR: "All jobs can use this variable's value"
TEST_VAR: "All jobs can use this variable"

job1:
variables:
TEST_VAR_JOB: "Only job1 can use this variable's value"
TEST_VAR_JOB: "Only job1 can use this variable"
script:
- echo "$TEST_VAR" and "$TEST_VAR_JOB"
```
Expand Down Expand Up @@ -182,16 +182,14 @@ deploy job:

## Demo: GitLab Runner

- Installation of a GitLab Runner on a [bwCloud](https://www.bw-cloud.org/) VM (via Docker)
- Installation of a GitLab Runner on a [bwCloud](https://portal.bw-cloud.org/) VM (via Docker)
- Registration of the runner to a repository (Docker as executor)

---

## Advanced Topics

- Complex pipelines, e.g.,
- [Directed Acyclic Graph](https://docs.gitlab.com/ee/ci/directed_acyclic_graph/)
- [Multi-project pipelines](https://docs.gitlab.com/ee/ci/pipelines/downstream_pipelines.html#multi-project-pipelines)
- [Multi-project pipelines](https://docs.gitlab.com/ee/ci/pipelines/downstream_pipelines.html#multi-project-pipelines)
- [Anchors](https://docs.gitlab.com/ee/ci/yaml/yaml_optimization.html#anchors)
- [ChatOps](https://docs.gitlab.com/ee/ci/chatops/)
- [Extended testing](https://docs.gitlab.com/ee/ci/testing/unit_test_reports.html)
Expand Down
12 changes: 11 additions & 1 deletion timetable.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,16 @@
- **20** min.: Introduction to Testing: [slides](https://github.com/Simulation-Software-Engineering/Lecture-Material/blob/main/05_testing_and_ci/intro_slides.md)
- **70** min.: Testing Python Code: [slides](https://github.com/Simulation-Software-Engineering/Lecture-Material/blob/main/05_testing_and_ci/python_testing_slides.md), [demo](https://github.com/Simulation-Software-Engineering/Lecture-Material/blob/main/05_testing_and_ci/python_testing_demo.md)

## 12.2 – Wed, January 14, 2025
## 12.2 – Wed, January 14, 2026

- **90** min.: [Exercise: Testing Python Code](https://github.com/Simulation-Software-Engineering/Lecture-Material/blob/main/05_testing_and_ci/python_testing_exercise.md)

## 12.1 – Wed, January 21, 2026

- **15** min.: [Automation](https://github.com/Simulation-Software-Engineering/Lecture-Material/blob/main/05_testing_and_ci/automation_slides.md)
- **45** min.: GitHub Actions: [slides](https://github.com/Simulation-Software-Engineering/Lecture-Material/blob/main/05_testing_and_ci/github_actions_slides.md), [demo](https://github.com/Simulation-Software-Engineering/Lecture-Material/blob/main/05_testing_and_ci/github_actions_demo.md)
- **30** min.: GitLab CI: [slides](https://github.com/Simulation-Software-Engineering/Lecture-Material/blob/main/05_testing_and_ci/gitlab_ci_slides.md), [demo](https://github.com/Simulation-Software-Engineering/Lecture-Material/blob/main/05_testing_and_ci/gitlab_ci_demo.md)

## 12.2 – Wed, January 21, 2026

- **90** min.: [Exercise: Automating Workflows with GitHub Actions](https://github.com/Simulation-Software-Engineering/Lecture-Material/blob/main/05_testing_and_ci/automation_exercise.md)