-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathnotes.txt
51 lines (41 loc) · 2.42 KB
/
notes.txt
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
Exercise: CI/CD pipeline for Django application using GitHub Actions and Visual Studio Code
- .gitignore file set up
- initialized app/ directory as local git repository
- added README.md "echo "# tutorials_workflow_demo" >> README.md"
- pushed local to remote repository
# Set up GitHub Actions workflow #
- created workflow YAML file in local repository (can also be created in GitHub online editor)
- workflow will trigger on push/pull requests
- can be triggered manually (workslow_dispatch)
- job key created (must have name), called "build-and-test"
- can have many jobs in a workflow and, if so, jobs run parallel and in separate runner environments
- each job has a runner environment
- various virtual machines hosted by GitHub (ubuntu, windows, macOS, etc)
- steps in a job run sequentially, optionally named, and begin with hyphen
- "run" and "uses" are common steps
- cannot have run and uses of the same name
- "uses" are how we use "actions"
- actions can be custom made, or can come from GH Actions Marketplace
- actions cause runner to checkout repository in job's runner environment
- using to install python 3.9 in exercise
- "run" step access shell in runner environment, to run CLI commands (echo and python)
- can provide multiple commands to "run" key by using piping cmd: " | "
- upgraded pip, installed python packages for this app, ran migrations, setup initial databse tables
- ran pytest
# Trigger workflow #
- commit YML file changes to remote repository
- create new branch, Propose new file, create pull requests
- pull request is the event the triggers main.yml to run
- Run all test steps, can see results from running pytest
- merged pull request, deleted branch, actions tab has merge under workflow runs
# Manually triggering workflow #
- able to manually trigger due to "workflow_dispatch" event to the "on" key
- in Actions tab, select workflow, click "Run workflow" on main branch
- new workflow run recorded in Actions tab, can see it was manually triggered
# Cause test failure #
- pull request for code with bug in it
- on GH repository, in tutorials/ directory
- views.py file, commented out "def get(self, request)" function
- commit changes, create new branch, propose changes
- create pull request, go to Actions tab, failed run
- close pull request, deleted branch