Skip to content

Commit b8ba920

Browse files
Merge pull request #1 from coretech/DTCBE-1695
DTCBE-1695 fix action
2 parents 59671fa + 22c1994 commit b8ba920

File tree

2 files changed

+87
-28
lines changed

2 files changed

+87
-28
lines changed

action.yml

Lines changed: 87 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,65 +1,124 @@
1-
name: 'Allure Report with history'
2-
description: 'Generate Allure Report with history'
3-
author: 'simple-elf'
1+
name: "Allure Report with history"
2+
description: "Generate Allure Report with history"
43
branding:
5-
icon: 'layout'
6-
color: 'green'
4+
icon: "layout"
5+
color: "green"
76
inputs:
87
allure_results:
9-
description: 'Allure test result data dir'
8+
description: "Allure test result data dir"
109
required: true
11-
default: 'allure-results'
10+
default: "allure-results"
1211
allure_report:
13-
description: 'Allure report target dir'
12+
description: "Allure report target dir"
1413
required: true
15-
default: 'allure-report'
14+
default: "allure-report"
1615
gh_pages:
17-
description: 'Folder with gh-pages branch'
16+
description: "Folder with gh-pages branch"
1817
required: true
19-
default: 'gh-pages'
18+
default: "gh-pages"
2019
allure_history:
21-
description: 'Folder for allure history'
20+
description: "Folder for allure history"
2221
required: true
23-
default: 'allure-history'
22+
default: "allure-history"
2423
subfolder:
25-
description: 'subfolder'
24+
description: "subfolder"
2625
required: false
27-
default: ''
26+
default: ""
2827
keep_reports:
29-
description: 'Keep X last reports'
28+
description: "Keep X last reports"
3029
required: false
31-
default: '20'
30+
default: "20"
3231
github_run_num:
33-
description: 'GitHub Actions build number'
32+
description: "GitHub Actions build number"
3433
required: true
3534
default: ${{ github.run_number }}
3635
github_run_id:
37-
description: 'GitHub Actions run id'
36+
description: "GitHub Actions run id"
3837
required: true
3938
default: ${{ github.run_id }}
4039
github_repo:
41-
description: 'GitHub repository'
40+
description: "GitHub repository"
4241
required: true
4342
default: ${{ github.repository }}
4443
github_repo_owner:
45-
description: 'GitHub repository owner'
44+
description: "GitHub repository owner"
4645
required: true
4746
default: ${{ github.repository_owner }}
4847
github_tests_repo:
49-
description: 'GitHub repository where test are run'
48+
description: "GitHub repository where test are run"
5049
required: true
5150
default: ${{ github.repository }}
5251
report_url:
53-
description: 'Use a custom URL instead of *.github.io'
52+
description: "Use a custom URL instead of *.github.io"
5453
required: false
55-
default: ''
54+
default: ""
5655
github_server_url:
57-
description: 'GitHub server URL'
56+
description: "GitHub server URL"
5857
required: true
5958
default: ${{ github.server_url }}
6059
report_name:
61-
description: 'Allure report name/title'
60+
description: "Allure report name/title"
6261
required: false
6362
runs:
64-
using: 'docker'
65-
image: 'Dockerfile'
63+
using: "composite"
64+
steps:
65+
- name: Ensure required packages are installed
66+
shell: bash
67+
run: |
68+
set -e
69+
70+
RELEASE="2.32.0"
71+
ALLURE_REPO="https://repo.maven.apache.org/maven2/io/qameta/allure/allure-commandline"
72+
ALLURE_DIR="allure-$RELEASE"
73+
74+
for pkg in wget unzip openjdk-8-jre; do
75+
if ! command -v $pkg &> /dev/null; then
76+
echo "$pkg not found. Installing..."
77+
sudo apt-get update
78+
sudo apt-get install -y $pkg
79+
else
80+
echo "$pkg is already installed: $($pkg --version || true)"
81+
fi
82+
done
83+
84+
echo "Using Java: $(java -version 2>&1 | head -n 1)"
85+
86+
if [ ! -d "$ALLURE_DIR" ]; then
87+
wget -q -O "/tmp/allure-$RELEASE.tgz" "$ALLURE_REPO/$RELEASE/allure-commandline-$RELEASE.tgz"
88+
tar -xf "/tmp/allure-$RELEASE.tgz"
89+
chmod -R +x "$ALLURE_DIR/bin"
90+
rm "/tmp/allure-$RELEASE.tgz"
91+
else
92+
echo "Allure has already existed in $ALLURE_DIR"
93+
fi
94+
95+
if [[ ":$PATH:" != *":$PWD/$ALLURE_DIR/bin:"* ]]; then
96+
export PATH="$PATH:$PWD/$ALLURE_DIR/bin"
97+
echo 'export PATH="$PATH:'"$PWD/$ALLURE_DIR/bin"'"' >> ~/.bashrc
98+
fi
99+
100+
allure --version
101+
102+
- name: Define variables
103+
shell: bash
104+
run: |
105+
echo "INPUT_ALLURE_RESULTS=${{ inputs.allure_results }}" >> $GITHUB_ENV
106+
echo "INPUT_ALLURE_REPORT=${{ inputs.allure_report }}" >> $GITHUB_ENV
107+
echo "INPUT_GH_PAGES=${{ inputs.gh_pages }}" >> $GITHUB_ENV
108+
echo "INPUT_ALLURE_HISTORY=${{ inputs.allure_history }}" >> $GITHUB_ENV
109+
echo "INPUT_SUBFOLDER=${{ inputs.subfolder }}" >> $GITHUB_ENV
110+
echo "INPUT_KEEP_REPORTS=${{ inputs.keep_reports }}" >> $GITHUB_ENV
111+
echo "INPUT_GITHUB_RUN_NUM=${{ inputs.github_run_num }}" >> $GITHUB_ENV
112+
echo "INPUT_GITHUB_RUN_ID=${{ inputs.github_run_id }}" >> $GITHUB_ENV
113+
echo "INPUT_GITHUB_REPO=${{ inputs.github_repo }}" >> $GITHUB_ENV
114+
echo "INPUT_GITHUB_REPO_OWNER=${{ inputs.github_repo_owner }}" >> $GITHUB_ENV
115+
echo "INPUT_GITHUB_TESTS_REPO=${{ inputs.github_tests_repo }}" >> $GITHUB_ENV
116+
echo "INPUT_REPORT_URL=${{ inputs.report_url }}" >> $GITHUB_ENV
117+
echo "INPUT_GITHUB_SERVER_URL=${{ inputs.github_server_url }}" >> $GITHUB_ENV
118+
echo "INPUT_REPORT_NAME=${{ inputs.report_name }}" >> $GITHUB_ENV
119+
120+
- name: Execute script
121+
shell: bash
122+
id: script
123+
run: |
124+
bash "${{ github.action_path }}/script.sh"
File renamed without changes.

0 commit comments

Comments
 (0)