name: "library: test & release" on: push: branches: - 'master' tags-ignore: - '**' paths: - 'library/**' - '.github/workflows/library.release.yaml' - '.github/cr.yaml' pull_request: branches: - '**' tags-ignore: - '**' paths: - 'library/**' - '.github/workflows/library.release.yaml' - '.github/cr.yaml' jobs: common-lint: runs-on: ubuntu-latest outputs: changed: ${{ steps.list-changed.outputs.changed }} steps: - name: Checkout uses: actions/checkout@v2 with: fetch-depth: 0 - name: Install Helm uses: azure/setup-helm@v1 with: version: v3.5.3 - uses: actions/setup-python@v2 with: python-version: 3.7 - name: Set up chart-testing uses: helm/chart-testing-action@v2.0.1 - name: Run chart-testing (lint) id: lint if: steps.list-changed.outputs.changed == 'true' run: ct lint --config .github/ct-lint.yaml --chart-dirs 'library' common-test: runs-on: ubuntu-latest needs: common-lint steps: - name: Checkout uses: actions/checkout@v2 if: needs.common-lint.outputs.changed == 'true' with: fetch-depth: 0 - name: prep if: needs.common-lint.outputs.changed == 'true' run: | rm -Rf library/common-test/values.yaml touch library/common-test/values.yaml - name: Install Helm uses: azure/setup-helm@v1 if: needs.common-lint.outputs.changed == 'true' with: version: v3.5.3 - uses: actions/setup-python@v2 if: needs.common-lint.outputs.changed == 'true' with: python-version: 3.7 - name: Set up chart-testing uses: helm/chart-testing-action@v2.0.1 if: needs.common-lint.outputs.changed == 'true' - name: Create k3d cluster uses: nolar/setup-k3d-k3s@v1 if: needs.common-lint.outputs.changed == 'true' with: version: v1.19 - name: Run chart-testing (install) if: needs.common-lint.outputs.changed == 'true' run: ct install --config .github/ct-install.yaml --charts 'library/common-test' common-unittest: runs-on: ubuntu-latest needs: common-lint steps: - name: Checkout uses: actions/checkout@v2 with: fetch-depth: 0 - name: Install Dev tools run: sudo apt-get update && sudo apt-get install -y jq libjq-dev - name: Install Helm uses: azure/setup-helm@v1 with: version: v3.5.3 - name: Install Ruby uses: ruby/setup-ruby@v1 with: ruby-version: 2.7 - name: Install dependencies run: | export RUBYJQ_USE_SYSTEM_LIBRARIES=1 bundle install - name: Run tests run: | bundle exec m -r .tools/tests/charts pre-release: needs: [common-test, common-unittest] runs-on: ubuntu-latest outputs: release: ${{ steps.prep.outputs.release }} timeout-minutes: 5 steps: - name: Prepare id: prep run: | if [ "${{github.event_name}}" == "pull_request" ]; then echo ::set-output name=release::false else echo ::set-output name=release::true fi - name: Block concurrent jobs uses: softprops/turnstyle@v1 if: steps.prep.outputs.release == 'true' with: continue-after-seconds: 180 env: GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }} common-release: needs: pre-release runs-on: ubuntu-latest if: needs.pre-release.outputs.release == 'true' steps: - name: Block concurrent jobs uses: softprops/turnstyle@v1 with: continue-after-seconds: 180 env: GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }} - name: Checkout uses: actions/checkout@v2 with: fetch-depth: 0 token: ${{ secrets.BOT_TOKEN }} - name: Configure Git run: | git config user.name "TrueCharts-Bot" git config user.email "bot@truecharts.org" - name: Install Helm uses: azure/setup-helm@v1 with: version: v3.5.3 - name: Run chart-releaser uses: helm/chart-releaser-action@v1.2.0 with: config: .github/cr.yaml charts_dir: library env: CR_TOKEN: "${{ secrets.BOT_TOKEN }}"