diff --git a/.github/workflows/e2e-test.yml b/.github/workflows/e2e-test.yml new file mode 100644 index 0000000..b1d5b1e --- /dev/null +++ b/.github/workflows/e2e-test.yml @@ -0,0 +1,49 @@ +name: E2E Tests + +on: + workflow_dispatch: + inputs: + commit_sha: + description: 'The hash value of the commit.' + required: true + push: + branches: + - main + - dev + +jobs: + run-tests: + runs-on: ubuntu-latest + steps: + - name: checkout repo + uses: actions/checkout@v4 + if: ${{ inputs.commit_sha != '' }} + with: + ref: ${{ inputs.commit_sha }} + + - name: checkout repo + uses: actions/checkout@v4 + if: ${{ inputs.commit_sha == '' }} + + - name: update packages + run: sudo apt-get update -y + + - name: setup python 3 + uses: actions/setup-python@v5 + with: + python-version: '3.11' + + - name: install or update Python build system + run: python3 -m pip install -U wheel setuptools certifi pip + + - name: install test dependencies + run: make test-deps + + - name: generate local SSH key + run: ssh-keygen -t rsa -b 4096 -f ~/.ssh/id_rsa -N "" + + - name: run e2e test + run: make e2e + env: + CLEANUP_TEST_LINODE_INSTANCE: true + LINODE_TOKEN: ${{ secrets.DX_LINODE_TOKEN }} diff --git a/hack/run-e2e.yml b/hack/run-e2e.yml index a4083ae..8bf4ccd 100644 --- a/hack/run-e2e.yml +++ b/hack/run-e2e.yml @@ -31,6 +31,7 @@ runner_id: '{{ lookup("file", playbook_dir ~ "/.e2e-runner-id") }}' - name: Create a temporary token for the plugin to consume + no_log: true linode.cloud.token: label: "{{ temp_token_name }}-{{ run_id }}" scopes: "events:read_write linodes:read_write" @@ -42,6 +43,7 @@ register: temp_token - name: Ensure the test instance is created + no_log: true linode.cloud.instance: label: "{{ label_prefix }}-{{ runner_id }}" type: "{{ type }}" @@ -57,6 +59,7 @@ wait_for: host="{{ create_inst.instance.ipv4[0] }}" port=22 delay=1 timeout=300 - name: Append host to the in-memory inventory + no_log: true add_host: hostname: "test-runner" ansible_host: "{{ create_inst.instance.ipv4[0] }}" @@ -128,6 +131,7 @@ tasks: - name: Remove the temp token + no_log: true linode.cloud.token: label: "{{ temp_token_name }}-{{ run_id }}" state: absent