Skip to content

Add workflow to run CLI E2E tests on PRs and Pushes to dev branch #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

Open
wants to merge 12 commits into
base: development
Choose a base branch
from
Open
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
83 changes: 83 additions & 0 deletions .github/workflows/cli-verify-json-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: Run Tests with Linode CLI and JSON Spec

on:
push:
branches:
- development
pull_request:
branches:
- development
workflow_dispatch:
inputs:
sha:
description: 'Specify commit hash to test. This value is mandatory to ensure the tests run against a specific commit'
required: true
default: ''
pull_request_number:
description: 'Specify pull request number associated with the commit. Optional, but recommended when providing a commit hash (sha)'
required: false
test_suite:
description: "Specify test suite to run from the 'tests/integration' directory. Examples: 'cli', 'domains', 'events', etc. If not provided, all suites are executed"
required: false
run_long_tests:
description: "Select 'True' to include long-running tests (e.g., database provisioning, server rebuilds). Defaults to 'False'"
required: false
type: choice
options:
- "True"
- "False"
default: "False"
run_on_pr:
description: "Select 'True' to allow execution on pull requests when using workflow_dispatch. Defaults to 'False'"
required: false
type: choice
options:
- "True"
- "False"
default: "False"

jobs:
test-linode-cli:
runs-on: ubuntu-latest
if: |
github.event_name == 'workflow_dispatch' && inputs.sha != '' ||
github.event_name == 'push' ||
(github.event_name == 'pull_request' && inputs.run_on_pr == 'True')

steps:
- name: Checkout Current Repository (JSON Spec)
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: 'recursive'
ref: ${{ inputs.sha || github.ref }}
path: json-spec

- name: Checkout Linode CLI (dev branch)
uses: actions/checkout@v4
with:
repository: linode/linode-cli
ref: dev
path: linode-cli

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.10"

- name: Get JSON Spec Path
run: |
cd json-spec
echo "JSON_SPEC_PATH=$(pwd)/openapi.json" >> $GITHUB_ENV

- name: Install Linode CLI
run: |
cd linode-cli
SPEC="${{ env.JSON_SPEC_PATH }}" make install

- name: Run CLI E2E Tests
run: |
cd linode-cli
make test-int TEST_SUITE="${{ inputs.test_suite }}" RUN_LONG_TESTS="${{ inputs.run_long_tests }}"
env:
LINODE_CLI_TOKEN: ${{ secrets.LINODE_CLI_TOKEN }}
10 changes: 5 additions & 5 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: '3.7.x'
python-version: '3.10'
architecture: 'x64'
- name: Cache pip
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: ~/.cache/pip
# Look to see if there is a cache hit for the corresponding requirements file
Expand All @@ -27,4 +27,4 @@ jobs:
pip install openapi3
- name: openapi linter
run: |
python -m openapi3 openapi.yaml
python -m openapi3 openapi.json