Skip to content

test(ci): create a dummy ~/.python-gitlab.cfg file #2174

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

Closed
wants to merge 1 commit into from
Closed
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
2 changes: 2 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ jobs:
python-version: ${{ matrix.python.version }}
- name: Install dependencies
run: pip3 install tox pytest-github-actions-annotate-failures
- name: Setup dummy config
run: tests/ci_tools/setup-dummy-config.sh
- name: Run tests
env:
TOXENV: ${{ matrix.python.toxenv }}
Expand Down
29 changes: 29 additions & 0 deletions tests/ci_tools/setup-dummy-config.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/bin/bash

set -u

if [[ -z "${CI:-}" || -z "${GITHUB_ACTIONS:-}" ]]; then
echo "ERROR: Not running in the GitHub CI."
exit 2
fi

CONFIG_FILE=~/.python-gitlab.cfg
if [[ -e "${CONFIG_FILE}" ]]; then
echo "ERROR: Config file already exists: ${CONFIG_FILE}"
echo "Saved you from destroying your config"
exit 2
fi

cat <<EOF >"${CONFIG_FILE}"
[global]
default = gitlab
ssl_verify = true
timeout = 5
api_version = 4

[gitlab]
url = https://gitlab.com/
private_token = not-a-valid-token
EOF

echo "Setup config at: ${CONFIG_FILE}"