-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: add initial setup for end-to-end testing
includes a new GH Actions workflow that has the necessary preparatory steps for e2e testing: - install radicle-node and radicle-httpd - create profile - create test repo following instructions from https://code.visualstudio.com/api/working-with-extensions/testing-extension Note: we are using the custom test runner, because this allows us to open VS Code with the radicle repo we have previously created in the e2e tests Signed-off-by: Yorgos Saslis <yorgo@protonmail.com>
- Loading branch information
Showing
8 changed files
with
967 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
name: CI | ||
on: | ||
# TODO: when PR is ready to merge, we should adapt these depending on when we actually want this workflow to run | ||
# push: | ||
# branches: [ main ] | ||
# pull_request: | ||
# branches: [ main ] | ||
push: | ||
pull_request: | ||
|
||
jobs: | ||
e2e-test: | ||
strategy: | ||
matrix: | ||
# TODO: when PR is ready to merge, we should adapt these depending on when we actually want this workflow to run | ||
os: [macos-latest, ubuntu-latest, windows-latest] | ||
# os: [ubuntu-latest] | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- name: Install Radicle | ||
env: | ||
RAD_HOME: ${{ github.workspace }}/.radicle | ||
run: | | ||
echo "Installing radicle-node..." | ||
curl -sSf https://radicle.xyz/install | sh | ||
echo "Installing radicle-httpd..." | ||
case "$(uname)/$(uname -m)" in | ||
Darwin/arm64) | ||
export TARGET="aarch64-apple-darwin" ;; | ||
Darwin/x86_64) | ||
export TARGET="x86_64-apple-darwin" ;; | ||
Linux/arm64|Linux/aarch64) | ||
export TARGET="aarch64-unknown-linux-musl" ;; | ||
Linux/x86_64) | ||
export TARGET="x86_64-unknown-linux-musl" ;; | ||
*) | ||
fatal "Your operating system is currently unsupported. Sorry!" ;; | ||
esac | ||
echo $TARGET | ||
curl -s https://files.radicle.xyz/releases/radicle-httpd/0.11.0/radicle-httpd-0.11.0-$TARGET.tar.xz | tar -xJ --strip-components=2 | ||
mv radicle-httpd $RAD_HOME/bin/radicle-httpd | ||
# add to path | ||
echo "${RAD_HOME}/bin" >> $GITHUB_PATH | ||
echo "RAD_HOME=${{ github.workspace }}/.radicle" >> $GITHUB_ENV | ||
echo "RAD_PASSPHRASE=''" >> $GITHUB_ENV | ||
- name: Create New Radicle Identity | ||
run: | | ||
rad auth --alias test_user | ||
- name: Start Radicle Node and http API | ||
run: | | ||
rad node start & | ||
echo "allowing node to start up..." | ||
sleep 5 | ||
radicle-httpd --listen 0.0.0.0:8888 & | ||
rad node status | ||
rad self | ||
- name: Create a new Radicle Repository | ||
id: radicle-init | ||
run: | | ||
mkdir ${{ github.workspace }}/a_blog | ||
cd ${{ github.workspace }}/a_blog | ||
git config --global init.defaultBranch main | ||
git init . | ||
git config --local user.email "test@radicle.xyz" | ||
git config --local user.name "Radicle Test" | ||
echo "# A Blog" > README.md | ||
git add README.md | ||
git commit -m 'adds readme' | ||
rad init --private --default-branch main --name "A_test_blog" --description "Some repo" --no-confirm --verbose | ||
pwd | ||
cd .. | ||
chmod -R 777 a_blog | ||
echo "RADICLE_REPO=${{ github.workspace }}/a_blog" >> $GITHUB_ENV | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
path: ${{ github.workspace }}/radicle-vscode-extension | ||
- uses: pnpm/action-setup@v3 | ||
with: | ||
version: 8 | ||
- name: Install Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 20.x | ||
cache: 'pnpm' | ||
- name: Install Dependencies | ||
working-directory: ${{ github.workspace }}/radicle-vscode-extension | ||
run: npx npm-run-all -l verify-deps:* | ||
- name: Compile | ||
working-directory: ${{ github.workspace }}/radicle-vscode-extension | ||
run: pnpm run pretest | ||
- name: Test E2E (Linux) | ||
working-directory: ${{ github.workspace }}/radicle-vscode-extension | ||
if: runner.os == 'Linux' | ||
env: | ||
RAD_PATH: ${{ github.workspace }}/.radicle/bin/rad | ||
run: | | ||
echo "The repo is at: ${{ steps.radicle-init.outputs.radicle-repo }}" | ||
xvfb-run -a pnpm run test:e2e | ||
- name: Test E2E (non-Linux) | ||
working-directory: ${{ github.workspace }}/radicle-vscode-extension | ||
if: runner.os != 'Linux' | ||
env: | ||
RAD_PATH: ${{ github.workspace }}/.radicle/bin/rad | ||
run: | | ||
echo "The repo is at: ${{ steps.radicle-init.outputs.radicle-repo }}" | ||
pnpm run test:e2e |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { defineConfig } from '@vscode/test-cli'; | ||
|
||
// sample, from https://code.visualstudio.com/api/working-with-extensions/testing-extension | ||
export default defineConfig([ | ||
{ | ||
label: 'endToEndTests', | ||
files: 'dist/test/**/*.test.js', | ||
// version: 'insiders', | ||
workspaceFolder: './', | ||
mocha: { | ||
ui: 'tdd', | ||
timeout: 20000 | ||
} | ||
} | ||
// you can specify additional test configurations, too | ||
]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.