From 8b91e1e0def5a21c35a6ca0c950b84fbc2d817a9 Mon Sep 17 00:00:00 2001 From: Stavros Kois <47820033+stavros-k@users.noreply.github.com> Date: Tue, 30 May 2023 13:54:44 +0300 Subject: [PATCH] chore(ci): Add some checks to tc-lint.sh and update chart-tests to GITHUB_OUTPUT (#9289) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit **Description** ⚒️ Fixes # **⚙️ Type of change** - [ ] ⚙️ Feature/App addition - [ ] 🪛 Bugfix - [ ] ⚠️ Breaking change (fix or feature that would cause existing functionality to not work as expected) - [x] 🔃 Refactor of current code **🧪 How Has This Been Tested?** **📃 Notes:** **✔️ Checklist:** - [ ] ⚖️ My code follows the style guidelines of this project - [ ] 👀 I have performed a self-review of my own code - [ ] #️⃣ I have commented my code, particularly in hard-to-understand areas - [ ] 📄 I have made corresponding changes to the documentation - [ ] ⚠️ My changes generate no new warnings - [ ] 🧪 I have added tests to this description that prove my fix is effective or that my feature works - [ ] ⬆️ I increased versions for any altered app according to semantic versioning **➕ App addition** If this PR is an app addition please make sure you have done the following. - [ ] 🪞 I have opened a PR on [truecharts/containers](https://github.com/truecharts/containers) adding the container to TrueCharts mirror repo. - [ ] 🖼️ I have added an icon in the Chart's root directory called `icon.png` --- _Please don't blindly check all the boxes. Read them and only check those that apply. Those checkboxes are there for the reviewer to see what is this all about and the status of this PR with a quick glance._ --- .github/scripts/tc-lint.sh | 29 +++++++++++- .github/workflows/charts-lint.yaml | 11 +++-- .github/workflows/charts-test.yaml | 75 +++++++++++++++--------------- charts/stable/jackett/Chart.yaml | 2 +- charts/stable/sonarr/Chart.yaml | 2 +- 5 files changed, 73 insertions(+), 46 deletions(-) diff --git a/.github/scripts/tc-lint.sh b/.github/scripts/tc-lint.sh index e7831282713..02d6d59a0fe 100755 --- a/.github/scripts/tc-lint.sh +++ b/.github/scripts/tc-lint.sh @@ -15,7 +15,7 @@ function check_version() { if [[ -n "$new" ]]; then echo -e "\t🔙 Old Chart Version: $old" echo -e "\t🆕 New Chart Version: $new" - + if [[ $(echo "$new\n$old" | sort -V -r | head -n1) != "$old" ]]; then echo -e "\t✅ Chart version: Bumped" else @@ -142,6 +142,33 @@ exit_code=0 result_file=${result_file:?"No result file provided"} +rm -f "$status_file" +rm -f "$status_file" + +command -v yamale >/dev/null 2>&1 || { + printf >&2 "%s\n" "yamale (https://github.com/23andMe/Yamale#pip) is not installed. Aborting." + printf >&2 "%s\n" "Install it with 'pip install yamale'" + exit 1 +} + +command -v yamllint >/dev/null 2>&1 || { + printf >&2 "%s\n" "yamllint (https://yamllint.readthedocs.io/en/stable/quickstart.html#installing-yamllint) is not installed. Aborting." + printf >&2 "%s\n" "Install it with 'pip install yamllint'" + exit 1 +} + +command -v helm >/dev/null 2>&1 || { + printf >&2 "%s\n" "helm (https://helm.sh/docs/intro/install) is not installed. Aborting." + printf >&2 "%s\n" "Install it with 'curl https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | bash'" + exit 1 +} + +command -v parallel >/dev/null 2>&1 || { + printf >&2 "%s\n" "parallel (https://www.gnu.org/software/parallel) is not installed. Aborting." + printf >&2 "%s\n" "Install it with 'sudo apt install parallel'" + exit 1 +} + changed=$(echo $charts | jq --raw-output '.[]') echo "📂 Charts to lint:" diff --git a/.github/workflows/charts-lint.yaml b/.github/workflows/charts-lint.yaml index 5a82255908f..347ff641bc4 100644 --- a/.github/workflows/charts-lint.yaml +++ b/.github/workflows/charts-lint.yaml @@ -21,13 +21,13 @@ jobs: name: Lint Charts and Verify Dependencies runs-on: ubuntu-latest steps: - - name: Checkout + - name: Checkout [master] uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3 with: fetch-depth: 1 ref: master - - name: Checkout + - name: Checkout [commit] uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3 with: fetch-depth: 1 @@ -35,14 +35,14 @@ jobs: - name: Setting repo parent dir as safe safe.directory run: git config --global --add safe.directory "$GITHUB_WORKSPACE" - + - name: Install go-yq run: | mkdir -p $HOME/.local/bin wget https://github.com/mikefarah/yq/releases/download/v4.26.1/yq_linux_amd64 -O $HOME/.local/bin/go-yq && \ chmod +x $HOME/.local/bin/go-yq echo "$HOME/.local/bin" >> $GITHUB_PATH - + - name: Install pre-commit, yamale and yamllint run: | pip3 install --no-cache-dir pre-commit yamale yamllint @@ -71,9 +71,10 @@ jobs: if [[ $(echo ${OUTPUT_JSON} | jq --compact-output '. | length') -gt 0 ]]; then echo "detected=true" >> "$GITHUB_OUTPUT" fi - + - name: Test and Fix Pre-Commit Issues shell: bash + # TODO: Only run pre-commit on changed files if: inputs.chartChangesDetected == 'true' run: | echo "Running pre-commit test-and-cleanup..." diff --git a/.github/workflows/charts-test.yaml b/.github/workflows/charts-test.yaml index bc7d59298ef..027fe27a89b 100644 --- a/.github/workflows/charts-test.yaml +++ b/.github/workflows/charts-test.yaml @@ -14,7 +14,6 @@ on: type: string jobs: - generate-install-matrix: name: Generate matrix for install runs-on: ubuntu-latest @@ -55,7 +54,7 @@ jobs: with: fetch-depth: 1 ref: ${{ inputs.checkoutCommit }} - + - name: Install go-yq run: | mkdir -p $HOME/.local/bin @@ -79,29 +78,29 @@ jobs: OUTPUT_JSON4=$((echo $OUTPUT_JSON | jq -r -c '.[151:200]'; echo $OUTPUT_JSON | jq -r -c '.[451:500]'; echo $OUTPUT_JSON | jq -r -c '.[751:800]'; echo $OUTPUT_JSON | jq -r -c '.[1051:1100]'; echo $OUTPUT_JSON | jq -r -c '.[1351:1400]') | jq -s add) OUTPUT_JSON5=$((echo $OUTPUT_JSON | jq -r -c '.[201:250]'; echo $OUTPUT_JSON | jq -r -c '.[501:550]'; echo $OUTPUT_JSON | jq -r -c '.[801:850]'; echo $OUTPUT_JSON | jq -r -c '.[1101:1150]'; echo $OUTPUT_JSON | jq -r -c '.[1401:1450]') | jq -s add) OUTPUT_JSON6=$((echo $OUTPUT_JSON | jq -r -c '.[251:300]'; echo $OUTPUT_JSON | jq -r -c '.[551:600]'; echo $OUTPUT_JSON | jq -r -c '.[851:900]'; echo $OUTPUT_JSON | jq -r -c '.[1151:1200]'; echo $OUTPUT_JSON | jq -r -c '.[1451:1500]') | jq -s add) - echo ::set-output name=charts1::${OUTPUT_JSON1} - echo ::set-output name=charts2::${OUTPUT_JSON2} - echo ::set-output name=charts3::${OUTPUT_JSON3} - echo ::set-output name=charts4::${OUTPUT_JSON4} - echo ::set-output name=charts5::${OUTPUT_JSON5} - echo ::set-output name=charts6::${OUTPUT_JSON6} + echo charts1=${OUTPUT_JSON1} >> $GITHUB_OUTPUT + echo charts2=${OUTPUT_JSON2} >> $GITHUB_OUTPUT + echo charts3=${OUTPUT_JSON3} >> $GITHUB_OUTPUT + echo charts4=${OUTPUT_JSON4} >> $GITHUB_OUTPUT + echo charts5=${OUTPUT_JSON5} >> $GITHUB_OUTPUT + echo charts6=${OUTPUT_JSON6} >> $GITHUB_OUTPUT if [[ $(echo ${OUTPUT_JSON1} | jq -c '. | length') -gt 0 ]]; then - echo "::set-output name=detected1::true" + echo "detected1=true" >> $GITHUB_OUTPUT fi if [[ $(echo ${OUTPUT_JSON2} | jq -c '. | length') -gt 0 ]]; then - echo "::set-output name=detected2::true" + echo "detected2=true" >> $GITHUB_OUTPUT fi if [[ $(echo ${OUTPUT_JSON3} | jq -c '. | length') -gt 0 ]]; then - echo "::set-output name=detected3::true" + echo "detected3=true" >> $GITHUB_OUTPUT fi if [[ $(echo ${OUTPUT_JSON4} | jq -c '. | length') -gt 0 ]]; then - echo "::set-output name=detected4::true" + echo "detected4=true" >> $GITHUB_OUTPUT fi if [[ $(echo ${OUTPUT_JSON5} | jq -c '. | length') -gt 0 ]]; then - echo "::set-output name=detected5::true" + echo "detected5=true" >> $GITHUB_OUTPUT fi if [[ $(echo ${OUTPUT_JSON6} | jq -c '. | length') -gt 0 ]]; then - echo "::set-output name=detected6::true" + echo "detected6=true" >> $GITHUB_OUTPUT fi install-charts1: @@ -126,11 +125,11 @@ jobs: with: setup-tools: | helmv3 - helm: "3.8.0" + helm: "3.9.4" - uses: actions/setup-python@bd6b4b6205c4dbad673328db7b31b7fab9e241c0 # v4 with: - python-version: "3.10" + python-version: "3.11" - name: Set up chart-testing uses: helm/chart-testing-action@e8788873172cb653a90ca2e819d79d65a66d4e76 # v2.4.0 @@ -171,11 +170,11 @@ jobs: with: setup-tools: | helmv3 - helm: "3.8.0" + helm: "3.9.4" - uses: actions/setup-python@bd6b4b6205c4dbad673328db7b31b7fab9e241c0 # v4 with: - python-version: "3.10" + python-version: "3.11" - name: Set up chart-testing uses: helm/chart-testing-action@e8788873172cb653a90ca2e819d79d65a66d4e76 # v2.4.0 @@ -217,11 +216,11 @@ jobs: with: setup-tools: | helmv3 - helm: "3.8.0" + helm: "3.9.4" - uses: actions/setup-python@bd6b4b6205c4dbad673328db7b31b7fab9e241c0 # v4 with: - python-version: "3.10" + python-version: "3.11" - name: Set up chart-testing uses: helm/chart-testing-action@e8788873172cb653a90ca2e819d79d65a66d4e76 # v2.4.0 @@ -262,11 +261,11 @@ jobs: with: setup-tools: | helmv3 - helm: "3.8.0" + helm: "3.9.4" - uses: actions/setup-python@bd6b4b6205c4dbad673328db7b31b7fab9e241c0 # v4 with: - python-version: "3.10" + python-version: "3.11" - name: Set up chart-testing uses: helm/chart-testing-action@e8788873172cb653a90ca2e819d79d65a66d4e76 # v2.4.0 @@ -307,11 +306,11 @@ jobs: with: setup-tools: | helmv3 - helm: "3.8.0" + helm: "3.9.4" - uses: actions/setup-python@bd6b4b6205c4dbad673328db7b31b7fab9e241c0 # v4 with: - python-version: "3.10" + python-version: "3.11" - name: Set up chart-testing uses: helm/chart-testing-action@e8788873172cb653a90ca2e819d79d65a66d4e76 # v2.4.0 @@ -352,11 +351,11 @@ jobs: with: setup-tools: | helmv3 - helm: "3.8.0" + helm: "3.9.4" - uses: actions/setup-python@bd6b4b6205c4dbad673328db7b31b7fab9e241c0 # v4 with: - python-version: "3.10" + python-version: "3.11" - name: Set up chart-testing uses: helm/chart-testing-action@e8788873172cb653a90ca2e819d79d65a66d4e76 # v2.4.0 @@ -399,43 +398,43 @@ jobs: res6="${{needs.install-charts6.result}}" if [[ $res1 == "success" || $res1 == "skipped" ]]; then - echo "install tests 1 successfull..." + echo "Install test suite [1] was successful..." else - echo "install tests 1 error, stopping due to failure..." + echo "Install test suite [1] failed, stopping..." exit 1 fi if [[ $res2 == "success" || $res2 == "skipped" ]]; then - echo "install tests 2 successfull..." + echo "Install test suite [2] was successful..." else - echo "install tests 2 error, stopping due to failure..." + echo "Install test suite [2] failed, stopping..." exit 1 fi if [[ $res3 == "success" || $res3 == "skipped" ]]; then - echo "install tests 3 successfull..." + echo "Install test suite [3] was successful..." else - echo "install tests 3 error, stopping due to failure..." + echo "Install test suite [3] failed, stopping..." exit 1 fi if [[ $res4 == "success" || $res4 == "skipped" ]]; then - echo "install tests 4 successfull..." + echo "Install test suite [4] was successful..." else - echo "install tests 4 error, stopping due to failure..." + echo "Install test suite [4] failed, stopping..." exit 1 fi if [[ $res5 == "success" || $res5 == "skipped" ]]; then - echo "install tests 5 successfull..." + echo "Install test suite [5] was successful..." else - echo "install tests 5 error, stopping due to failure..." + echo "Install test suite [5] failed, stopping..." exit 1 fi if [[ $res6 == "success" || $res6 == "skipped" ]]; then - echo "install tests 6 successfull..." + echo "Install test suite [6] was successful..." else - echo "install tests 6 error, stopping due to failure..." + echo "Install test suite [6] failed, stopping..." exit 1 fi diff --git a/charts/stable/jackett/Chart.yaml b/charts/stable/jackett/Chart.yaml index be63977f04f..cc4f8a5093b 100644 --- a/charts/stable/jackett/Chart.yaml +++ b/charts/stable/jackett/Chart.yaml @@ -22,7 +22,7 @@ sources: - https://github.com/truecharts/charts/tree/master/charts/stable/jackett - https://github.com/Jackett/Jackett type: application -version: 14.0.28 +version: 14.0.29 annotations: truecharts.org/catagories: | - media diff --git a/charts/stable/sonarr/Chart.yaml b/charts/stable/sonarr/Chart.yaml index 6b1aea85edb..1ec6771fa5a 100644 --- a/charts/stable/sonarr/Chart.yaml +++ b/charts/stable/sonarr/Chart.yaml @@ -22,7 +22,7 @@ sources: - https://github.com/truecharts/charts/tree/master/charts/stable/sonarr - https://github.com/Sonarr/Sonarr type: application -version: 15.0.21 +version: 15.0.22 annotations: truecharts.org/catagories: | - media