diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000000..7377b4af88 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,173 @@ +--- +name: CI +on: + pull_request: +jobs: + api-test: + runs-on: ubuntu-latest + permissions: + packages: write + contents: read + steps: + - uses: actions/checkout@v2 + + - name: Log in to registry + run: | + echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin + + - name: Pre-pull image to warm build cache + run: | + docker pull ghcr.io/${{ github.repository_owner }}/awx_devel:${{ github.base_ref }} + + - name: Build image + run: | + DEV_DOCKER_TAG_BASE=ghcr.io/${{ github.repository_owner }} COMPOSE_TAG=${{ github.base_ref }} make docker-compose-build + + - name: Run API Tests + run: | + docker run -u $(id -u) --rm -v ${{ github.workspace}}:/awx_devel/:Z \ + --workdir=/awx_devel ghcr.io/${{ github.repository_owner }}/awx_devel:${{ github.base_ref }} /start_tests.sh + api-lint: + runs-on: ubuntu-latest + permissions: + packages: write + contents: read + steps: + - uses: actions/checkout@v2 + + - name: Log in to registry + run: | + echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin + + - name: Pre-pull image to warm build cache + run: | + docker pull ghcr.io/${{ github.repository_owner }}/awx_devel:${{ github.base_ref }} + + - name: Build image + run: | + DEV_DOCKER_TAG_BASE=ghcr.io/${{ github.repository_owner }} COMPOSE_TAG=${{ github.base_ref }} make docker-compose-build + + - name: Run API Linters + run: | + docker run -u $(id -u) --rm -v ${{ github.workspace}}:/awx_devel/:Z \ + --workdir=/awx_devel ghcr.io/${{ github.repository_owner }}/awx_devel:${{ github.base_ref }} /var/lib/awx/venv/awx/bin/tox -e linters + api-swagger: + runs-on: ubuntu-latest + permissions: + packages: write + contents: read + steps: + - uses: actions/checkout@v2 + + - name: Log in to registry + run: | + echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin + + - name: Pre-pull image to warm build cache + run: | + docker pull ghcr.io/${{ github.repository_owner }}/awx_devel:${{ github.base_ref }} + + - name: Build image + run: | + DEV_DOCKER_TAG_BASE=ghcr.io/${{ github.repository_owner }} COMPOSE_TAG=${{ github.base_ref }} make docker-compose-build + + - name: Generate API Reference + run: | + docker run -u $(id -u) --rm -v ${{ github.workspace}}:/awx_devel/:Z \ + --workdir=/awx_devel ghcr.io/${{ github.repository_owner }}/awx_devel:${{ github.base_ref }} /start_tests.sh swagger + awx-collection: + runs-on: ubuntu-latest + permissions: + packages: write + contents: read + steps: + - uses: actions/checkout@v2 + + - name: Log in to registry + run: | + echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin + + - name: Pre-pull image to warm build cache + run: | + docker pull ghcr.io/${{ github.repository_owner }}/awx_devel:${{ github.base_ref }} + + - name: Build image + run: | + DEV_DOCKER_TAG_BASE=ghcr.io/${{ github.repository_owner }} COMPOSE_TAG=${{ github.base_ref }} make docker-compose-build + + - name: Run Collection Tests + run: | + docker run -u $(id -u) --rm -v ${{ github.workspace}}:/awx_devel/:Z \ + --workdir=/awx_devel ghcr.io/${{ github.repository_owner }}/awx_devel:${{ github.base_ref }} /start_tests.sh test_collection_all + api-schema: + runs-on: ubuntu-latest + permissions: + packages: write + contents: read + steps: + - uses: actions/checkout@v2 + + - name: Log in to registry + run: | + echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin + + - name: Pre-pull image to warm build cache + run: | + docker pull ghcr.io/${{ github.repository_owner }}/awx_devel:${{ github.base_ref }} + + - name: Build image + run: | + DEV_DOCKER_TAG_BASE=ghcr.io/${{ github.repository_owner }} COMPOSE_TAG=${{ github.base_ref }} make docker-compose-build + + - name: Check API Schema + run: | + docker run -u $(id -u) --rm -v ${{ github.workspace}}:/awx_devel/:Z \ + --workdir=/awx_devel ghcr.io/${{ github.repository_owner }}/awx_devel:${{ github.base_ref }} /start_tests.sh detect-schema-change + ui-lint: + runs-on: ubuntu-latest + permissions: + packages: write + contents: read + steps: + - uses: actions/checkout@v2 + + - name: Log in to registry + run: | + echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin + + - name: Pre-pull image to warm build cache + run: | + docker pull ghcr.io/${{ github.repository_owner }}/awx_devel:${{ github.base_ref }} + + - name: Build image + run: | + DEV_DOCKER_TAG_BASE=ghcr.io/${{ github.repository_owner }} COMPOSE_TAG=${{ github.base_ref }} make docker-compose-build + + - name: Run UI Linters + run: | + docker run -u $(id -u) --rm -v ${{ github.workspace}}:/awx_devel/:Z \ + --workdir=/awx_devel ghcr.io/${{ github.repository_owner }}/awx_devel:${{ github.base_ref }} make ui-lint + ui-test: + runs-on: ubuntu-latest + permissions: + packages: write + contents: read + steps: + - uses: actions/checkout@v2 + + - name: Log in to registry + run: | + echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin + + - name: Pre-pull image to warm build cache + run: | + docker pull ghcr.io/${{ github.repository_owner }}/awx_devel:${{ github.base_ref }} + + - name: Build image + run: | + DEV_DOCKER_TAG_BASE=ghcr.io/${{ github.repository_owner }} COMPOSE_TAG=${{ github.base_ref }} make docker-compose-build + + - name: Run UI Tests + run: | + docker run -u $(id -u) --rm -v ${{ github.workspace}}:/awx_devel/:Z \ + --workdir=/awx_devel ghcr.io/${{ github.repository_owner }}/awx_devel:${{ github.base_ref }} make ui-test diff --git a/.github/workflows/devel_image.yml b/.github/workflows/devel_image.yml new file mode 100644 index 0000000000..b13bb4e92e --- /dev/null +++ b/.github/workflows/devel_image.yml @@ -0,0 +1,30 @@ +--- +name: Push Development Image +on: + push: + branches: + - devel +jobs: + push: + runs-on: ubuntu-latest + permissions: + packages: write + contents: read + steps: + - uses: actions/checkout@v2 + + - name: Log in to registry + run: | + echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin + + - name: Pre-pull image to warm build cache + run: | + docker pull ghcr.io/${{ github.repository_owner }}/awx_devel:${GITHUB_REF##*/} + + - name: Build image + run: | + DEV_DOCKER_TAG_BASE=ghcr.io/${{ github.repository_owner }} COMPOSE_TAG=${GITHUB_REF##*/} make docker-compose-build + + - name: Push image + run: | + docker push ghcr.io/${{ github.repository_owner }}/awx_devel:${GITHUB_REF##*/} diff --git a/.github/workflows/upload_schema.yml b/.github/workflows/upload_schema.yml new file mode 100644 index 0000000000..ce8647ed4b --- /dev/null +++ b/.github/workflows/upload_schema.yml @@ -0,0 +1,42 @@ +--- +name: Upload API Schema +on: + push: + branches: + - devel +jobs: + push: + runs-on: ubuntu-latest + permissions: + packages: write + contents: read + steps: + - uses: actions/checkout@v2 + + - name: Log in to registry + run: | + echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin + + - name: Pre-pull image to warm build cache + run: | + docker pull ghcr.io/${{ github.repository_owner }}/awx_devel:${GITHUB_REF##*/} + + - name: Build image + run: | + DEV_DOCKER_TAG_BASE=ghcr.io/${{ github.repository_owner }} COMPOSE_TAG=${GITHUB_REF##*/} make docker-compose-build + + - name: Generate API Schema + run: | + docker run -u $(id -u) --rm -v ${{ github.workspace }}:/awx_devel/:Z \ + --workdir=/awx_devel ghcr.io/${{ github.repository_owner }}/awx_devel:${{ github.base_ref }} /start_tests.sh genschema + + - name: Upload API Schema + env: + AWS_ACCESS_KEY: ${{ secrets.AWS_ACCESS_KEY }} + AWS_SECRET_KEY: ${{ secrets.AWS_SECRET_KEY }} + AWS_REGION: 'us-east-1' + run: | + ansible localhost -c local -m aws_s3 \ + -a 'src=${{ github.workspace }}/schema.json bucket=awx-public-ci-files object=schema.json mode=put permission=public-read' + + diff --git a/.yamllint b/.yamllint index 11c769cff1..1da43da59d 100644 --- a/.yamllint +++ b/.yamllint @@ -1,5 +1,6 @@ --- ignore: | + .github .tox awx/main/tests/data/inventory/plugins/** # vault files diff --git a/Makefile b/Makefile index e3214871a3..eff8133c21 100644 --- a/Makefile +++ b/Makefile @@ -418,11 +418,14 @@ ui-devel-instrumented: awx/ui_next/node_modules ui-devel-test: awx/ui_next/node_modules $(NPM_BIN) --prefix awx/ui_next --loglevel warn run start -ui-zuul-lint-and-test: +ui-lint: $(NPM_BIN) --prefix awx/ui_next install $(NPM_BIN) run --prefix awx/ui_next lint $(NPM_BIN) run --prefix awx/ui_next prettier-check - $(NPM_BIN) run --prefix awx/ui_next test -- --coverage --watchAll=false + +ui-test: + $(NPM_BIN) --prefix awx/ui_next install + $(NPM_BIN) run --prefix awx/ui_next test -- --coverage --maxWorkers=4 --watchAll=false # Build a pip-installable package into dist/ with a timestamped version number.