forked from hakimel/reveal.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
202 lines (154 loc) · 5.82 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title>reveal.js</title>
<link rel="stylesheet" href="dist/reset.css">
<link rel="stylesheet" href="dist/reveal.css">
<link rel="stylesheet" href="dist/theme/black.css">
<!-- Theme used for syntax highlighted code -->
<link rel="stylesheet" href="plugin/highlight/monokai.css">
</head>
<body>
<div class="reveal">
<div class="slides">
<section data-markdown data-separator-vertical="^\r?\n--\r?\n$">
<textarea data-template>
## Debugging GitHub Actions locally
Pascal Führlich
<img src=logo.png></img>
notes:
https://rsecon2022.society-rse.org/walkthroughs/
30 min presentation, 15 min questions
--
### storytime
- repo on GitHub with CI
- CI = continuous integration <!-- .element: class="fragment" data-fragment-index="2" -->
- CI ~ checks run on server on each push <!-- .element: class="fragment" data-fragment-index="3" -->
- CI checks fail, locally checks succeed <!-- .element: class="fragment" data-fragment-index="4" -->
- workflow <!-- .element: class="fragment" data-fragment-index="5" -->
```python
while CI fails:
come up with idea
implement potential fix
push to GitHub
wait 20 minutes
```
notes:
- then you run out of ideas and start putting `print` statements everywhere, push again...
- this trial & error approach reminds you of the time when you just started learning to program
- nothing seemed to work and it was frustrating as hell
--
<img src=fail_history.png height="600"></img>
notes:
- at the end of your workday your history on GitHub shows 20 commits each with a red "failed" cross
- and the worst thing: you still have no idea what's going wrong
- luckily, there's a better way, and we'll take a look at that now
--
### Requirements
- Windows, Mac, Linux
- git
- repo on GitHub
---
## Motivation
--
### why CI testing?
- run checks/tests on PR/push
- prevent broken projects, especially problematic if many devs/users
- ensure setup works on fresh machine
- code quality standard
--
### why GitHub Actions?
- Actions are easy to setup & free
- Actions = code -> will break eventually, and then?
- debugging! <!-- .element: class="fragment" data-fragment-index="2" -->
- is quite tricky here :( <!-- .element: class="fragment" data-fragment-index="3" -->
notes:
shoutout to GitHub, amazing service for free!
--
### why is debugging Actions tricky?
- Action runs on a GitHub server -> non-interactive
- trial & error? upload tons of commits + print debugging?
- instead use act by Casey Lee <!-- .element: class="fragment" data-fragment-index="2" -->
---
## Setup repo
- create [repo](https://github.com/pfuehrlich-pik/GitHub-Action-Example)
- add GitHub Action
- follow Action running in browser
notes:
- using R, but works with any language
- github action failed on GitHub
- ok, let's fix this locally... -> cannot reproduce!
--
## Setup act
- install [docker](https://www.docker.com/)
- install [act](https://github.com/nektos/act#installation)
- optional: download [GitHub Actions docker image](https://github.com/nektos/act#runners)
```sh
docker pull ghcr.io/catthehacker/ubuntu:full-latest
```
notes:
- when Action runs on GitHub server, runs in sandbox/virtual ubuntu system
- want to reproduce locally -> need same system -> docker image
- use to create container: virtual system, can have different tools/OS running there
---
## Debug Action locally
### run Action locally
```sh
act -P ubuntu-latest=ghcr.io/catthehacker/ubuntu:full-latest
```
1. creates docker container <!-- .element: class="fragment" data-fragment-index="2" -->
1. copies local files from the git repo into container <!-- .element: class="fragment" data-fragment-index="3" -->
1. runs Actions <!-- .element: class="fragment" data-fragment-index="4" -->
--
### open bash in container
```sh
docker ps # show running containers
docker exec -it {container-name-or-id} bash
```
notes:
- compare local vs in docker: interactive R session, `source("script.R")`, `str(x)`
- difference = `factor` vs `chr` -> explicitly set `stringsAsFactors = TRUE`
- upload to GitHub
- push fix to GitHub
- open running Action in browser
- back to presentation, next slide
---
## Wrap-up
- GitHub Actions are great, trial & error debugging is terrible
- recreated server environment locally <!-- .element: class="fragment" data-fragment-index="2" -->
- ran Action locally <!-- .element: class="fragment" data-fragment-index="2" -->
- solved problem interactively <!-- .element: class="fragment" data-fragment-index="3" -->
- much faster feedback loop <!-- .element: class="fragment" data-fragment-index="3" -->
- also helpful for developing new Action! <!-- .element: class="fragment" data-fragment-index="4" -->
notes:
- switch back to succeeded Action
- then next slide
--
## final slide
[[email protected]](mailto:[email protected])
[github.com/pfuehrlich-pik](https://github.com/pfuehrlich-pik)
[pfuehrlich-pik.github.io/Debugging-GitHub-Actions-locally](https://pfuehrlich-pik.github.io/Debugging-GitHub-Actions-locally/)<!-- .element: style="font-size: 36px;" -->
[presentation created with reveal.js by Hakim El Hattab](https://revealjs.com/)
[like act? sponsor Casey Lee](https://github.com/sponsors/cplee)
</textarea>
</section>
</div>
</div>
<script src="dist/reveal.js"></script>
<script src="plugin/notes/notes.js"></script>
<script src="plugin/markdown/markdown.js"></script>
<script src="plugin/highlight/highlight.js"></script>
<script>
// More info about initialization & config:
// - https://revealjs.com/initialization/
// - https://revealjs.com/config/
Reveal.initialize({
hash: true,
// Learn about plugins: https://revealjs.com/plugins/
plugins: [ RevealMarkdown, RevealHighlight, RevealNotes ]
});
</script>
</body>
</html>