Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
8b6b4ac
Create E2E test workflow
ab-10 Sep 8, 2025
1e7490b
Ignore .env.rml
ab-10 Sep 9, 2025
c0e566b
Implement initial e2e test
ab-10 Sep 9, 2025
86b1551
Merge branch 'main' into rml-217-rml-add-e2e-tests
ab-10 Sep 9, 2025
0ade943
Fix virtualenv path
ab-10 Sep 9, 2025
45e63c3
Fix env var presence check
ab-10 Sep 9, 2025
dfafdf0
Clone the test repo
ab-10 Sep 9, 2025
44ece55
Fix repo name
ab-10 Sep 9, 2025
a2d1bc9
Authenticate for private repo
ab-10 Sep 9, 2025
b31ce6c
Fix secret path
ab-10 Sep 9, 2025
aeb14a7
Fix secret formatting
ab-10 Sep 9, 2025
c89181c
Add project name to secrets
ab-10 Sep 9, 2025
9b3bd8d
Use a public repo for tests
ab-10 Sep 9, 2025
ab8280a
Fix test path
ab-10 Sep 9, 2025
99915af
Put test_e2e.py in the root of test dir
ab-10 Sep 9, 2025
eb2b9fd
Modify the download artifact path
ab-10 Sep 9, 2025
46dfc0a
Only download the test file
ab-10 Sep 9, 2025
b0c3fc7
Update download-artifact version
ab-10 Sep 9, 2025
73f911d
Downgrade upload-artifact
ab-10 Sep 9, 2025
b50d41b
Specify artifact to upload
ab-10 Sep 9, 2025
cf37d2d
Specify the full path for test_e2e.py
ab-10 Sep 9, 2025
ae18955
Print a tree for debugging
ab-10 Sep 9, 2025
3e43104
Modify test_e2e.py location
ab-10 Sep 9, 2025
53c42e6
Debug path
ab-10 Sep 9, 2025
0b6e05e
Explicitly specify working dir
ab-10 Sep 9, 2025
7465be4
Explicitly specify repo location
ab-10 Sep 9, 2025
8941c2b
Fix test_e2e.py path
ab-10 Sep 9, 2025
2879111
Add timeout
ab-10 Sep 9, 2025
26c6ff4
Add authentication
ab-10 Sep 9, 2025
6429928
Increase test verbosity
ab-10 Sep 9, 2025
1b23a31
Fix key format
ab-10 Sep 9, 2025
b0f8f20
Run the test inside of test repo
ab-10 Sep 9, 2025
3057c60
Use the absolute path for `rml`
ab-10 Sep 9, 2025
a2dc8a3
Make `rml` absolute path
ab-10 Sep 9, 2025
ec1fcb4
Fetch all commits in test repo
ab-10 Sep 9, 2025
870a9e7
Fetch the main branch for test repo
ab-10 Sep 9, 2025
650d3cc
Specify the remote main branch
ab-10 Sep 9, 2025
e777560
Check rml outpu
ab-10 Sep 9, 2025
53f1c72
Capture stdout
ab-10 Sep 9, 2025
5140483
Print stdout on test success
ab-10 Sep 9, 2025
0033f4b
Clean up action file
ab-10 Sep 10, 2025
48fbe97
Run E2E test in e2e env
ab-10 Sep 10, 2025
f8a4be9
Only require approval for external contribs
ab-10 Sep 10, 2025
f9514de
Update ruff version
ab-10 Sep 10, 2025
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
114 changes: 114 additions & 0 deletions .github/workflows/e2e_tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
name: E2E Tests

on:
pull_request:
branches: [ "**" ]
workflow_dispatch:

jobs:
build-rml-binary:
name: Build RML Binary
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v5

- name: Install uv
uses: astral-sh/setup-uv@v5
with:
version: "0.7.20" # Ensure this matches the version in the Makefile
enable-cache: true

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version-file: 'pyproject.toml'

- name: Install and build
run: |
make install
source .venv/bin/activate
make bundle

- name: Upload built artifact
uses: actions/upload-artifact@v4
with:
name: rml-linux-tarball
path: dist/rml-linux-*.tar.gz

- name: Upload e2e test file
uses: actions/upload-artifact@v4
with:
name: test_e2e.py
path: tests/e2e/test_e2e.py

e2e-test:
name: Run E2E Tests
needs: build-rml-binary
runs-on: ubuntu-latest
# Ensures only external contributors require approval to run the E2E tests
environment: ${{ github.event.pull_request.head.repo.full_name != github.repository && 'E2E' || '' }}

permissions:
contents: read
id-token: write # Required for OIDC/Workload Identity Federation
env:
WORKSPACE_ROOT: ${{ github.workspace }}
steps:
- name: Download RML binary artifact
uses: actions/download-artifact@v4
with:
name: rml-linux-tarball
path: artifact

- name: Download e2e test file
uses: actions/download-artifact@v4
with:
name: test_e2e.py
path: artifact

- name: Extract binary
run: |
mkdir -p dist/extracted
TAR_FILE=$(ls artifact/rml-linux-*.tar.gz | head -n1)
echo "Using tarball: $TAR_FILE"
tar -xzf "$TAR_FILE" -C dist/extracted
echo "RECURSE_API_KEY=${{ secrets.E2E_TEST_RML_KEY }}" > dist/extracted/rml/.env.rml
echo "BIN_DIR=$PWD/dist/extracted/rml" >> $GITHUB_ENV

- name: Add binary to PATH
run: echo "$BIN_DIR" >> $GITHUB_PATH

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'

- name: Install pytest
run: pip install pytest

- name: Smoke test binary in clean shell
shell: bash -l {0}
run: |
set -euxo pipefail
rml --version
rml -md --help

- name: Clone rml-e2e-test
uses: actions/checkout@v5
with:
repository: Recurse-ML/rml-e2e-test
ref: e2e-test-branch
path: rml-e2e-test
fetch-depth: 0

- name: Fetch main branch
working-directory: ${{ env.WORKSPACE_ROOT }}/rml-e2e-test
run: git fetch origin main

- name: Run e2e test file
working-directory: ${{ env.WORKSPACE_ROOT }}
env:
TEST_REPO: ${{ env.WORKSPACE_ROOT }}/rml-e2e-test
BUG_BRANCH: "e2e-test-branch"
run: pytest -s -vv artifact/test_e2e.py
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
__pycache__/
*.py[cod]
*$py.class
.env.rml

# C extensions
*.so
Expand Down
33 changes: 33 additions & 0 deletions tests/e2e/test_e2e.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import os
import subprocess
from pathlib import Path

import pytest


@pytest.mark.timeout(300)
def test_e2e():
test_repo = os.environ.get("TEST_REPO")
assert test_repo is not None, "TEST_REPO is not set"
test_repo = Path(test_repo)
assert test_repo.exists(), "TEST_REPO does not exist"

bug_branch = os.environ.get("BUG_BRANCH")
assert bug_branch is not None, "BUG_BRANCH is not set"
result = subprocess.run(
[
"rml",
"-md",
"--from",
bug_branch,
"--to",
"origin/main",
],
stdout=subprocess.PIPE,
text=True,
cwd=test_repo,
)
print(result.stdout)
print(result.stderr)
assert result.returncode == 0
assert "Time to roll up your sleeves!" in result.stdout