Skip to content

Remove unused/redundant steps in Integration Test CI #996

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Jun 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 4 additions & 21 deletions .github/workflows/integration_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -409,22 +409,6 @@ jobs:
name: log-artifact
path: build-results-desktop-${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.ssl_variant }}*
retention-days: ${{ env.artifactRetentionDays }}
- name: Cleanup Local Copies of Uploaded Artifacts
shell: bash
run: |
rm -rf testapps-desktop-${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.ssl_variant }}
- name: Set CLOUDSDK_PYTHON (Windows)
shell: bash
if: startsWith(matrix.os, 'windows') && !cancelled()
run: echo "CLOUDSDK_PYTHON=${{env.pythonLocation}}\python.exe" >> $GITHUB_ENV
- name: Install Cloud SDK
if: ${{ !cancelled() }}
uses: google-github-actions/setup-gcloud@v0
- name: Upload Desktop Artifacts to GCS
shell: bash
if: ${{ !cancelled() }}
run: |
python scripts/gha/gcs_uploader.py --testapp_dir ta --key_file scripts/gha-encrypted/gcs_key_file.json
- name: Download log artifacts
if: ${{ needs.check_and_prepare.outputs.pr_number && failure() && !cancelled() }}
uses: actions/download-artifact@v3
Expand Down Expand Up @@ -900,7 +884,6 @@ jobs:
shell: bash
command: |
pip install -r scripts/gha/requirements.txt
python scripts/gha/restore_secrets.py --passphrase "${{ secrets.TEST_SECRET }}" --artifact "testapps/testapps-desktop-${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.ssl_variant }}"
- name: Setup java
uses: actions/setup-java@v3
with:
Expand Down Expand Up @@ -1178,12 +1161,12 @@ jobs:
timeout-minutes: 60
if: steps.get-device-type.outputs.device_type == 'real'
run: |
python scripts/gha/restore_secrets.py --passphrase "${{ secrets.TEST_SECRET }}"
python scripts/gha/test_lab.py --testapp_dir testapps \
--android_device "${{ matrix.android_device }}" \
--logfile_name "android-${{ matrix.build_os }}-${{ matrix.android_device }}" \
--code_platform cpp \
--key_file scripts/gha-encrypted/gcs_key_file.json
--key_file_encrypted scripts/gha-encrypted/gcs_key_file.json.gpg \
--key_file_passphrase "${{ secrets.TEST_SECRET }}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't have be this PR, but we probably should rename it to more meaningful

- name: Prepare results summary artifact
if: ${{ !cancelled() }}
shell: bash
Expand Down Expand Up @@ -1289,12 +1272,12 @@ jobs:
timeout-minutes: 60
if: steps.get-device-type.outputs.device_type == 'real'
run: |
python scripts/gha/restore_secrets.py --passphrase "${{ secrets.TEST_SECRET }}"
python scripts/gha/test_lab.py --testapp_dir testapps \
--ios_device "${{ matrix.ios_device }}" \
--logfile_name "ios-${{ matrix.build_os }}-${{ matrix.ios_device }}" \
--code_platform cpp \
--key_file scripts/gha-encrypted/gcs_key_file.json
--key_file_encrypted scripts/gha-encrypted/gcs_key_file.json.gpg \
--key_file_passphrase "${{ secrets.TEST_SECRET }}"
- name: Prepare results summary artifact
if: ${{ !cancelled() }}
shell: bash
Expand Down
5 changes: 5 additions & 0 deletions scripts/gha/build_testapps.py
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,7 @@ def _collect_integration_tests(testapps, root_output_dir, output_dir, artifact_n
desktop_testapp_name += ".exe"

testapp_paths = []
testapp_google_services = {}
for file_dir, directories, file_names in os.walk(output_dir):
for directory in directories:
if directory.endswith(ios_simualtor_testapp_extension):
Expand All @@ -446,6 +447,8 @@ def _collect_integration_tests(testapps, root_output_dir, output_dir, artifact_n
or file_name.endswith(android_testapp_extension)
or file_name.endswith(ios_testapp_extension)):
testapp_paths.append(os.path.join(file_dir, file_name))
if (file_name == "google-services.json"):
testapp_google_services[file_dir.split(os.path.sep)[-2]] = os.path.join(file_dir, file_name)

artifact_path = os.path.join(root_output_dir, testapps_artifact_dir)
_rm_dir_safe(artifact_path)
Expand All @@ -456,6 +459,8 @@ def _collect_integration_tests(testapps, root_output_dir, output_dir, artifact_n
if testapp in path:
if os.path.isfile(path):
shutil.copy(path, os.path.join(artifact_path, testapp))
if path.endswith(desktop_testapp_name) and testapp_google_services.get(testapp):
shutil.copy(testapp_google_services[testapp], os.path.join(artifact_path, testapp))
else:
dir_util.copy_tree(path, os.path.join(artifact_path, testapp, os.path.basename(path)))
break
Expand Down
17 changes: 15 additions & 2 deletions scripts/gha/test_lab.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@
from integration_testing import gcs
from integration_testing import test_validation
from print_matrix_configuration import TEST_DEVICES
import restore_secrets

_ANDROID = "android"
_IOS = "ios"
Expand All @@ -93,6 +94,11 @@
" Used to choose the validation logic to process the log output.")
flags.DEFINE_string(
"key_file", None, "Path to key file authorizing use of the GCS bucket.")
flags.DEFINE_string(
"key_file_encrypted", None, "Path to encrypted key file authorizing use "
"of the GCS bucket.")
flags.DEFINE_string(
"key_file_passphrase", None, "Use with FLAG key_file_encrypted.")
flags.DEFINE_string(
"android_device", None,
"Model_id and API_level for desired device. See module docstring for details "
Expand Down Expand Up @@ -127,7 +133,15 @@ def main(argv):
raise app.UsageError("Too many command-line arguments.")

testapp_dir = _fix_path(FLAGS.testapp_dir)
key_file_path = _fix_path(FLAGS.key_file)
if FLAGS.key_file:
key_file_path = _fix_path(FLAGS.key_file)
elif FLAGS.key_file_encrypted and FLAGS.key_file_passphrase:
key_file_encrypted_path = _fix_path(FLAGS.key_file_encrypted)
decrypted_text = restore_secrets._decrypt(key_file_encrypted_path, FLAGS.key_file_passphrase)
key_file_path = key_file_encrypted_path.replace(".gpg", "")
with open(key_file_path, "w") as f:
f.write(decrypted_text)

code_platform = FLAGS.code_platform

if not os.path.exists(key_file_path):
Expand Down Expand Up @@ -383,5 +397,4 @@ def get_gcloud_flags(self):
if __name__ == "__main__":
flags.mark_flag_as_required("testapp_dir")
flags.mark_flag_as_required("code_platform")
flags.mark_flag_as_required("key_file")
app.run(main)