ci: add capability to handle container initialisation steps to sync.py

This commit is contained in:
Fotis Koutoulakis (@NlightNFotis) 2024-12-05 15:32:36 +00:00
parent 78be2f1333
commit 9c48c8bf18
3 changed files with 28 additions and 20 deletions

30
.github/workflows/__test-proxy.yml generated vendored
View file

@ -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

View file

@ -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

View file

@ -124,6 +124,12 @@ for file in (this_dir / 'checks').glob('*.yml'):
},
]
# 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 = {