Skip to content
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

feat(CI): add Move IDE Tests workflow #4226

Merged
merged 5 commits into from
Nov 28, 2024
Merged
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
5 changes: 5 additions & 0 deletions .github/actions/diffs/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ outputs:
isMove:
description: True when changes happened to the Move code
value: "${{ steps.diff.outputs.isMove }}"
isExternalCrates:
description: True when changes happened in external crates
value: "${{ steps.diff.outputs.isExternalCrates }}"
isReleaseNotesEligible:
description: True when changes happened in Release Notes eligible paths
value: "${{ steps.diff.outputs.isReleaseNotesEligible }}"
Expand Down Expand Up @@ -56,6 +59,8 @@ runs:
- "examples/**"
- "iota_programmability/**"
- ".github/workflows/_move_tests.yml"
isExternalCrates:
- "external-crates/move/crates/**"
isReleaseNotesEligible:
- "consensus/**"
- "crates/**"
Expand Down
96 changes: 96 additions & 0 deletions .github/workflows/_move_ide.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
name: Move IDE

on: workflow_call

concurrency:
group: move-ide-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
move-auto-formatter-test:
name: Move Auto-formatter Test
runs-on: [self-hosted]

steps:
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # Pin v4.1.1
with:
ref: ${{ github.event.inputs.iota_repo_ref || github.ref }}

- name: Setup Node
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # pin@v4.0.2
with:
node-version: "20"

- name: Install dependencies
working-directory: ./external-crates/move/crates/move-analyzer/prettier-plugin
run: npm install && npm i web-tree-sitter

- name: Run npm test
working-directory: ./external-crates/move/crates/move-analyzer/prettier-plugin
shell: bash
run: npm run test

move-ide-test:
name: Move IDE Test
runs-on: [self-hosted]

steps:
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # Pin v4.1.1
with:
ref: ${{ github.event.inputs.iota_repo_ref || github.ref }}

- name: Setup Node
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # pin@v4.0.2
with:
node-version: "20"

- name: Install dependencies and start Xvfb (emulate a display so VS Code can be started)
working-directory: ./external-crates/move/crates/move-analyzer/editors/code
run: |
sudo apt install libgtk-3-0 -y
sudo apt-get install -y xvfb x11-apps x11-xkb-utils libx11-6 libx11-xcb1
set -eux
# Start server
/usr/bin/Xvfb :99 -screen 0 1024x768x24 &
sleep 1
ps aux | grep Xvfb --color=always | grep -v grep
sudo add-apt-repository ppa:kisak/kisak-mesa -y
sudo apt update
sudo apt upgrade -y
npm install && npm install --save-dev @types/node @types/semver

- name: Build move-analyzer
run: |
cargo build --bin move-analyzer
mkdir -p ~/.iota/bin
cp ./target/debug/move-analyzer* ~/.iota/bin

- name: Run npm test
working-directory: ./external-crates/move/crates/move-analyzer/editors/code
shell: bash
run: npm run pretest && DISPLAY=:99.0 npm run test

move-vscode-extension-build:
name: Move VSCode extension build
runs-on: [self-hosted]

steps:
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # Pin v4.1.1
with:
ref: ${{ github.event.inputs.iota_repo_ref || github.ref }}

- name: Setup Node
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # pin@v4.0.2
with:
node-version: "20"

- name: Install dependencies
working-directory: ./external-crates/move/crates/move-analyzer/editors/code
run: npm install && npm install --save-dev @types/node @types/semver

- name: Build VSCode extension
working-directory: ./external-crates/move/crates/move-analyzer/editors/code
run: npm run package
10 changes: 10 additions & 0 deletions .github/workflows/hierarchy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ jobs:
isMove: ${{ steps.diff.outputs.isMove }}
isDoc: ${{ steps.diff.outputs.isDoc }}
isReleaseNotesEligible: ${{ steps.diff.outputs.isReleaseNotesEligible }}
isExternalCrates: ${{ steps.diff.outputs.isExternalCrates }}
isWallet: ${{ (steps.turbo.outputs.packages && contains(fromJson(steps.turbo.outputs.packages), 'iota-wallet')) }}
isExplorer: ${{ (steps.turbo.outputs.packages && contains(fromJson(steps.turbo.outputs.packages), 'iota-explorer')) }}
isTypescriptSDK: ${{ (steps.turbo.outputs.packages && contains(fromJson(steps.turbo.outputs.packages), '@iota/iota-sdk')) }}
Expand Down Expand Up @@ -175,3 +176,12 @@ jobs:
- typos
uses: ./.github/workflows/_ledgernano.yml
secrets: inherit

