Skip to content

Commit e489158

Browse files
committed
adding simple ci tutorial
1 parent 2f53960 commit e489158

File tree

6 files changed

+181
-0
lines changed

6 files changed

+181
-0
lines changed

makefile

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
.PHONY: help
2+
help: ## Display this help screen
3+
@echo "Please use \`make <target>' where <target> is one of"
4+
@grep -E '^[a-zA-Z_-][a-zA-Z_\-\/]+[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\t\033[36m%-30s\033[0m %s\n", $$1, $$2}'
5+
@echo "make sure to populate your env with \`source bin/env' before using this tool"
6+
7+
.PHONY: deps
8+
deps: ## Install dependencies
9+
@echo "install deps"
10+
11+
.PHONY: test
12+
test: ## Unit test our code
13+
@echo "testing code"
14+
15+
.PHONY: build
16+
build: ## Builds our code
17+
@echo "building site"
18+
19+
.PHONY: deploy
20+
deploy: ## Deploys our built artifact
21+
@echo "deploys our built artifact"

references/yamls/gh-ci-demo.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: GitHub Actions CI
2+
on:
3+
pull_request:
4+
branches: [main]
5+
jobs:
6+
mysite-ci:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- name: Checkout main
10+
uses: actions/checkout@v2
11+
- name: install dependencies
12+
run: make deps
13+
- name: test code
14+
run: make test
15+
- name: build code
16+
run: make build
17+
- name: store artifact
18+
run: echo "save artifact where you want"

references/yamls/gh-ci-reuse.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: GitHub Actions Reusable actions
2+
on:
3+
pull_request:
4+
branches: [main]
5+
jobs:
6+
reuse-ci:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- name: Checkout main
10+
uses: actions/checkout@v2
11+
- name: reviewdog-markdownlint
12+
uses: reviewdog/[email protected]
13+
with:
14+
github_token: ${{ secrets.GITHUB_TOKEN }}
15+
reporter: github-pr-review
16+
filter_mode: nofilter # file to only check new or mod files
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Reviewdog-Markdownlint
2+
on:
3+
pull_request:
4+
branches: [main]
5+
6+
jobs:
7+
reviewdog-markdownlint:
8+
name: reviewdog-markdown-linter
9+
runs-on: ubuntu-latest
10+
strategy:
11+
matrix:
12+
node-version: [10.x]
13+
steps:
14+
- name: Checkout main
15+
uses: actions/checkout@v2
16+
17+
- name: reviewdog-markdownlint
18+
uses: reviewdog/[email protected]
19+
with:
20+
github_token: ${{ secrets.GITHUB_TOKEN }}
21+
reporter: github-pr-review
22+
filter_mode: file
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Markdownlint
2+
on:
3+
pull_request:
4+
branches: [main]
5+
6+
jobs:
7+
markdownlint:
8+
name: markdown-linter
9+
runs-on: ubuntu-latest
10+
strategy:
11+
matrix:
12+
node-version: [10.x]
13+
steps:
14+
- name: Checkout main
15+
uses: actions/checkout@v2
16+
17+
- name: Install Node.js ${{ matrix.node-version }}
18+
uses: actions/setup-node@v1
19+
with:
20+
node-version: ${{ matrix.node-version }}
21+
22+
- name: Install markdownlint
23+
run: |
24+
npm install -g markdownlint-cli
25+
continue-on-error: false
26+
27+
- name: Run markdownlint
28+
run: |
29+
markdownlint -f 'static_hugo_site/content/**/*.md'
30+
continue-on-error: false

tutorials/simple-ci/traditional-ci.md

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# Traditional CI GitHub Actions
2+
3+
## Introduction
4+
5+
The following example shows you how GitHub Actions jobs help you setup a CI workflow
6+
7+
## Creating your first CI workflow
8+
9+
1. Fork this repo from [here](https://github.com/wizelineacademy/github-actions-tutorial) or create a new repo from [here](https://github.com/new)
10+
11+
1. Start the web editor by pressing "." in your repo `https://github.com/<yourusername>/github-actions-tutorial`
12+
13+
1. Create a new branch
14+
15+
1. Create a `.github/workflows` directory in your repository in GitHub if this directory does not already exist.
16+
17+
1. In the `.github/workflows` directory, create a file named gh-ci-demo.yml
18+
19+
1. Copy the following YAML contents into the `gh-ci-demo.yml` file:
20+
21+
```yaml{:copy}
22+
name: GitHub Actions CI
23+
on:
24+
pull_request:
25+
branches: [main]
26+
jobs:
27+
mysite-ci:
28+
runs-on: ubuntu-latest
29+
steps:
30+
- name: Checkout main
31+
uses: actions/checkout@v2
32+
- name: install dependencies
33+
run: make deps
34+
- name: test code
35+
run: make test
36+
- name: build code
37+
run: make build
38+
- name: store artifact
39+
run: echo "save artifact where you want"
40+
```
41+
42+
1. Create a PR with new branch and use main as base branch
43+
44+
1. Review Action Tab
45+
46+
1. Lets update our makefile deps command with
47+
48+
```bash
49+
deps: ## Install dependencies
50+
@echo "install deps"
51+
npm install -g markdownlint-cli
52+
```
53+
54+
1. Lets update our makefile test command with
55+
56+
```bash
57+
.PHONY: test
58+
test: ## Unit test our code
59+
@echo "testing code"
60+
markdownlint -f 'static_hugo_site/content/**/*.md'
61+
```
62+
63+
1. Review our current Open PR for failed CI
64+
65+
1. Lets fix our fix `static_hugo_site/content/post/sample-post/index.md` line 21 and break it in 2
66+
67+
```md
68+
This article offers a sample of basic Markdown syntax that can be used in Hugo content files, also it shows
69+
whether basic HTML elements are decorated with CSS in a Hugo theme.
70+
```
71+
72+
1. Commit file
73+
74+
1. Review our current Open PR for Pass CI

0 commit comments

Comments
 (0)