Skip to content

Commit

Permalink
Updates the CI workflow to work more similar to the release workflow
Browse files Browse the repository at this point in the history
[noissue]
  • Loading branch information
dkliban committed Jun 1, 2021
1 parent 8c3bca6 commit 7c3fc88
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 44 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/bootstrap.yaml
Expand Up @@ -110,6 +110,9 @@ jobs:
ANSIBLE_FORCE_COLOR: '1'
shell: bash

- name: Install Python client
run: .github/workflows/scripts/install_python_client.sh

- name: Before Script
run: |
.github/workflows/scripts/before_script.sh
Expand Down
11 changes: 11 additions & 0 deletions templates/github/.github/workflows/ci.yml.j2
Expand Up @@ -117,6 +117,13 @@ jobs:
ANSIBLE_FORCE_COLOR: '1'
shell: bash

- name: Install Python client
run: .github/workflows/scripts/install_python_client.sh

- name: Install Ruby client
if: {{ "${{ env.TEST == 'bindings' }}" }}
run: .github/workflows/scripts/install_ruby_client.sh

- name: Before Script
run: |
.github/workflows/scripts/before_script.sh
Expand All @@ -131,6 +138,10 @@ jobs:
run: .github/workflows/scripts/script.sh
shell: bash

- name: Setup tmate session
uses: mxschmitt/action-tmate@v3
if: failure()

- name: After failure
if: failure()
run: |
Expand Down
6 changes: 4 additions & 2 deletions templates/github/.github/workflows/release.yml.j2
Expand Up @@ -61,7 +61,9 @@ jobs:
- TEST: pulp
- TEST: docs
- TEST: s3
{%- if test_bindings %}
{%- if (deploy_client_to_pypi or deploy_client_to_rubygems) and not test_bindings %}
- TEST: generate-bindings
{%- elif test_bindings %}
- TEST: bindings
{%- endif %}

Expand All @@ -74,7 +76,7 @@ jobs:
with:
python-version: "3.7"

{%- if test_bindings %}
{%- if test_bindings or deploy_client_to_rubygems %}
- uses: actions/setup-ruby@v1
with:
ruby-version: "2.6"
Expand Down
Expand Up @@ -38,9 +38,9 @@ plugin_path = release_path.split("/.github")[0]

# Check if the client package is available on PyPI
loop = asyncio.get_event_loop()
package_found = asyncio.run(
package_was_found = asyncio.run(
get_package_from_pypi("{{ plugin_dash }}-client=={client_version}", plugin_path)
)

if not package_found:
if not package_was_found:
os.system("python3 setup.py sdist bdist_wheel --python-tag py3")
2 changes: 1 addition & 1 deletion templates/github/.github/workflows/scripts/install.sh.j2
Expand Up @@ -87,7 +87,7 @@ services:
VARSYAML
fi
{%- else %}
if [[ "$RELEASE_WORKFLOW" == "true" ]]; then
if [[ "${RELEASE_WORKFLOW:-false}" == "true" ]]; then
PLUGIN_NAME=./dist/{{ plugin_dash }}-*
else
PLUGIN_NAME=./{{ plugin_name }}
Expand Down
65 changes: 26 additions & 39 deletions templates/github/.github/workflows/scripts/script.sh.j2
Expand Up @@ -23,7 +23,7 @@ export PULP_SETTINGS=$PWD/.ci/ansible/settings/settings.py

export PULP_URL="http://pulp"

if [[ "$TEST" = "docs" || "$TEST" = "publish" ]]; then
if [[ "$TEST" = "docs" ]]; then
cd docs
make PULP_URL="$PULP_URL" diagrams html
tar -cvf docs.tar ./_build
Expand All @@ -48,55 +48,42 @@ if [[ "$TEST" == "plugin-from-pypi" ]]; then
fi

cd ../pulp-openapi-generator

{%- if plugin_name != 'pulpcore' %}
./generate.sh pulpcore python
pip install ./pulpcore-client
{%- if plugin_name != 'pulpcore' %}
./generate.sh {{ plugin_snake }} python
pip install ./{{ plugin_snake }}-client
rm -rf ./pulpcore-client
if [[ "$TEST" = 'bindings' ]]; then
./generate.sh pulpcore ruby 0
cd pulpcore-client
gem build pulpcore_client.gemspec
gem install --both ./pulpcore_client-0.gem
fi
{%- endif %}
{%- for item in additional_repos if item.bindings | default(true) %}
{%- for item in additional_repos %}
./generate.sh {{ item.name | replace("-", "_") }} python
pip install ./{{ item.name | replace("-", "_") }}-client
rm -rf ./{{ item.name | replace("-", "_") }}-client
if [[ "$TEST" = 'bindings' ]]; then
./generate.sh {{ item.name }} ruby 0
cd {{ item.name }}-client
gem build {{ item.name }}_client.gemspec
gem install --bot ./{{ item.name }}_client-0.gem
fi
cd ..
{%- endfor %}
cd $REPO_ROOT

if [[ "$TEST" = 'bindings' || "$TEST" = 'publish' ]]; then
if [[ "$TEST" = 'bindings' ]]; then
python $REPO_ROOT/.ci/assets/bindings/test_bindings.py
cd ../pulp-openapi-generator
if [ ! -f $REPO_ROOT/.ci/assets/bindings/test_bindings.rb ]
then
fi

if [[ "$TEST" = 'bindings' ]]; then
if [ ! -f $REPO_ROOT/.ci/assets/bindings/test_bindings.rb ]; then
exit
else
ruby $REPO_ROOT/.ci/assets/bindings/test_bindings.rb
exit
fi

rm -rf ./pulpcore-client

./generate.sh pulpcore ruby 0
cd pulpcore-client
gem build pulpcore_client
gem install --both ./pulpcore_client-0.gem
cd ..

{%- if plugin_name == 'pulpcore' %}
rm -rf ./pulp_file-client

./generate.sh pulp_file ruby 0
cd pulp_file-client
gem build pulp_file_client
gem install --both ./pulp_file_client-0.gem
cd ..
{%- else %}
rm -rf ./{{ plugin_snake }}-client

./generate.sh {{ plugin_snake }} ruby 0

cd {{ plugin_snake }}-client
gem build {{ plugin_snake }}_client
gem install --both ./{{ plugin_snake }}_client-0.gem
cd ..
{%- endif %}
ruby $REPO_ROOT/.ci/assets/bindings/test_bindings.rb
exit
fi

cat unittest_requirements.txt | cmd_stdin_prefix bash -c "cat > /tmp/unittest_requirements.txt"
Expand Down

0 comments on commit 7c3fc88

Please sign in to comment.