Skip to content

Commit

Permalink
feat(CI): add Move IDE Tests workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
Thoralf-M committed Nov 26, 2024
1 parent 28692bf commit 6e3fbd4
Show file tree
Hide file tree
Showing 4 changed files with 161 additions and 12 deletions.
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 }}"
isMoveIDE:
description: True when changes happened in move-analyzer code
value: "${{ steps.diff.outputs.isMoveIDE }}"
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"
isMoveIDE:
- "external-crates/move/crates/move-analyzer/**"
isReleaseNotesEligible:
- "consensus/**"
- "crates/**"
Expand Down
133 changes: 133 additions & 0 deletions .github/workflows/_move_ide_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
name: Move IDE Tests

on: workflow_call

concurrency:
group: move-ide-tests-${{ 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: npm setup
uses: npm/action-setup@a3252b78c470c02df07e9d59298aecedc3ccdd6d # pin@v3.0.0
with:
version: 9.1.1

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

- 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 display)
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
npm install && npm install --save-dev @types/node @types/semver
sudo add-apt-repository ppa:kisak/kisak-mesa -y
sudo apt update
sudo apt upgrade -y
- 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: DISPLAY=:99.0 npm run test

move-ide-build:
name: Move IDE 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

move-ide-build-with-binaries:
name: Move IDE build with released binaries
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
npm install -g vsce
sudo apt install zsh -y
- name: Build VSCode extensions
working-directory: ./external-crates/move/crates/move-analyzer/editors/code
run: ./scripts/create.sh -pkg

- name: Print built files
working-directory: ./external-crates/move/crates/move-analyzer/editors/code
run: echo *.vsix
12 changes: 12 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 }}
isMoveIDE: ${{ steps.diff.outputs.isMoveIDE }}
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,14 @@ jobs:
- typos
uses: ./.github/workflows/_ledgernano.yml
secrets: inherit

move-ide-tests:
if: (!cancelled() && !failure()) && needs.diff.outputs.isMoveIDE == 'true'
# TODO: use this line
# if: (!cancelled() && !failure()) && needs.diff.outputs.isMoveIDE == 'true' && github.event.pull_request.draft == false
needs:
- diff
- dprint-format
- license-check
- typos
uses: ./.github/workflows/_move_ide_tests.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

0 comments on commit 6e3fbd4

Please sign in to comment.