Skip to content

Commit 8ce418d

Browse files
authored
Merge pull request #17 from Chisanan232/release
🎉🎊🍾 [New Feature + Breaking Change + Refactor] (config + docs) Add new feature, integrate organizing reports features and update document.
2 parents be9eb7a + bd48f3c commit 8ce418d

29 files changed

+1441
-464
lines changed

.coveragerc

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
1-
# # This test directory for testing to simulate a Python library project structure.
2-
31
[run]
2+
branch = True
43
parallel = True
5-
relative_files = True
64
source=./test_gh_workflow
75

86
omit =
97
*/__init__.py
10-
11-
#ignore_errors = True

.github/PULL_REQUEST_TEMPLATE/pull_request_template.md renamed to .github/PULL_REQUEST_TEMPLATE.md

File renamed without changes.

.github/release-auto-flag.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
true

.github/release-notes.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
### 🎉🎊🍾 New feature
2+
<hr>
3+
4+
1. Add new options about set up and run a sample HTTP server for testing if it needs in some testing scenario (_run_test_items_via_pytest.yaml_).
5+
6+
### 🛠⚙️🔩 **Breaking Change**
7+
<hr>
8+
9+
1. Integrate the feature about organizing and generating testing coverage reports into a reusable workflow. So workflow could be shorter and clear (_organize_and_generate_test_cov_reports.yaml_).
10+
2. Integrate all the uploading test coverage report features into a reusable workflow (_upload_test_cov_report.yaml_).
11+
3. Update document README.
12+
4. Move the PR template to **_.github_** directory (for working finely).
13+
14+
### ⚒⚒💣 **Bug Fix**
15+
<hr>
16+
17+
1. Fix the issue about uploading test coverage report cannot work at all.

.github/release-title.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
v2.0.0 - More short and clear <0001f9f9>🍻
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
##############################################################################################
2+
#
3+
# Workflow Description:
4+
# Build a git tag on a specific commit in every git branch. And create GitHub release if current git branch is 'master'.
5+
#
6+
# Workflow input parameters:
7+
# * General arguments:
8+
# * project_type: Different project type would get the software version info in different way.
9+
# * debug_mode: It would run the tasks as log message, doesn't essentially run feature if this option is true.
10+
# * project_name: The project name.
11+
# * software_version_format: The format of software version.
12+
#
13+
# Workflow running output:
14+
# Yes, it has running result output. The output is the release version.
15+
#
16+
# * Workflow output:
17+
# It would output the version which would be build as git tag and create GitHub release version title.
18+
# * python_release_version: Python project release version info.
19+
# * github-action_reusable_workflow_release_version: GitHub Action reusable workflow project release version info.
20+
#
21+
##############################################################################################
22+
23+
name: Build git tag and create GitHub release with software version
24+
25+
on:
26+
workflow_call:
27+
inputs:
28+
project_type:
29+
description: "Different project type would get the software version info in different way."
30+
required: true
31+
type: string # Option: python, github-action_reusable-workflow
32+
# activate_git_event:
33+
# description: "Which git event should activate the workflow."
34+
# type: string
35+
# required: false
36+
# default: push
37+
debug_mode:
38+
description: "It would run the tasks as log message, doesn't essentially run feature if this option is true."
39+
type: boolean
40+
required: false
41+
default: false
42+
project_name:
43+
description: "The project name."
44+
type: string
45+
required: false
46+
software_version_format:
47+
description: "The format of software version."
48+
type: string
49+
required: false
50+
51+
outputs:
52+
python_release_version:
53+
description: "The version which would be build as git tag and create GitHub release version title."
54+
value: ${{ jobs.build_git-tag_and_create_github-release.outputs.matrix_python }}
55+
github-action_reusable_workflow_release_version:
56+
description: "The version which would be build as git tag and create GitHub release version title."
57+
value: ${{ jobs.build_git-tag_and_create_github-release.outputs.matrix_github_action_reusable_workflow }}
58+
59+
60+
jobs:
61+
build_git-tag_and_create_github-release:
62+
# name: Build git tag and GitHub release if it needs
63+
if: github.event_name == 'push'
64+
runs-on: ubuntu-latest
65+
outputs:
66+
matrix_python: ${{ steps.python_release.outputs.release_type }}
67+
matrix_github_action_reusable_workflow: ${{ steps.github_action_reusable_workflow_release.outputs.release_version }}
68+
steps:
69+
- name: Checkout
70+
uses: actions/checkout@v2
71+
72+
- name: Download shell script for checking input parameters
73+
run: curl https://raw.githubusercontent.com/Chisanan232/GitHub-Action_Workflow-Template-Python/develop/scripts/ci/build_git-tag_or_create_github-release.sh --output ./scripts/ci/build_git-tag_or_create_github-release.sh
74+
75+
# This flow for the project type is Python project
76+
- name: Build git tag and create GitHub release for Python project
77+
if: ${{ inputs.project_type == 'python-package' }}
78+
id: python_release
79+
run: |
80+
release=$(bash ./scripts/ci/build_git-tag_or_create_github-release.sh ${{ inputs.project_type }} ${{ inputs.debug_mode }} ${{ inputs.project_name }} ${{ inputs.software_version_format }})
81+
echo "📄 Release log: $release"
82+
83+
release_type=$(echo "$release" | grep -E "\[Python\] \[Final Running Result\] ((Official\-Release)|(Pre\-Release))" | grep -E -o "((Official\-Release)|(Pre\-Release))")
84+
echo "🐍 Release Type: $release_type"
85+
86+
echo "::set-output name=release_type::$(echo $release_type)"
87+
88+
# This flow for the project type is GitHub Action reusable workflow
89+
- name: Build git tag and create GitHub release for GitHub Action reusable workflow project
90+
if: ${{ inputs.project_type == 'github-action-reusable-workflow' }}
91+
id: github_action_reusable_workflow_release
92+
run: |
93+
release=$(bash ./scripts/ci/build_git-tag_or_create_github-release.sh ${{ inputs.project_type }} ${{ inputs.debug_mode }})
94+
echo "📄 Release log: $release"
95+
96+
release_version=$(echo "$release" | grep -E "\[GitHub Action - Reusable workflow\] \[Final Running Result\] Official-Release and version: ([0-9]{1,})" | grep -E -o "([0-9]{1,})")
97+
echo "🤖 Release Version: $release_version"
98+
99+
echo "::set-output name=release_version::$(echo $release_version)"
100+

