Skip to content

Commit

Permalink
Experiemental move to action
Browse files Browse the repository at this point in the history
  • Loading branch information
AlanCoding committed Feb 24, 2024
1 parent 718946c commit 8fa2b42
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 29 deletions.
49 changes: 49 additions & 0 deletions .github/actions/dab_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Setup images for AWX
description: Builds new awx_devel image
inputs:
github-token:
description: GitHub Token for registry access
required: true
sonar-token:
description: the SonarCloud token
required: true
python-version:
description: Python version
required: true
tox-env:
description: the tox environment to run
required: true
runs:
using: composite
steps:
- name: Install build requirements
run: sudo apt-get update && sudo apt-get install -y libsasl2-dev libldap2-dev libssl-dev libxmlsec1-dev

- name: Install python ${{ python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ python-version }}

- name: Install tox
run: pip${{ python-version }} install tox

- name: Run tox
run: tox -e ${{ tox-env }}

- name: Inject PR number into coverage.xml
if: matrix.tests.sonar
run: sed -i '2i <!-- PR ${{ github.event.number }} -->' coverage.xml

- name: Upload coverage as artifact
uses: actions/upload-artifact@v2
if: matrix.tests.sonar
with:
name: coverage
path: coverage.xml

- name: SonarCloud Scan (on push)
uses: SonarSource/sonarcloud-github-action@master
if: matrix.tests.sonar && github.event_name == 'push' && github.repository == 'ansible/django-ansible-base'
env:
GITHUB_TOKEN: ${{ github-token }}
SONAR_TOKEN: ${{ sonar-token }}
34 changes: 5 additions & 29 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,34 +26,10 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: Install build requirements
run: sudo apt-get update && sudo apt-get install -y libsasl2-dev libldap2-dev libssl-dev libxmlsec1-dev

- name: Install python ${{ matrix.tests.python-version }}
uses: actions/setup-python@v4
- name: Build awx_devel image for running checks
uses: ./.github/actions/dab_tests
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
sonar-token: ${{ secrets.SONAR_TOKEN }}
python-version: ${{ matrix.tests.python-version }}

- name: Install tox
run: pip${{ matrix.tests.python-version }} install tox

- name: Run tox
run: tox -e ${{ matrix.tests.env }}

- name: Inject PR number into coverage.xml
if: matrix.tests.sonar
run: sed -i '2i <!-- PR ${{ github.event.number }} -->' coverage.xml

- name: Upload coverage as artifact
uses: actions/upload-artifact@v2
if: matrix.tests.sonar
with:
name: coverage
path: coverage.xml

- name: SonarCloud Scan (on push)
uses: SonarSource/sonarcloud-github-action@master
if: matrix.tests.sonar && github.event_name == 'push' && github.repository == 'ansible/django-ansible-base'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
tox_env: ${{ matrix.tests.env }}

0 comments on commit 8fa2b42

Please sign in to comment.