move-ide:
if: (!cancelled() && !failure()) && needs.diff.outputs.isExternalCrates == 'true' && github.event.pull_request.draft == false
needs:
- diff
- dprint-format
- license-check
- typos
uses: ./.github/workflows/_move_ide.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,8 @@ do
fi
done

# these will have to change if we want a different network/version
NETWORK="alphanet"
VERSION="0.4.0"
# these will have to change if we want a different version
VERSION="0.7.2-rc"

# a map from os version identifiers in Iota's binary distribution to os version identifiers
# representing VSCode's target platforms used for creating platform-specific plugin distributions
Expand All @@ -55,7 +54,7 @@ SUPPORTED_OS[macos-arm64]=darwin-arm64
SUPPORTED_OS[linux-x86_64]=linux-x64
#SUPPORTED_OS[windows-x86_64]=win32-x64

TMP_DIR=$( mktemp -d -t vscode-create )
TMP_DIR=$( mktemp -d -t vscode-createXXX )
trap "clean_tmp_dir $TMP_DIR" EXIT

LANG_SERVER_DIR="language-server"
Expand All @@ -64,29 +63,29 @@ rm -rf $LANG_SERVER_DIR
mkdir $LANG_SERVER_DIR

for DIST_OS VSCODE_OS in "${(@kv)SUPPORTED_OS}"; do
# Iota distribution identifier
IOTA_DISTRO=$NETWORK"-v"$VERSION
# name of the Iota distribution archive file, for example iota-testnet-v1.0.0-macos-arm64.tgz
IOTA_ARCHIVE="iota-"$IOTA_DISTRO"-"$DIST_OS".tgz"
# IOTA distribution identifier
IOTA_VERSION="v"$VERSION
# name of the Iota distribution archive file, for example iota-v1.0.0-macos-arm64.tgz
IOTA_ARCHIVE="iota-"$IOTA_VERSION"-"$DIST_OS".tgz"
# a path to downloaded Iota archive
IOTA_ARCHIVE_PATH=$TMP_DIR"/"$IOTA_ARCHIVE

# download Iota archive file to a given location and uncompress it
curl https://github.com/iotaledger/iota/releases/download/"$IOTA_DISTRO"/"$IOTA_ARCHIVE" -L -o $IOTA_ARCHIVE_PATH
# download IOTA archive file to a given location and uncompress it
curl https://github.com/iotaledger/iota/releases/download/"$IOTA_VERSION"/"$IOTA_ARCHIVE" -L -o $IOTA_ARCHIVE_PATH
tar -xf $IOTA_ARCHIVE_PATH --directory $TMP_DIR

# names of the move-analyzer binary, both the one becoming part of the extension ($SERVER_BIN)
# and the one in the Iota archive ($ARCHIVE_SERVER_BIN)
SERVER_BIN="move-analyzer"
ARCHIVE_SERVER_BIN=$SERVER_BIN"-"$DIST_OS
ARCHIVE_SERVER_BIN=$SERVER_BIN
if [[ "$DIST_OS" == *"windows"* ]]; then
SERVER_BIN="$SERVER_BIN".exe
ARCHIVE_SERVER_BIN="$ARCHIVE_SERVER_BIN".exe
fi

# copy move-analyzer binary to the appropriate location where it's picked up when bundling the
# extension
SRC_SERVER_BIN_LOC=$TMP_DIR"/external-crates/move/target/release/"$ARCHIVE_SERVER_BIN
SRC_SERVER_BIN_LOC=$TMP_DIR"/"$ARCHIVE_SERVER_BIN
DST_SERVER_BIN_LOC=$LANG_SERVER_DIR"/"$SERVER_BIN
cp $SRC_SERVER_BIN_LOC $DST_SERVER_BIN_LOC

Expand Down
Loading