.github/workflows/ci-cd.yaml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: GitHub Action reusable workflow build
2+
3+
on:
4+
push:
5+
branches:
6+
- "develop"
7+
- "release"
8+
- "master"
9+
paths-ignore:
10+
- ".gitcommitrules"
11+
- ".gitignore"
12+
- "LICENSE"
13+
- "README.md"
14+
15+
pull_request:
16+
branches:
17+
- "develop"
18+
- "release"
19+
paths-ignore:
20+
- ".gitcommitrules"
21+
- ".gitignore"
22+
- "LICENSE"
23+
- "README.md"
24+
25+
jobs:
26+
test_build_git-tag_and_create_github-release:
27+
# name: Build git tag and GitHub release if it needs
28+
uses: ./.github/workflows/build_git-tag_and_create_github-release.yaml
29+
with:
30+
project_type: github-action-reusable-workflow
31+
debug_mode: false
32+
33+
34+
test_deploy_as_new_branch:
35+
# name: Create new git branch by the tagged commit
36+
needs: test_build_git-tag_and_create_github-release
37+
if: ${{ github.ref_name == 'master' &&
38+
github.event_name == 'push' &&
39+
needs.test_build_git-tag_and_create_github-release.outputs.github-action_reusable_workflow_release_version != 'Pre' }}
40+
runs-on: ubuntu-latest
41+
env:
42+
RELEASE_TYPE: ${{ needs.test_build_git-tag_and_create_github-release.outputs.github-action_reusable_workflow_release_version }}
43+
DEBUG_MODE: false
44+
steps:
45+
- uses: actions/checkout@v2
46+
47+
- name: Check it whether get the output of previous one job which has version info or not
48+
run: bash scripts/ci/check_getting_output.sh
49+
50+
- name: Create new git branch by the tagged commit
51+
run: bash ./scripts/ci/deployment_new_version_workflow.sh $DEBUG_MODE
52+

.github/workflows/organize_all_testing_coverage_reports_with_different_os_and_py_version.yaml

Lines changed: 0 additions & 111 deletions
This file was deleted.

.github/workflows/organize_all_testing_reports_with_different_test_type.yaml

Lines changed: 0 additions & 64 deletions
This file was deleted.

0 commit comments

Comments
 (0)