docs: update example gitlab-ci.yaml #668
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| --- | |
| name: 🚦 CI | |
| on: | |
| pull_request: | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| jobs: | |
| setup-matrix: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| build_matrix: ${{ steps.set-build-matrix.outputs.build_matrix }} | |
| steps: | |
| - name: Source checkout | |
| uses: actions/checkout@v6 | |
| - name: 'Setup yq' | |
| uses: dcarbone/install-yq-action@v1.3.1 | |
| - id: set-build-matrix | |
| run: echo "build_matrix=$(yq -o=json build_platforms.yaml | jq -c)" >> $GITHUB_OUTPUT | |
| build_ci_container: | |
| name: Build ${{ matrix.platform }} CI container | |
| runs-on: ${{ matrix.runner }} | |
| permissions: | |
| actions: read | |
| contents: read | |
| security-events: write | |
| pull-requests: write | |
| needs: setup-matrix | |
| strategy: | |
| matrix: ${{ fromJson(needs.setup-matrix.outputs.build_matrix) }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| - name: Build image | |
| uses: docker/build-push-action@v7 | |
| with: | |
| file: Containerfile | |
| tags: 'ci/voxbox:${{ matrix.openvox_version }}' | |
| push: false | |
| platforms: linux/${{ matrix.platform }} | |
| - name: Clone voxpupuli/puppet-example repository | |
| uses: actions/checkout@v6 | |
| with: | |
| repository: voxpupuli/puppet-example | |
| - name: Test container | |
| run: | | |
| docker run --rm -v $PWD:/repo:Z ci/voxbox:${{ matrix.openvox_version }} | |
| docker run --rm -v $PWD:/repo:Z ci/voxbox:${{ matrix.openvox_version }} lint | |
| docker run --rm -v $PWD:/repo:Z ci/voxbox:${{ matrix.openvox_version }} metadata_lint | |
| docker run --rm -v $PWD:/repo:Z ci/voxbox:${{ matrix.openvox_version }} r10k:dependencies | |
| docker run --rm -v $PWD:/repo:Z ci/voxbox:${{ matrix.openvox_version }} r10k:syntax | |
| docker run --rm -v $PWD:/repo:Z ci/voxbox:${{ matrix.openvox_version }} rubocop | |
| docker run --rm -v $PWD:/repo:Z ci/voxbox:${{ matrix.openvox_version }} spec | |
| docker run --rm -v $PWD:/repo:Z ci/voxbox:${{ matrix.openvox_version }} strings:validate:reference | |
| docker run --rm -v $PWD:/repo:Z ci/voxbox:${{ matrix.openvox_version }} syntax | |
| - name: Bundle Info | |
| run: | | |
| docker run --rm --entrypoint=ash ci/voxbox:${{ matrix.openvox_version }} -c "bundle check" | |
| docker run --rm --entrypoint=ash ci/voxbox:${{ matrix.openvox_version }} -c "bundle env" | |
| docker run --rm --entrypoint=ash ci/voxbox:${{ matrix.openvox_version }} -c "bundle outdated || true" | |
| tests: | |
| if: always() | |
| needs: | |
| - build_ci_container | |
| runs-on: ubuntu-24.04 | |
| name: Test suite | |
| steps: | |
| - name: Decide whether the needed jobs succeeded or failed | |
| uses: re-actors/alls-green@release/v1 | |
| with: | |
| jobs: ${{ toJSON(needs) }} | |
| dependabot: | |
| permissions: | |
| contents: write | |
| name: 'Dependabot auto-merge' | |
| needs: | |
| - tests | |
| runs-on: ubuntu-latest | |
| if: ${{ github.actor == 'dependabot[bot]' && github.event_name == 'pull_request'}} | |
| steps: | |
| - name: Dependabot metadata | |
| id: metadata | |
| uses: dependabot/fetch-metadata@v3.0.0 | |
| with: | |
| github-token: '${{ secrets.GITHUB_TOKEN }}' | |
| - name: Enable auto-merge for Dependabot PRs | |
| run: gh pr merge --auto --merge "$PR_URL" | |
| env: | |
| PR_URL: ${{github.event.pull_request.html_url}} | |
| GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} |