aboutsummaryrefslogtreecommitdiff
path: root/.github
diff options
context:
space:
mode:
authorAndrew Clemons <andrew.clemons@gmail.com>2022-08-05 22:38:16 +0900
committerWilly Sudiarto Raharjo <willysr@slackbuilds.org>2023-09-01 22:16:37 +0700
commit816f0baa0ddfb51c2bff92aee585a323e7acea4e (patch)
treeed3b1b6dfc9923adae4d734265651d22a49ee46f /.github
parent0ff385191756ee6b48ca9f4d053ec35f662f042d (diff)
github/workflows: Run sbolint as a github PR check.
Signed-off-by: Andrew Clemons <andrew.clemons@gmail.com> Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
Diffstat (limited to '.github')
-rw-r--r--.github/workflows/ci.yml107
1 files changed, 107 insertions, 0 deletions
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
new file mode 100644
index 0000000000000..89e223f21cd5b
--- /dev/null
+++ b/.github/workflows/ci.yml
@@ -0,0 +1,107 @@
+---
+name: PR checks
+
+"on":
+ pull_request_target:
+ types:
+ - opened
+ - synchronize
+ - reopened
+
+concurrency:
+ group: ci-${{ github.event.number }}
+ cancel-in-progress: false
+
+env:
+ SBO_MAINTAINER_TOOLS_NAME: aclemons/sbo-maintainer-tools
+ # renovate: datasource=docker depName=aclemons/sbo-maintainer-tools
+ SBO_MAINTAINER_TOOLS_VERSION: 0.9.0-15.0@sha256:bad368eb4e28aac3076c6775b4a8ec96f564434657a4b853f9f961cdeed88404
+
+jobs:
+ changes:
+ runs-on: ubuntu-22.04
+ permissions:
+ contents: read
+ outputs:
+ matrix: ${{ steps.set-matrix.outputs.matrix }}
+ steps:
+ - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
+ with:
+ fetch-depth: 2
+ ref: ${{ github.head_ref }}
+
+ - name: Get slackbuild directories which have changes.
+ id: changed-dirs
+ uses: tj-actions/changed-files@c860b5c47fa71f461da850094ef2f6e3d6514e44 # v38.1.3
+ with:
+ dir_names: true
+ dir_names_exclude_current_dir: true
+ dir_names_max_depth: 2
+ json: true
+ quotepath: false
+ files_ignore: .github/**
+
+ - name: List all changed files
+ run: echo '${{ steps.changed-dirs.outputs.all_changed_files }}'
+
+ - name: Get matrix output
+ id: set-matrix
+ run: |
+ {
+ printf 'matrix<<SLACKBUILDS\n'
+ jq -r -c 'map({dir: .})' <<< "${{ steps.changed-dirs.outputs.all_changed_files }}"
+ printf 'SLACKBUILDS\n'
+ } >> "$GITHUB_OUTPUT"
+
+ sbolint:
+ name: Checks with sbolint
+ runs-on: ubuntu-22.04
+ permissions:
+ contents: read
+ pull-requests: write
+ needs: [changes]
+ strategy:
+ matrix:
+ include: ${{ fromJSON(needs.changes.outputs.matrix) }}
+ steps:
+ - name: Set sbo maintainer tools docker image
+ run: |
+ printf 'DOCKER_IMAGE=%s:%s\n' "${{ env.SBO_MAINTAINER_TOOLS_NAME }}" "${{ env.SBO_MAINTAINER_TOOLS_VERSION }}" >> "$GITHUB_ENV"
+
+ - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
+ with:
+ ref: ${{ github.head_ref }}
+
+ - name: Run sbolint
+ run: |
+ docker pull ${{ env.DOCKER_IMAGE }}
+
+ mkfifo pipe
+ tee sbolint-output < pipe &
+ set +e
+
+ docker run --rm -v "$(pwd):/work" -w /work ${{ env.DOCKER_IMAGE }} sbolint "${{ matrix.dir }}" > pipe 2>&1
+
+ sbolint_status="$?"
+ set -e
+
+ {
+ if [[ "$sbolint_status" -eq 0 ]] ; then
+ printf '#### ✅ sbolint - %s\n\n' "${{ matrix.dir }} ✅"
+ else
+ printf '#### ⛔️ sbolint - %s\n\n' "${{ matrix.dir }} ⛔️"
+ fi
+
+ printf '```\n'
+ cat sbolint-output
+ rm sbolint-output
+ printf '```\n'
+ } > comment-output
+ shell:
+ bash
+
+ - name: Comment with sbolint results
+ uses: peter-evans/create-or-update-comment@c6c9a1a66007646a28c153e2a8580a5bad27bcfa # v3.0.2
+ with:
+ issue-number: ${{ github.event.number }}
+ body-path: comment-output