Skip to content

Commit 3c6fbdb

Browse files
authored
Merge pull request #31 from devilbox/release-0.36
Release 0.36
2 parents ac5f26d + c121518 commit 3c6fbdb

File tree

12 files changed

+468
-126
lines changed

12 files changed

+468
-126
lines changed

.github/workflows/build.yml

Lines changed: 163 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,163 @@
1+
---
2+
3+
# -------------------------------------------------------------------------------------------------
4+
# Job Name
5+
# -------------------------------------------------------------------------------------------------
6+
name: build
7+
8+
9+
# -------------------------------------------------------------------------------------------------
10+
# When to run
11+
# -------------------------------------------------------------------------------------------------
12+
on:
13+
# Runs on Pull Requests
14+
pull_request:
15+
# Runs on Push
16+
push:
17+
18+
19+
# -------------------------------------------------------------------------------------------------
20+
# What to run
21+
# -------------------------------------------------------------------------------------------------
22+
jobs:
23+
build:
24+
name: "[ HTTPD ]"
25+
runs-on: ubuntu-latest
26+
steps:
27+
28+
# ------------------------------------------------------------
29+
# Setup repository
30+
# ------------------------------------------------------------
31+
- name: Checkout repository
32+
uses: actions/checkout@v2
33+
with:
34+
fetch-depth: 0
35+
36+
- name: Set variables
37+
id: vars
38+
run: |
39+
40+
# Retrieve git info (tags, etc)
41+
git fetch --all
42+
43+
# Branch, Tag or Commit
44+
GIT_TYPE="$( \
45+
curl -sS https://raw.githubusercontent.com/cytopia/git-tools/master/git-info.sh \
46+
| sh \
47+
| grep '^GIT_TYPE' \
48+
| sed 's|.*=||g' \
49+
)"
50+
# Branch name, Tag name or Commit Hash
51+
GIT_SLUG="$( \
52+
curl -sS https://raw.githubusercontent.com/cytopia/git-tools/master/git-info.sh \
53+
| sh \
54+
| grep '^GIT_NAME' \
55+
| sed 's|.*=||g' \
56+
)"
57+
# Docker Tag
58+
if [ "${GIT_TYPE}" = "BRANCH" ] && [ "${GIT_SLUG}" = "master" ]; then
59+
DOCKER_TAG="latest"
60+
else
61+
DOCKER_TAG="${GIT_SLUG}"
62+
fi
63+
64+
# Output
65+
echo "GIT_TYPE=${GIT_TYPE}"
66+
echo "GIT_SLUG=${GIT_SLUG}"
67+
echo "DOCKER_TAG=${DOCKER_TAG}"
68+
69+
# Export variable
70+
# https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-commands-for-github-actions#environment-files
71+
echo "GIT_TYPE=${GIT_TYPE}" >> ${GITHUB_ENV}
72+
echo "GIT_SLUG=${GIT_SLUG}" >> ${GITHUB_ENV}
73+
echo "DOCKER_TAG=${DOCKER_TAG}" >> ${GITHUB_ENV}
74+
75+
76+
# ------------------------------------------------------------
77+
# Build
78+
# ------------------------------------------------------------
79+
- name: Build
80+
run: |
81+
retry() {
82+
for n in $(seq ${RETRIES}); do
83+
echo "[${n}/${RETRIES}] ${*}";
84+
if eval "${*}"; then
85+
echo "[SUCC] ${n}/${RETRIES}";
86+
return 0;
87+
fi;
88+
sleep ${PAUSE};
89+
echo "[FAIL] ${n}/${RETRIES}";
90+
done;
91+
return 1;
92+
}
93+
retry make build
94+
env:
95+
RETRIES: 20
96+
PAUSE: 10
97+
98+
# ------------------------------------------------------------
99+
# Test
100+
# ------------------------------------------------------------
101+
- name: Test Docker Image
102+
run: |
103+
retry() {
104+
for n in $(seq ${RETRIES}); do
105+
echo "[${n}/${RETRIES}] ${*}";
106+
if eval "${*}"; then
107+
echo "[SUCC] ${n}/${RETRIES}";
108+
return 0;
109+
fi;
110+
sleep ${PAUSE};
111+
echo "[FAIL] ${n}/${RETRIES}";
112+
done;
113+
return 1;
114+
}
115+
retry make test
116+
env:
117+
RETRIES: 20
118+
PAUSE: 10
119+
120+
121+
# ------------------------------------------------------------
122+
# Deploy
123+
# ------------------------------------------------------------
124+
- name: Publish images (only repo owner)
125+
run: |
126+
retry() {
127+
for n in $(seq ${RETRIES}); do
128+
echo "[${n}/${RETRIES}] ${*}";
129+
if eval "${*}"; then
130+
echo "[SUCC] ${n}/${RETRIES}";
131+
return 0;
132+
fi;
133+
sleep ${PAUSE};
134+
echo "[FAIL] ${n}/${RETRIES}";
135+
done;
136+
return 1;
137+
}
138+
139+
# Output
140+
echo "GIT_TYPE=${GIT_TYPE}"
141+
echo "GIT_SLUG=${GIT_SLUG}"
142+
echo "DOCKER_TAG=${DOCKER_TAG}"
143+
144+
# Tag image
145+
retry make tag TAG=${DOCKER_TAG}
146+
docker images
147+
148+
# Login and Push
149+
retry make login USER=${{ secrets.DOCKERHUB_USERNAME }} PASS=${{ secrets.DOCKERHUB_PASSWORD }}
150+
retry make push TAG=${DOCKER_TAG}
151+
152+
env:
153+
RETRIES: 20
154+
PAUSE: 10
155+
# https://help.github.com/en/github/automating-your-workflow-with-github-actions/contexts-and-expression-syntax-for-github-actions#functions
156+
if: github.event.pull_request.base.repo.id == github.event.pull_request.head.repo.id
157+
&& (
158+
(github.event_name == 'schedule' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/')))
159+
||
160+
(github.event_name == 'push' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/')))
161+
||
162+
(github.event_name == 'push' && startsWith(github.ref, 'refs/heads/release-'))
163+
)

.github/workflows/lint.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
---
2+
3+
# -------------------------------------------------------------------------------------------------
4+
# Job Name
5+
# -------------------------------------------------------------------------------------------------
6+
name: lint
7+
8+
9+
# -------------------------------------------------------------------------------------------------
10+
# When to run
11+
# -------------------------------------------------------------------------------------------------
12+
on:
13+
# Runs on Pull Requests
14+
pull_request:
15+
16+
17+
# -------------------------------------------------------------------------------------------------
18+
# What to run
19+
# -------------------------------------------------------------------------------------------------
20+
jobs:
21+
lint:
22+
name: "Lint"
23+
runs-on: ubuntu-latest
24+
steps:
25+
# ------------------------------------------------------------
26+
# Setup repository
27+
# ------------------------------------------------------------
28+
- name: Checkout repository
29+
uses: actions/checkout@v2
30+
with:
31+
fetch-depth: 0
32+
33+
# ------------------------------------------------------------
34+
# Lint repository
35+
# ------------------------------------------------------------
36+
- name: Lint workflow
37+
run: |
38+
make lint-workflow

.github/workflows/nightly.yml

Lines changed: 169 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,169 @@
1+
---
2+
3+
# -------------------------------------------------------------------------------------------------
4+
# Job Name
5+
# -------------------------------------------------------------------------------------------------
6+
name: nightly
7+
8+
9+
# -------------------------------------------------------------------------------------------------
10+
# When to run
11+
# -------------------------------------------------------------------------------------------------
12+
on:
13+
# Runs daily
14+
schedule:
15+
- cron: '0 0 * * *'
16+
17+
18+
# -------------------------------------------------------------------------------------------------
19+
# What to run
20+
# -------------------------------------------------------------------------------------------------
21+
jobs:
22+
nightly:
23+
name: "[ HTTPD ] (ref: ${{ matrix.refs }})"
24+
runs-on: ubuntu-latest
25+
strategy:
26+
fail-fast: False
27+
matrix:
28+
refs:
29+
- 'master'
30+
- '0.36'
31+
steps:
32+
33+
# ------------------------------------------------------------
34+
# Setup repository
35+
# ------------------------------------------------------------
36+
- name: Checkout repository
37+
uses: actions/checkout@v2
38+
with:
39+
fetch-depth: 0
40+
ref: ${{ matrix.refs }}
41+
42+
- name: Set variables
43+
id: vars
44+
run: |
45+
46+
# Retrieve git info (tags, etc)
47+
git fetch --all
48+
49+
# Branch, Tag or Commit
50+
GIT_TYPE="$( \
51+
curl -sS https://raw.githubusercontent.com/cytopia/git-tools/master/git-info.sh \
52+
| sh \
53+
| grep '^GIT_TYPE' \
54+
| sed 's|.*=||g' \
55+
)"
56+
# Branch name, Tag name or Commit Hash
57+
GIT_SLUG="$( \
58+
curl -sS https://raw.githubusercontent.com/cytopia/git-tools/master/git-info.sh \
59+
| sh \
60+
| grep '^GIT_NAME' \
61+
| sed 's|.*=||g' \
62+
)"
63+
# Docker Tag
64+
if [ "${GIT_TYPE}" = "BRANCH" ] && [ "${GIT_SLUG}" = "master" ]; then
65+
DOCKER_TAG="latest"
66+
else
67+
DOCKER_TAG="${GIT_SLUG}"
68+
fi
69+
70+
# Output
71+
echo "GIT_TYPE=${GIT_TYPE}"
72+
echo "GIT_SLUG=${GIT_SLUG}"
73+
echo "DOCKER_TAG=${DOCKER_TAG}"
74+
75+
# Export variable
76+
# https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-commands-for-github-actions#environment-files
77+
echo "GIT_TYPE=${GIT_TYPE}" >> ${GITHUB_ENV}
78+
echo "GIT_SLUG=${GIT_SLUG}" >> ${GITHUB_ENV}
79+
echo "DOCKER_TAG=${DOCKER_TAG}" >> ${GITHUB_ENV}
80+
81+
82+
# ------------------------------------------------------------
83+
# Build
84+
# ------------------------------------------------------------
85+
- name: Build
86+
run: |
87+
retry() {
88+
for n in $(seq ${RETRIES}); do
89+
echo "[${n}/${RETRIES}] ${*}";
90+
if eval "${*}"; then
91+
echo "[SUCC] ${n}/${RETRIES}";
92+
return 0;
93+
fi;
94+
sleep ${PAUSE};
95+
echo "[FAIL] ${n}/${RETRIES}";
96+
done;
97+
return 1;
98+
}
99+
retry make build
100+
env:
101+
RETRIES: 20
102+
PAUSE: 10
103+
104+
# ------------------------------------------------------------
105+
# Test
106+
# ------------------------------------------------------------
107+
- name: Test Docker Image
108+
run: |
109+
retry() {
110+
for n in $(seq ${RETRIES}); do
111+
echo "[${n}/${RETRIES}] ${*}";
112+
if eval "${*}"; then
113+
echo "[SUCC] ${n}/${RETRIES}";
114+
return 0;
115+
fi;
116+
sleep ${PAUSE};
117+
echo "[FAIL] ${n}/${RETRIES}";
118+
done;
119+
return 1;
120+
}
121+
retry make test
122+
env:
123+
RETRIES: 20
124+
PAUSE: 10
125+
126+
127+
# ------------------------------------------------------------
128+
# Deploy
129+
# ------------------------------------------------------------
130+
- name: Publish images (only repo owner)
131+
run: |
132+
retry() {
133+
for n in $(seq ${RETRIES}); do
134+
echo "[${n}/${RETRIES}] ${*}";
135+
if eval "${*}"; then
136+
echo "[SUCC] ${n}/${RETRIES}";
137+
return 0;
138+
fi;
139+
sleep ${PAUSE};
140+
echo "[FAIL] ${n}/${RETRIES}";
141+
done;
142+
return 1;
143+
}
144+
145+
# Output
146+
echo "GIT_TYPE=${GIT_TYPE}"
147+
echo "GIT_SLUG=${GIT_SLUG}"
148+
echo "DOCKER_TAG=${DOCKER_TAG}"
149+
150+
# Tag image
151+
retry make tag TAG=${DOCKER_TAG}
152+
docker images
153+
154+
# Login and Push
155+
retry make login USER=${{ secrets.DOCKERHUB_USERNAME }} PASS=${{ secrets.DOCKERHUB_PASSWORD }}
156+
retry make push TAG=${DOCKER_TAG}
157+
158+
env:
159+
RETRIES: 20
160+
PAUSE: 10
161+
# https://help.github.com/en/github/automating-your-workflow-with-github-actions/contexts-and-expression-syntax-for-github-actions#functions
162+
if: github.event.pull_request.base.repo.id == github.event.pull_request.head.repo.id
163+
&& (
164+
(github.event_name == 'schedule' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/')))
165+
||
166+
(github.event_name == 'push' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/')))
167+
||
168+
(github.event_name == 'push' && startsWith(github.ref, 'refs/heads/release-'))
169+
)

0 commit comments

Comments
 (0)