From 9c48c8bf180ad9a20f3a2322dfdf1abe591e177b Mon Sep 17 00:00:00 2001 From: "Fotis Koutoulakis (@NlightNFotis)" Date: Thu, 5 Dec 2024 15:32:36 +0000 Subject: [PATCH] ci: add capability to handle container initialisation steps to sync.py --- .github/workflows/__test-proxy.yml | 30 +++++++++++------------------- pr-checks/checks/test-proxy.yml | 12 +++++++++++- pr-checks/sync.py | 6 ++++++ 3 files changed, 28 insertions(+), 20 deletions(-) diff --git a/.github/workflows/__test-proxy.yml b/.github/workflows/__test-proxy.yml index 6e3a0944e..e7a181ccd 100644 --- a/.github/workflows/__test-proxy.yml +++ b/.github/workflows/__test-proxy.yml @@ -38,16 +38,6 @@ jobs: timeout-minutes: 45 runs-on: ${{ matrix.os }} steps: - - name: Setup Python on macOS - uses: actions/setup-python@v5 - if: runner.os == 'macOS' && matrix.version == 'stable-v2.14.6' - with: - python-version: '3.11' - - name: Check out repository - uses: actions/checkout@v4 - env: - https_proxy: http://squid-proxy:3128 - CODEQL_ACTION_TEST_MODE: true - name: Set up GitHub CLI run: | apt update @@ -56,6 +46,14 @@ jobs: apt-key add /usr/share/keyrings/githubcli-archive-keyring.gpg apt-add-repository https://cli.github.com/packages apt install -y gh + env: {} + - name: Setup Python on macOS + uses: actions/setup-python@v5 + if: runner.os == 'macOS' && matrix.version == 'stable-v2.14.6' + with: + python-version: '3.11' + - name: Check out repository + uses: actions/checkout@v4 - name: Prepare test id: prepare-test uses: ./.github/actions/prepare-test @@ -63,20 +61,14 @@ jobs: version: ${{ matrix.version }} use-all-platform-bundle: 'false' setup-kotlin: 'false' - env: - https_proxy: http://squid-proxy:3128 - CODEQL_ACTION_TEST_MODE: true - uses: ./../action/init with: languages: javascript tools: ${{ steps.prepare-test.outputs.tools-url }} - env: - https_proxy: http://squid-proxy:3128 - CODEQL_ACTION_TEST_MODE: true - uses: ./../action/analyze - env: - https_proxy: http://squid-proxy:3128 - CODEQL_ACTION_TEST_MODE: true + env: + https_proxy: http://squid-proxy:3128 + CODEQL_ACTION_TEST_MODE: true container: image: ubuntu:22.04 options: --dns 8.8.8.8 diff --git a/pr-checks/checks/test-proxy.yml b/pr-checks/checks/test-proxy.yml index 5574ae260..8a65b5f49 100644 --- a/pr-checks/checks/test-proxy.yml +++ b/pr-checks/checks/test-proxy.yml @@ -4,7 +4,17 @@ versions: ["linked", "nightly-latest"] operatingSystems: ["ubuntu"] container: image: ubuntu:22.04 - options: --dns 127.0.0.1 + options: --dns 8.8.8.8 +container-init-steps: + name: Set up GitHub CLI + run: | + apt update + apt install -y curl libreadline8 gnupg2 software-properties-common zstd + curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg + apt-key add /usr/share/keyrings/githubcli-archive-keyring.gpg + apt-add-repository https://cli.github.com/packages + apt install -y gh + env: {} services: squid-proxy: image: ubuntu/squid:latest diff --git a/pr-checks/sync.py b/pr-checks/sync.py index 32250070e..7b3a19435 100755 --- a/pr-checks/sync.py +++ b/pr-checks/sync.py @@ -124,6 +124,12 @@ def writeHeader(checkStream): }, ] + # If container initialisation steps are present in the check specification, + # make sure to execute them first. + if 'container' in checkSpecification and 'container-init-steps' in checkSpecification: + steps.insert(0, checkSpecification['container-init-steps']) + + steps.extend(checkSpecification['steps']) checkJob = {