|
| 1 | +--- |
| 2 | +name: galaxy_ng/ci |
| 3 | +on: |
| 4 | + - push |
| 5 | + - pull_request |
| 6 | + |
| 7 | +jobs: |
| 8 | + |
| 9 | + lint_po: |
| 10 | + runs-on: ubuntu-latest |
| 11 | + steps: |
| 12 | + |
| 13 | + - name: Checkout code |
| 14 | + uses: actions/checkout@v4 |
| 15 | + with: |
| 16 | + ref: ${{ github.event.after }} # for PR avoids checking out merge commit |
| 17 | + fetch-depth: 0 # include all history |
| 18 | + |
| 19 | + - uses: actions/setup-python@v4 |
| 20 | + with: |
| 21 | + python-version: "3.11" |
| 22 | + |
| 23 | + - name: install and run lint-po |
| 24 | + run: | |
| 25 | + pip3 install lint-po |
| 26 | + lint-po ./galaxy_ng/locale/*/LC_MESSAGES/*.po |
| 27 | +
|
| 28 | + lint: |
| 29 | + runs-on: ubuntu-latest |
| 30 | + steps: |
| 31 | + |
| 32 | + - name: Checkout code |
| 33 | + uses: actions/checkout@v4 |
| 34 | + with: |
| 35 | + ref: ${{ github.event.after }} # for PR avoids checking out merge commit |
| 36 | + fetch-depth: 0 # include all history |
| 37 | + |
| 38 | + - uses: actions/setup-python@v4 |
| 39 | + with: |
| 40 | + python-version: "3.11" |
| 41 | + |
| 42 | + - name: Install requirements |
| 43 | + run: pip3 install -r lint_requirements.txt |
| 44 | + |
| 45 | + - name: Run linters |
| 46 | + run: make lint |
| 47 | + |
| 48 | + - name: Check for pulpcore imports outside of pulpcore.plugin |
| 49 | + run: sh .ci/scripts/check_pulpcore_imports.sh |
| 50 | + |
| 51 | + - name: Check for gettext problems |
| 52 | + run: sh .ci/scripts/check_gettext.sh |
| 53 | + |
| 54 | + test: |
| 55 | + runs-on: ubuntu-latest |
| 56 | + steps: |
| 57 | + |
| 58 | + - uses: actions/setup-python@v4 |
| 59 | + with: |
| 60 | + python-version: "3.11" |
| 61 | + |
| 62 | + - uses: actions/checkout@v4 |
| 63 | + with: |
| 64 | + fetch-depth: 0 |
| 65 | + |
| 66 | + - name: checkout dab |
| 67 | + run: | |
| 68 | + cd .. |
| 69 | + git clone https://github.com/ansible/django-ansible-base |
| 70 | +
|
| 71 | + - name: install system dependencies |
| 72 | + run: | |
| 73 | + sudo apt update |
| 74 | + sudo apt install -y libsasl2-dev libldap2-dev libssl-dev gettext |
| 75 | +
|
| 76 | + - name: install tox & coverage |
| 77 | + run: pip3 install tox coverage[toml] |
| 78 | + |
| 79 | + - name: run the unit tests |
| 80 | + run: tox --colored yes -e py311 |
| 81 | + env: |
| 82 | + PY_COLORS: 1 |
| 83 | + |
| 84 | + - name: Inject PR number into coverage.xml |
| 85 | + run: sed -i '2i <!-- PR ${{ github.event.number }} -->' coverage.xml |
| 86 | + |
| 87 | + - name: upload coverage as artifact |
| 88 | + uses: actions/upload-artifact@v4 |
| 89 | + with: |
| 90 | + name: coverage |
| 91 | + path: coverage.xml |
| 92 | + |
| 93 | + - name: SonarCloud Scan |
| 94 | + uses: SonarSource/sonarcloud-github-action@master |
| 95 | + if: github.event_name == 'push' && github.repository == 'ansible/galaxy_ng' && github.ref_name == 'master' |
| 96 | + env: |
| 97 | + SONAR_TOKEN: ${{ secrets.CICD_ORG_SONAR_TOKEN_CICD_BOT }} |
| 98 | + |
| 99 | + - name: upload jUnit XML test results |
| 100 | + if: github.event_name == 'push' && github.repository == 'ansible/galaxy_ng' && github.ref_name == 'master' |
| 101 | + continue-on-error: true |
| 102 | + run: | |
| 103 | + curl -v --user "${{ vars.PDE_ORG_RESULTS_AGGREGATOR_UPLOAD_USER }}:${{ secrets.PDE_ORG_RESULTS_UPLOAD_PASSWORD }}" \ |
| 104 | + --form "xunit_xml=@/tmp/galaxy_ng-test-results.xml" \ |
| 105 | + --form "component_name=hub" \ |
| 106 | + --form "git_commit_sha=${{ github.sha }}" \ |
| 107 | + --form "git_repository_url=https://github.com/${{ github.repository }}" \ |
| 108 | + "${{ vars.PDE_ORG_RESULTS_AGGREGATOR_UPLOAD_URL }}/api/results/upload/" |
0 commit comments