Skip to content

Commit

Permalink
chore: updates actions on the python-push.yml (#30)
Browse files Browse the repository at this point in the history
* chore: removes windows dev tool install from python-push.yml

Signed-off-by: Jennifer Power <barnabei.jennifer@gmail.com>

* chore: removes direct-merge-action from python-push.yml

Signed-off-by: Jennifer Power <barnabei.jennifer@gmail.com>

* ci: removes sonar job and combines lint and test into build

This alter the CI Trestle Deploy workflow to match the
compliance-trestle workflow

Signed-off-by: Jennifer Power <barnabei.jennifer@gmail.com>

---------

Signed-off-by: Jennifer Power <barnabei.jennifer@gmail.com>
  • Loading branch information
jpower432 authored Mar 7, 2024
1 parent 3bb0291 commit bffa6ed
Showing 1 changed file with 41 additions and 119 deletions.
160 changes: 41 additions & 119 deletions .github/workflows/python-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,53 +8,7 @@ on:
- main

jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Don't mess with line endings
run: |
git config --global core.autocrlf false
- name: Don't mess with line endings
run: |
git config --global core.autocrlf false
- uses: actions/checkout@v2
with:
submodules: true
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.9
- uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ubuntu-latest-3.9-pip-${{ hashFiles('setup.cfg') }}
restore-keys: |
ubuntu-latest-3.9-pip-
- name: Install build tools
run: |
make develop
- name: Setup pre-commit
run: |
make pre-commit
- name: Install dependencies
run: |
make install
- name: Run md document formatting (mdformat)
run: |
make mdformat
- name: Run code formatting (yapf)
run: |
make code-format
- name: Run code linting (flake8)
run: |
make code-lint
- name: Run code typing check (mypy)
continue-on-error: true
run: |
make code-typing
test:
# This test
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
Expand All @@ -74,7 +28,6 @@ jobs:
git config --global core.autocrlf false
- uses: actions/checkout@v2
with:
fetch-depth: 0
submodules: true
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
Expand All @@ -87,14 +40,33 @@ jobs:
restore-keys: |
${{ matrix.os }}-${{ matrix.python-version }}-pip-
# Windows Dev tools
- name: Install microsoft dev tools
if: ${{ matrix.os == 'windows-latest' }}
uses: ilammy/msvc-dev-cmd@v1

- name: Install build tools
run: |
make develop
- name: Setup pre-commit
if: ${{ (matrix.os == 'ubuntu-latest' && matrix.python-version == '3.8') }}
run: |
make pre-commit
- name: Install dependencies
run: |
make install
- name: Run md document formatting (mdformat)
if: ${{ (matrix.os == 'ubuntu-latest' && matrix.python-version == '3.8') }}
run: |
make mdformat
- name: Run code formatting (yapf)
if: ${{ (matrix.os == 'ubuntu-latest' && matrix.python-version == '3.8') }}
run: |
make code-format
- name: Run code linting (flake8)
if: ${{ (matrix.os == 'ubuntu-latest' && matrix.python-version == '3.8') }}
run: |
make code-lint
- name: Run code typing check (mypy)
if: ${{ (matrix.os == 'ubuntu-latest' && matrix.python-version == '3.8') }}
continue-on-error: true
run: |
make code-typing
- name: Pytest Fast
if: ${{ !(matrix.os == 'ubuntu-latest' && matrix.python-version == '3.8') }}
run: |
Expand All @@ -104,68 +76,9 @@ jobs:
run: |
make test-cov
- name: Upload artifact
if: ${{ matrix.os == 'ubuntu-latest' && matrix.python-version == '3.8' }}
uses: actions/upload-artifact@v2
with:
name: coverage
path: coverage.xml

sonar:
if: github.repository == 'IBM/compliance-trestle-fedramp'
runs-on: ubuntu-latest
needs: test
steps:
- name: Don't mess with line endings
run: |
git config --global core.autocrlf false
- name: Don't mess with line endings
run: |
git config --global core.autocrlf false
- uses: actions/checkout@v2
with:
submodules: true
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.8
- uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ubuntu-latest-3.9-pip-${{ hashFiles('setup.cfg') }}
restore-keys: |
ubuntu-latest-3.9-pip-
- name: Install build tools
run: |
make develop
- name: Get coverage
uses: actions/download-artifact@v2
with:
name: coverage
- name: SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
with:
args: >
-Dsonar.python.coverage.reportPaths=coverage.xml
-Dsonar.tests=tests/
-Dsonar.sources=trestle_fedramp/
-Dsonar.python.version=3.8
-Dsonar.projectKey=compliance-trestle-fedramp
-Dsonar.organization=compliance-trestle
- name: SonarQube Quality Gate check
uses: sonarsource/sonarqube-quality-gate-action@master
# Force to fail step after specific time
timeout-minutes: 5
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

deploy:

runs-on: ubuntu-latest
needs: sonar
needs: build
if: github.ref == 'refs/heads/main' && github.repository == 'IBM/compliance-trestle-fedramp'
steps:
- uses: actions/checkout@v2
Expand All @@ -192,15 +105,24 @@ jobs:
name: Merge main -> develop
runs-on: ubuntu-latest
needs: deploy
concurrency:
concurrency:
group: ${{ github.ref }}-${{ github.workflow }}-${{ github.job }}-main
cancel-in-progress: true
if: github.ref == 'refs/heads/main'
steps:
- uses: tukasz/direct-merge-action@master
- uses: actions/checkout@v2
with:
GITHUB_TOKEN: ${{ secrets.ADMIN_PAT }}
source-branch: main
target-branch: develop
commit-message: "chore: Merge back version tags and changelog into develop."
submodules: true
ref: main
fetch-depth: 0
token: ${{ secrets.ADMIN_PAT }}
- name: Configure Git
run: |
git config user.name "Vikas Agarwal"
git config user.email "<>"
- name: Merge Main to Develop
run: |
git checkout develop
git merge --no-ff main -m "chore: Merge back version tags and changelog into develop."
git push origin develop

0 comments on commit bffa6ed

Please sign in to comment.