Skip to content

Commit

Permalink
feat(action): Run under Fedora minimal via Docker
Browse files Browse the repository at this point in the history
  • Loading branch information
EyeCantCU committed Dec 20, 2023
1 parent 3ae9a21 commit c5d3243
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 30 deletions.
5 changes: 5 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM quay.io/fedora/fedora-minimal:39

COPY rpmlint.sh /tmp/rpmlint.sh

ENTRYPOINT ["/tmp/rpmlint.sh"]
46 changes: 16 additions & 30 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,33 +42,19 @@ inputs:
description: 'Treat individual errors as non-fatal'
required: false
runs:
using: "composite"
steps:
- name: Install rpmlint
shell: bash
run: sudo apt -qq install rpmlint > /dev/null

- name: Perform rpmlint
shell: bash
run: |
ARGUMENTS=""
if [[ -n "${{ inputs.help }}" ]]; then ARGUMENTS+=" -h "; fi
if [[ -n "${{ inputs.version }}" ]]; then ARGUMENTS+=" -V "; fi
if [[ -n "${{ inputs.config }}" ]]; then ARGUMENTS+=" -c ${{ inputs.config }} "; fi
if [[ -n "${{ inputs.explain }}" ]]; then ARGUMENTS+=" -e ${{ inputs.explain }} "; fi
if [[ -n "${{ inputs.rpmlintrc }}" ]]; then ARGUMENTS+=" -r ${{ inputs.rpmlintrc }} "; fi
if [[ -n "${{ inputs.verbose }}" ]]; then ARGUMENTS+=" -v "; fi
if [[ -n "${{ inputs.print-config }}" ]]; then ARGUMENTS+=" -p "; fi
if [[ -n "${{ inputs.installed }}" ]]; then ARGUMENTS+=" -i ${{ inputs.installed }} "; fi
if [[ -n "${{ inputs.time-report }}" ]]; then ARGUMENTS+=" -t "; fi
if [[ -n "${{ inputs.profile }}" ]]; then ARGUMENTS+=" -T "; fi
if [[ -n "${{ inputs.strict }}" ]]; then ARGUMENTS+=" -s "; fi
if [[ -n "${{ inputs.permissive }}" ]]; then ARGUMENTS+=" -p "; fi
ARGUMENTS=$(echo "$ARGUMENTS" | xargs)
if [[ -n "${{ inputs.rpmfiles }}" ]]; then
rpmlint $ARGUMENTS ${RPMFILES[@]}
else
rpmlint $ARGUMENTS
fi
env:
RPMFILES: ${{ inputs.rpmfiles }}
using: "docker"
image: "Dockerfile"
env:
RPMFILES: ${{ inputs.rpmfiles }}
HELP: ${{ inputs.help }}
VERSION: ${{ inputs.version }}
CONFIG: ${{ inputs.config }}
EXPLAIN: ${{ inputs.explain }}
RPMLINTRC: ${{ inputs.rpmlintrc }}
VERBOSE: ${{ inputs.verbose }}
PRINT_CONFIG: ${{ inputs.print-config }}
INSTALLED: ${{ inputs.installed }}
TIME_REPORT: ${{ inputs.time-report }}
PROFILE: ${{ inputs.profile }}
STRICT: ${{ inputs.strict }}
PERMISSIVE: ${{ inputs.permissive }}
29 changes: 29 additions & 0 deletions rpmlint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/usr/bin/bash

# Install rpmlint
dnf5 install -qy rpmlint > /dev/null

# Parse arguments
ARGUMENTS=""
if [[ -n "${HELP}" ]]; then ARGUMENTS+=" -h "; fi
if [[ -n "${VERSION}" ]]; then ARGUMENTS+=" -V "; fi
if [[ -n "${CONFIG}" ]]; then ARGUMENTS+=" -c ${CONFIG} "; fi
if [[ -n "${EXPLAIN}" ]]; then ARGUMENTS+=" -e ${EXPLAIN} "; fi
if [[ -n "${RPMLINTRC}" ]]; then ARGUMENTS+=" -r ${RPMLINTRC} "; fi
if [[ -n "${VERBOSE}" ]]; then ARGUMENTS+=" -v "; fi
if [[ -n "${PRINT_CONFIG}" ]]; then ARGUMENTS+=" -p "; fi
if [[ -n "${INSTALLED}" ]]; then ARGUMENTS+=" -i ${INSTALLED} "; fi
if [[ -n "${TIME_REPORT}" ]]; then ARGUMENTS+=" -t "; fi
if [[ -n "${PROFILE}" ]]; then ARGUMENTS+=" -T "; fi
if [[ -n "${STRICT}" ]]; then ARGUMENTS+=" -s "; fi
if [[ -n "${PERMISSIVE}" ]]; then ARGUMENTS+=" -p "; fi

# Format arguments
ARGUMENTS=$(echo "$ARGUMENTS" | xargs)

# Perform rpmlint
if [[ -n "${RPMFILES}" ]]; then
rpmlint $ARGUMENTS ${RPMFILES[@]}
else
rpmlint $ARGUMENTS
fi

0 comments on commit c5d3243

Please sign in to comment.