Skip to content

Commit

Permalink
chore: update and improve workflows
Browse files Browse the repository at this point in the history
This changes the label requirement workflows and other code styling
related workflows to better align with the current state of the repo.

This also changes the rpm generation to hopefully be better than the
current generation as the current one does not generate anything when
tags are pushed
  • Loading branch information
Venefilyn committed Oct 11, 2024
1 parent 0cad386 commit 609717d
Show file tree
Hide file tree
Showing 9 changed files with 111 additions and 44 deletions.
10 changes: 5 additions & 5 deletions .github/label-commenter-config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,27 @@ comment:
Comment generated by an automation."

labels:
- name: tests-run-tier0
- name: tests/tier0
labeled:
pr:
body: /packit test --labels tier0

- name: tests-run-tier1
- name: tests/tier1
labeled:
pr:
body: /packit test --labels tier1

- name: tests-run-all
- name: tests/all
labeled:
pr:
body: /packit test

- name: tests-skip
- name: tests/skip
labeled:
pr:
body: This PR does not require integration tests to be run.

- name: tests-run-sanity
- name: tests/sanity
labeled:
pr:
body: /packit test --labels sanity
2 changes: 1 addition & 1 deletion .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Checklist
- [ ] PR has been tested manually in a VM (either author or reviewer)
- [ ] Jira issue has been made public if possible
- [ ] `[RHELC-]` or `[HMS-]` is part of the PR title <!-- For a proper sync with Jira -->
- [ ] GitHub label has been added to help with Release notes <!-- enhancement, bug-fix, no-changelog, security-hardening, breaking-change, test-coverage-enhancement -->
- [ ] Label depicting the kind of PR it is <!-- kind/breaking kind/feature kind/bug-fix kind/security kind/tests etc. -->
- [ ] PR title explains the change from the user's point of view
- [ ] Code and tests are documented properly
- [ ] The commits are squashed to as few commits as possible (without losing data) <!-- The commits can be squashed to 1 commit, but then we might lose data regarding moving something to a new file and then refactoring for example. Hence squash without losing data -->
Expand Down
10 changes: 8 additions & 2 deletions .github/release.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,32 @@
changelog:
exclude:
labels:
- no-changelog
- skip/changelog
authors:
- dependabot
- pre-commit-ci
- renovate
categories:
- title: Breaking Changes 🛠
labels:
- kind/breaking
- breaking-change
- title: Enhancements 🎉
labels:
- kind/feature
- enhancement
- title: Security Hardening 🔒
labels:
- kind/security
- security-hardening
- title: Bug Fixes 🐛
labels:
- kind/bug-fix
- bug-fix
- title: Test Coverage Enhancements 🔧
labels:
- kind/tests
- test-coverage-enhancement
- title: Other Changes
labels:
- "*"
- "kind/*"
2 changes: 1 addition & 1 deletion .github/renovate.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"**/*centos7*Containerfile",
".devcontainer/centos7/**"
],
"labels": ["no-changelog", "tests-skip"],
"labels": ["skip/changelog", "tests/skip"],
"packageRules": [
{
"matchPackageNames": [
Expand Down
73 changes: 73 additions & 0 deletions .github/workflows/build-rpm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
---
name: Build release RPMs

on:
push:
tags:
- "v*"
release:
types: [published]

jobs:
setup_version:
name: "Setup Convert2RHEL version"
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Get tag
if: ${{ github.event_name != 'release' }}
id: tag
uses: devops-actions/action-get-tag@v1.0.3
with:
strip_v: true # Optional: Remove 'v' character from version
default: v0.0.0 # Optional: Default version when tag not found

- name: Update specfile to match tag
if: ${{ github.event_name != 'release' }}
uses: richardrigutins/replace-in-files@v2
with:
files: "packaging/convert2rhel.spec"
search-text: "/(Version: +).*/gi"
replacement-text: "$1${{steps.tag.outputs.tag}}"

- name: Update convert2rhel version to match tag
if: ${{ github.event_name != 'release' }}
uses: richardrigutins/replace-in-files@v2
with:
files: "convert2rhel/__init__.py"
search-text: "/(__version__ += +).*/gi"
replacement-text: '$1"${{steps.tag.outputs.tag}}"'

- uses: actions/upload-artifact@v4
with:
name: github-repo
path: ""
retention-days: 1

build_rpms:
needs:
- setup_version
name: Build EL${{ matrix.el.ver }} RPM
strategy:
fail-fast: false
matrix:
el:
- ver: 7
- ver: 8
- ver: 9
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v4
with:
name: github-repo

- name: Build RPM package for EL${{ matrix.el.ver }}
run: |
make rpm${{ matrix.el.ver }}
- uses: shogo82148/actions-upload-release-asset@v1
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: .rpms/*el${{ matrix.el.ver }}*
2 changes: 1 addition & 1 deletion .github/workflows/build_images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,5 @@ jobs:
context: .
file: ./Containerfiles/${{ matrix.el.distro }}${{ matrix.el.ver }}.Containerfile
tags: ghcr.io/${{ github.repository_owner }}/convert2rhel-${{ matrix.el.distro }}:${{ matrix.el.ver }}
cache-from: type=registry,ref=ghcr.io/${{ github.repository_owner }}/convert2rhel-${{ matrix.el.distro }}${{ matrix.el.ver }}:latest
cache-from: type=registry,ref=ghcr.io/${{ github.repository_owner }}/convert2rhel-${{ matrix.el.distro }}:${{ matrix.el.ver }}
cache-to: type=inline
6 changes: 3 additions & 3 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: "CodeQL"

on:
push:
branches: [ "main" ]
branches: ["main"]
pull_request:
branches: [ "main" ]
branches: ["main"]
schedule:
- cron: "33 23 * * 0"

Expand All @@ -20,7 +20,7 @@ jobs:
strategy:
fail-fast: false
matrix:
language: [ python ]
language: [python]

steps:
- name: Checkout
Expand Down
25 changes: 19 additions & 6 deletions .github/workflows/enforce_labels.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,26 @@
name: Enforce PR labels
name: Require PR labels

on:
pull_request:
types: [labeled, unlabeled, opened, edited, synchronize]
types: [opened, labeled, unlabeled, synchronize]
jobs:
enforce-label:
if: github.actor != 'dependabot' || github.actor != 'pre-commit-ci'
require-type-label:
if: ${{ contains(fromJson('["dependabot", "pre-commit-ci", "renovate"]'), github.actor ) }}
runs-on: ubuntu-latest
steps:
- uses: yogevbd/enforce-label-action@2.2.2
- uses: mheap/github-action-required-labels@v5
with:
REQUIRED_LABELS_ANY: "breaking-change,bug-fix,documentation,enhancement,security-hardening,test-coverage-enhancement,no-changelog"
mode: exactly
count: 1
labels: "kind/.*"
use_regex: true
require-verification-label:
if: ${{ contains(fromJson('["dependabot", "pre-commit-ci", "renovate"]'), github.actor ) }}
runs-on: ubuntu-latest
steps:
- uses: mheap/github-action-required-labels@v5
with:
mode: exactly
count: 1
labels: "tests/.*"
use_regex: true
25 changes: 0 additions & 25 deletions .github/workflows/release.yml → .github/workflows/jira-links.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,10 @@
name: Build release RPMs & Handle release

on:
push:
tags: "*"
release:
types: [published]

jobs:
build_rpms:
name: Build EL${{ matrix.el.ver }} RPM
strategy:
fail-fast: false
matrix:
el:
- ver: 7
- ver: 8
- ver: 9
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Build RPM package for EL${{ matrix.el.ver }}
run: |
make rpm${{ matrix.el.ver }}
- uses: shogo82148/actions-upload-release-asset@v1
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: .rpms/*el${{ matrix.el.ver }}*

update_jira_links:
name: Update Jira links
if: ${{ github.event_name == 'release' }}
Expand Down

0 comments on commit 609717d

Please sign in to comment.