From e77a0300510d09dbe286b9f883438aad1a8fd3b8 Mon Sep 17 00:00:00 2001 From: Kjeld Schouten Date: Sun, 28 May 2023 19:28:55 +0200 Subject: [PATCH] fix(ci): find way to detect changed once (#9220) 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) - [ ] 🔃 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._ --------- Signed-off-by: Kjeld Schouten --- .github/actions/collect-changes/action.yaml | 10 ++-- .github/workflows/charts-lint.yaml | 15 +++++- .github/workflows/charts-test.yaml | 53 +++++---------------- .github/workflows/pr-validate.yaml | 5 +- charts/stable/jackett/Chart.yaml | 2 +- 5 files changed, 34 insertions(+), 51 deletions(-) diff --git a/.github/actions/collect-changes/action.yaml b/.github/actions/collect-changes/action.yaml index 0346308bb91..b12e66b0e76 100644 --- a/.github/actions/collect-changes/action.yaml +++ b/.github/actions/collect-changes/action.yaml @@ -42,13 +42,15 @@ runs: for CHARTPATH in "${PATHS[@]}" do IFS='/' read -r -a path_parts <<< "${CHARTPATH}" - CHARTS+=("${path_parts[1]}/${path_parts[2]}") + CHARTS+=("${path_parts[0]}/${path_parts[1]}/${path_parts[2]}") done # Remove duplicates CHARTS=( `printf "%s\n" "${CHARTS[@]}" | sort -u` ) # Set output to changed charts + echo "Changed charts: ${CHARTS[*]}" printf "::set-output name=addedOrModified::%s\n" "${CHARTS[*]}" + - name: Collect bumped charts after last tag id: filter-bumped-charts @@ -106,11 +108,9 @@ runs: # Remove duplicates CHARTS=( `printf "%s\n" "${CHARTS[@]}" | sort -u` ) - # Set output to changed charts - printf "::set-output name=addedOrModifiedAfterTag::%s\n" "${CHARTS[*]}" echo "Number of detected changed charts: ${#CHARTS[@]}" - if [ ${#CHARTS[@]} -eq 0 ] || [ "${CHARTS[0]}" = " " ] || [ "${CHARTS[0]}" = "/" ]; then + if [ ${#CHARTS[@]} -eq 0 ] || [ "${CHARTS[0]}" == ' ' ] || [ "${CHARTS[0]}" == '/' ]; then echo "No Changed Charts detected since latest tag..." printf "::set-output name=changesDetectedAfterTag::%s\n" "false" else @@ -120,7 +120,7 @@ runs: # Get only the chart paths # Set output to changed charts - echo "Changed charts: ${CHARTS[*]}" + echo "Changed charts since latest tag: ${CHARTS[*]}" printf "::set-output name=modifiedChartsAfterTag::%s\n" "${CHARTS[*]}" fi popd > /dev/null diff --git a/.github/workflows/charts-lint.yaml b/.github/workflows/charts-lint.yaml index 9016e73a38f..993c5388b0e 100644 --- a/.github/workflows/charts-lint.yaml +++ b/.github/workflows/charts-lint.yaml @@ -12,6 +12,9 @@ on: modifiedFiles: required: true type: string + modifiedCharts: + required: true + type: string jobs: lint-and-verify: @@ -23,7 +26,13 @@ jobs: - name: Checkout uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3 with: - fetch-depth: 0 + fetch-depth: 1 + ref: master + + - name: Checkout + uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3 + with: + fetch-depth: 1 ref: ${{ inputs.checkoutCommit }} - name: Setting repo parent dir as safe safe.directory @@ -42,7 +51,9 @@ jobs: if: inputs.chartChangesDetected == 'true' shell: bash run: | - CHARTS=$(ct list-changed --config .github/ct-lint.yaml) + CHARTS=${{ inputs.modifiedCharts }} + echo "Modified Charts: ${CHARTS}" + EXCLUDED_JSON=$(go-yq eval -o=json '.excluded-charts // []' .github/ct-lint.yaml) CHARTS_JSON=$(echo "${CHARTS}" | jq --raw-input '.' | jq --compact-output --slurp '.') OUTPUT_JSON=$(echo "{\"excluded\": ${EXCLUDED_JSON}, \"all\": ${CHARTS_JSON}}" | jq --compact-output '.all-.excluded') diff --git a/.github/workflows/charts-test.yaml b/.github/workflows/charts-test.yaml index 4b10238d43f..bfb0f579b8a 100644 --- a/.github/workflows/charts-test.yaml +++ b/.github/workflows/charts-test.yaml @@ -9,41 +9,11 @@ on: chartChangesDetected: required: true type: string + modifiedCharts: + required: true + type: string jobs: - unit-test: - name: Run unit tests - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3 - with: - fetch-depth: 0 - ref: ${{ inputs.checkoutCommit }} - - - name: Install Kubernetes tools - uses: yokawasa/action-setup-kube-tools@af4ebb1af1efd30c5bd84a2e9773355ad6362a33 # v0.9.3 - with: - setup-tools: | - helmv3 - helm: "3.8.0" - - - name: Install Ruby - uses: ruby/setup-ruby@v1 - with: - ruby-version: 2.7 - - - name: Install dependencies - env: - RUBYJQ_USE_SYSTEM_LIBRARIES: 1 - run: | - sudo apt-get update - sudo apt-get install libjq-dev - bundle install - - - name: Run tests - run: | - bundle exec m -r ./test/ generate-install-matrix: name: Generate matrix for install @@ -83,7 +53,7 @@ jobs: - name: Checkout uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3 with: - fetch-depth: 0 + fetch-depth: 1 ref: ${{ inputs.checkoutCommit }} - name: Set up chart-testing @@ -94,7 +64,8 @@ jobs: if: inputs.chartChangesDetected == 'true' run: | EXCLUDED=$(yq eval -o=json '.excluded-charts // []' .github/ct-install.yaml) - CHARTS=$(ct list-changed --config .github/ct-install.yaml) + CHARTS=${{ inputs.modifiedCharts }} + echo "Modified Charts: ${CHARTS}" CHARTS_JSON=$(echo "${CHARTS}" | jq -R -s -c 'split("\n")[:-1]') OUTPUT_JSON=$(echo "{\"excluded\": ${EXCLUDED}, \"all\": ${CHARTS_JSON}}" | jq -c '.all-.excluded') OUTPUT_JSON1=$((echo $OUTPUT_JSON | jq -r -c '.[:50]'; echo $OUTPUT_JSON | jq -r -c '.[301:350]'; echo $OUTPUT_JSON | jq -r -c '.[601:650]'; echo $OUTPUT_JSON | jq -r -c '.[901:950]'; echo $OUTPUT_JSON | jq -r -c '.[1201:1250]') | jq -s add) @@ -142,7 +113,7 @@ jobs: - name: Checkout uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3 with: - fetch-depth: 0 + fetch-depth: 1 ref: ${{ inputs.checkoutCommit }} - name: Install Kubernetes tools @@ -187,7 +158,7 @@ jobs: - name: Checkout uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3 with: - fetch-depth: 0 + fetch-depth: 1 ref: ${{ inputs.checkoutCommit }} - name: Install Kubernetes tools @@ -233,7 +204,7 @@ jobs: - name: Checkout uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3 with: - fetch-depth: 0 + fetch-depth: 1 ref: ${{ inputs.checkoutCommit }} - name: Install Kubernetes tools @@ -278,7 +249,7 @@ jobs: - name: Checkout uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3 with: - fetch-depth: 0 + fetch-depth: 1 ref: ${{ inputs.checkoutCommit }} - name: Install Kubernetes tools @@ -323,7 +294,7 @@ jobs: - name: Checkout uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3 with: - fetch-depth: 0 + fetch-depth: 1 ref: ${{ inputs.checkoutCommit }} - name: Install Kubernetes tools @@ -368,7 +339,7 @@ jobs: - name: Checkout uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3 with: - fetch-depth: 0 + fetch-depth: 1 ref: ${{ inputs.checkoutCommit }} - name: Install Kubernetes tools diff --git a/.github/workflows/pr-validate.yaml b/.github/workflows/pr-validate.yaml index d98f2bc82c3..1cacd072fca 100644 --- a/.github/workflows/pr-validate.yaml +++ b/.github/workflows/pr-validate.yaml @@ -30,8 +30,8 @@ jobs: with: checkoutCommit: ${{ needs.charts-changelog.outputs.commitHash }} chartChangesDetected: ${{ needs.pr-changes.outputs.addedOrModified }} - modifiedFiles: ${{ needs.pr-metadata.outputs.addedOrModifiedFiles }} - + modifiedFiles: ${{ needs.pr-changes.outputs.addedOrModifiedFiles }} + modifiedCharts: ${{ needs.pr-changes.outputs.addedOrModifiedCharts }} charts-test: uses: ./.github/workflows/charts-test.yaml needs: @@ -40,6 +40,7 @@ jobs: with: checkoutCommit: ${{ needs.charts-changelog.outputs.commitHash }} chartChangesDetected: ${{ needs.pr-changes.outputs.addedOrModified }} + modifiedCharts: ${{ needs.pr-changes.outputs.addedOrModifiedCharts }} catalog-test: uses: ./.github/workflows/catalog-test.yaml diff --git a/charts/stable/jackett/Chart.yaml b/charts/stable/jackett/Chart.yaml index 86584421139..d2bcdfc7272 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.25 +version: 14.0.26 annotations: truecharts.org/catagories: | - media