-
-
Notifications
You must be signed in to change notification settings - Fork 22
101 lines (99 loc) · 4.36 KB
/
base.yml
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
---
# SPDX-FileCopyrightText: (c) 2021 ale5000
# SPDX-License-Identifier: GPL-3.0-or-later
name: "Base"
permissions: {}
on:
push:
pull_request:
workflow_dispatch:
jobs:
base-job:
name: "Artifacts, coverage and testing"
runs-on: ubuntu-latest
steps:
- name: "Checkout sources"
uses: actions/checkout@v4
- name: Parse repo info
id: "repo-info"
run: |
# Parsing informations...
id="$(grep -m 1 -e '^id=' -- 'zip-content/module.prop' | cut -d '=' -f '2-' -s)" || exit "${?}"
version="$(grep -m 1 -e '^version=' -- 'zip-content/module.prop' | cut -d '=' -f '2-' -s)" || exit "${?}"
printf 'id=%s\n' "${id?}" >> "${GITHUB_OUTPUT?}"
printf 'version=%s\n' "${version?}" >> "${GITHUB_OUTPUT?}"
- name: "Setup Java"
uses: actions/setup-java@v4
with:
distribution: "temurin"
java-version: "17"
- name: "Setup Ruby"
uses: ruby/setup-ruby@v1
with:
ruby-version: "3.3"
- name: "Install Bashcov and simplecov-lcov"
run: |
# Installing Bashcov and simplecov-lcov...
gem install bashcov:3.1.3 simplecov-lcov
- name: "Build and coverage"
id: "build"
run: |
### Executing code coverage...
workspace_path='${{ github.workspace }}'; readonly workspace_path
export BUILD_TYPE=oss
#sudo apt-get -qq -y install moreutils 1>/dev/null
bashcov "${workspace_path:?}/build.sh" # To timestamp the output pipe it to: TZ=UTC ts '[%H:%M:%S]'
printf '\n'
### Testing of zip installation...
echo '==========================='
echo 'TESTING OF ZIP INSTALLATION'
echo '==========================='
bashcov "${workspace_path:?}/recovery-simulator/recovery.sh" "${workspace_path:?}"/output/*.zip
printf '\n'
echo '==============='
echo 'RECOVERY OUTPUT'
echo '==============='
if test -e "${workspace_path:?}/recovery-simulator/output/recovery-output.log"; then
cat "${workspace_path:?}/recovery-simulator/output/recovery-output.log"
fi
printf '\n'
echo '==============='
echo 'INSTALLED FILES'
echo '==============='
if test -e "${workspace_path:?}/recovery-simulator/output/installed-files.log"; then
cat "${workspace_path:?}/recovery-simulator/output/installed-files.log"
fi
- name: "ZIP info"
run: |
# Retrieve informations...
ZIP_FOLDER='${{ steps.build.outputs.ZIP_FOLDER }}'
ZIP_FILENAME='${{ steps.build.outputs.ZIP_FILENAME }}'
ZIP_VERSION='${{ steps.build.outputs.ZIP_VERSION }}'
ZIP_SHORT_COMMIT_ID='${{ steps.build.outputs.ZIP_SHORT_COMMIT_ID }}'
ZIP_SHA256='${{ steps.build.outputs.ZIP_SHA256 }}'
ZIP_MD5='${{ steps.build.outputs.ZIP_MD5 }}'
# Displaying informations...
printf '%s\n' "::notice::Filename: ${ZIP_FILENAME:-Missing}"
printf '%s\n' "::notice::Version: ${ZIP_VERSION:-Missing}"
printf '%s\n' "::notice::Short commit ID: ${ZIP_SHORT_COMMIT_ID:-Missing}"
printf '%s\n' "::notice::SHA-256: ${ZIP_SHA256:-Missing}"
printf '%s\n' "::notice::MD5: ${ZIP_MD5:-Missing}"
: "${ZIP_FOLDER:?}" || exit "${?}"
- name: "Upload artifacts"
if: "${{ github.event_name != 'pull_request' }}"
uses: actions/upload-artifact@v4
with:
name: "${{ steps.repo-info.outputs.id }}-${{ steps.repo-info.outputs.version }}-${{ steps.build.outputs.ZIP_SHORT_COMMIT_ID }}-oss archive (extract it)"
path: "${{ steps.build.outputs.ZIP_FOLDER }}/*.zip*"
retention-days: 7
- name: "Upload coverage reports to Codacy"
if: "${{ github.ref == 'refs/heads/main' && github.event_name != 'pull_request' && github.repository_owner == 'micro5k' }}"
uses: codacy/codacy-coverage-reporter-action@v1
with:
project-token: "${{ secrets.CODACY_PROJECT_TOKEN }}"
- name: "Upload coverage reports to Codecov"
if: "${{ github.ref == 'refs/heads/main' && github.event_name != 'pull_request' && github.repository_owner == 'micro5k' }}"
uses: codecov/codecov-action@v5
with:
fail_ci_if_error: true
token: "${{ secrets.CODECOV_TOKEN }}"