Skip to content

Commit 250bb09

Browse files
pvitalCagriYonca
authored andcommitted
ci: Add Ruff linter as GitHub Action.
Executes Ruff as linter tool to check code pattern. Signed-off-by: Paulo Vital <paulo.vital@ibm.com>
1 parent 0a0dc38 commit 250bb09

3 files changed

Lines changed: 74 additions & 0 deletions

File tree

.github/workflows/linter.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
name: Ruff
2+
on: [ push, pull_request ]
3+
jobs:
4+
ruff:
5+
runs-on: ubuntu-latest
6+
steps:
7+
- uses: actions/checkout@v4
8+
- uses: astral-sh/ruff-action@v3
9+
with:
10+
src: >-
11+
./src
12+
./tests
13+
./tests-aws
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Slack Post
2+
on:
3+
workflow_dispatch: # Manual trigger
4+
inputs:
5+
github_ref:
6+
description: 'Manually provided value for GITHUB_RELEASE_TAG of a release'
7+
required: true
8+
type: string
9+
10+
# https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#release
11+
release:
12+
types: [published]
13+
jobs:
14+
build:
15+
name: Slack Post
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: 'Checkout the needed file only ./bin/announce_release_on_slack.py'
19+
uses: actions/checkout@v4
20+
- run: |
21+
if [[ ${{ github.event_name == 'workflow_dispatch' }} == true ]]; then
22+
export GITHUB_RELEASE_TAG=${{ inputs.github_ref }}
23+
else # release event
24+
export GITHUB_RELEASE_TAG=$(basename ${GITHUB_REF})
25+
fi
26+
echo "New release published ${GITHUB_RELEASE_TAG}"
27+
pip3 install PyGithub
28+
echo $PWD
29+
ls -lah
30+
./bin/announce_release_on_slack.py
31+
env:
32+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
33+
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
34+
SLACK_CHANNEL_ID_RELEASES: ${{ secrets.SLACK_CHANNEL_ID_RELEASES }}

.github/workflows/sonarqube.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Build
2+
on:
3+
push:
4+
branches:
5+
- main # or the name of your main branch
6+
pull_request:
7+
types: [opened, synchronize, reopened]
8+
jobs:
9+
build:
10+
name: Build
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
with:
15+
fetch-depth: 0
16+
- uses: sonarsource/sonarqube-scan-action@master
17+
env:
18+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
19+
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
20+
# If you wish to fail your job when the Quality Gate is red, uncomment the
21+
# following lines. This would typically be used to fail a deployment.
22+
# We do not recommend to use this in a pull request. Prefer using pull request
23+
# decoration instead.
24+
# - uses: sonarsource/sonarqube-quality-gate-action@master
25+
# timeout-minutes: 5
26+
# env:
27+
# SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

0 commit comments

Comments
 (0)