mirror of
https://github.com/ansible/awx.git
synced 2026-01-09 23:12:08 -03:30
Add new api schema check workflow (#16143)
* add new file to separate out the schema check so that it is no longer part of CI check and won't cacuse the whole workflow to fail * remove old API schema check from ci.yml
This commit is contained in:
parent
a53fdaddae
commit
d1d3a3471b
66
.github/workflows/api_schema_check.yml
vendored
Normal file
66
.github/workflows/api_schema_check.yml
vendored
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
---
|
||||||
|
name: API Schema Change Detection
|
||||||
|
env:
|
||||||
|
LC_ALL: "C.UTF-8" # prevent ERROR: Ansible could not initialize the preferred locale: unsupported locale setting
|
||||||
|
CI_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
DEV_DOCKER_OWNER: ${{ github.repository_owner }}
|
||||||
|
COMPOSE_TAG: ${{ github.base_ref || 'devel' }}
|
||||||
|
UPSTREAM_REPOSITORY_ID: 91594105
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- devel
|
||||||
|
- release_**
|
||||||
|
- feature_**
|
||||||
|
- stable-**
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
api-schema-detection:
|
||||||
|
name: Detect API Schema Changes
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
timeout-minutes: 30
|
||||||
|
permissions:
|
||||||
|
packages: write
|
||||||
|
contents: read
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
show-progress: false
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Build awx_devel image for schema check
|
||||||
|
uses: ./.github/actions/awx_devel_image
|
||||||
|
with:
|
||||||
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
private-github-key: ${{ secrets.PRIVATE_GITHUB_KEY }}
|
||||||
|
|
||||||
|
- name: Detect API schema changes
|
||||||
|
id: schema-check
|
||||||
|
continue-on-error: true
|
||||||
|
run: |
|
||||||
|
AWX_DOCKER_ARGS='-e GITHUB_ACTIONS' \
|
||||||
|
AWX_DOCKER_CMD='make detect-schema-change SCHEMA_DIFF_BASE_BRANCH=${{ github.event.pull_request.base.ref }}' \
|
||||||
|
make docker-runner 2>&1 | tee schema-diff.txt
|
||||||
|
exit ${PIPESTATUS[0]}
|
||||||
|
|
||||||
|
- name: Add schema diff to job summary
|
||||||
|
if: always()
|
||||||
|
# show text and if for some reason, it can't be generated, state that it can't be.
|
||||||
|
run: |
|
||||||
|
echo "## API Schema Change Detection Results" >> $GITHUB_STEP_SUMMARY
|
||||||
|
echo "" >> $GITHUB_STEP_SUMMARY
|
||||||
|
if [ -f schema-diff.txt ]; then
|
||||||
|
if grep -q "^+" schema-diff.txt || grep -q "^-" schema-diff.txt; then
|
||||||
|
echo "### Schema changes detected" >> $GITHUB_STEP_SUMMARY
|
||||||
|
echo "" >> $GITHUB_STEP_SUMMARY
|
||||||
|
echo '```diff' >> $GITHUB_STEP_SUMMARY
|
||||||
|
cat schema-diff.txt >> $GITHUB_STEP_SUMMARY
|
||||||
|
echo '```' >> $GITHUB_STEP_SUMMARY
|
||||||
|
else
|
||||||
|
echo "### No schema changes detected" >> $GITHUB_STEP_SUMMARY
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "### Unable to generate schema diff" >> $GITHUB_STEP_SUMMARY
|
||||||
|
fi
|
||||||
6
.github/workflows/ci.yml
vendored
6
.github/workflows/ci.yml
vendored
@ -38,12 +38,6 @@ jobs:
|
|||||||
- name: awx-collection
|
- name: awx-collection
|
||||||
command: /start_tests.sh test_collection_all
|
command: /start_tests.sh test_collection_all
|
||||||
coverage-upload-name: "awx-collection"
|
coverage-upload-name: "awx-collection"
|
||||||
- name: api-schema
|
|
||||||
command: >-
|
|
||||||
/start_tests.sh detect-schema-change SCHEMA_DIFF_BASE_BRANCH=${{
|
|
||||||
github.event.pull_request.base.ref || github.ref_name
|
|
||||||
}}
|
|
||||||
coverage-upload-name: ""
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user