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

Initial working rust version, no tests #123

Merged
merged 15 commits into from
Oct 22, 2024
Merged
25 changes: 25 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
on:
push:
pull_request:

jobs:
build:
strategy:
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
toolchain: [stable]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 20.x
- run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }}
- run: cargo install wasm-pack
- run: npm install
- run: xvfb-run -a npm test
if: runner.os == 'Linux'
- run: npm test
if: runner.os != 'Linux'
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
out
node_modules
.vscode-test/
target/
*.vsix
.DS_Store
5 changes: 5 additions & 0 deletions .vscode-test.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { defineConfig } from '@vscode/test-cli';

export default defineConfig({
files: 'out/test/**/*.test.js',
});
59 changes: 30 additions & 29 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,33 +3,34 @@
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
{
"version": "0.2.0",
"configurations": [{
"name": "Run Extension",
"type": "extensionHost",
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}"
],
"outFiles": [
"${workspaceFolder}/out/**/*.js"
],
"preLaunchTask": "npm: watch"
},
{
"name": "Extension Tests",
"type": "extensionHost",
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}",
"--extensionTestsPath=${workspaceFolder}/out/test/suite/index"
],
"outFiles": [
"${workspaceFolder}/out/test/**/*.js"
],
"preLaunchTask": "npm: watch"
}
]
"version": "0.2.0",
"configurations": [
{
"name": "Run Extension",
"type": "extensionHost",
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}"
],
"outFiles": [
"${workspaceFolder}/out/**/*.js"
],
"preLaunchTask": "npm: compile"
},
{
"name": "Extension Tests",
"type": "extensionHost",
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}",
"--extensionTestsPath=${workspaceFolder}/out/test/suite/index.js"
],
"outFiles": [
"${workspaceFolder}/out/test/**/*.js"
],
"preLaunchTask": "npm: compile"
}
]
}
3 changes: 3 additions & 0 deletions .vscodeignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,6 @@ vsc-extension-quickstart.md
**/eslint.json
**/*.map
**/*.ts

target/**
Cargo.*
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

### Unreleased

* The main parsing logic has been migrated from typescript to rust. The parsing is exposed to the rest of the extension code via web assembly. This should be more responsive.
* Allow extension to run in untrusted workspaces. See [VS Code's documentation](https://code.visualstudio.com/api/extension-guides/workspace-trust) for more information.

### 1.18.0
Expand Down
169 changes: 169 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[package]
name = "pythonindent"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[lib]
crate-type = ["cdylib"]

[dependencies]
regex = "1.11.0"
wasm-bindgen = "0.2"
36 changes: 8 additions & 28 deletions DEVELOP.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,20 @@ Thank you for your interest in helping develop this extension. If you're new to

## Quickstart

1. Download node / npm
1. From the top level folder, run `npm install` to get the dependencies.
1. Download the [rust toolchain](https://www.rust-lang.org)
1. Install [wasm-pack](https://rustwasm.github.io/wasm-pack/installer/) (`cargo install wasm-pack`)
1. Download node (preferably with `nvm` so you can easily install new versions later) and npm
1. From the top level folder, run `npm install` to get the (javascript) dependencies.
1. Open this folder in vscode.
1. Make your changes
1. You can manually test your changes by navigating to "Run" -> "Run Extension" -> green arrow. This opens a sandboxed version of vscode with your updated extension.
1. You should add unit tests for your functionality as well. These go under `src/test/suite`. *Your PR will likely not be merged without unit tests.*
1. You can manually test your changes by navigating to "Run and Debug" -> "Run Extension" -> green arrow. This opens a sandboxed version of vscode with your updated extension.
1. You should add unit tests for your functionality as well. These go under `src/test/suite`, or in `src/lib.rs` if you are modifying the rust code. *Your PR will likely not be merged without unit tests.*

# Release check list

You will need [`vsce`](https://github.com/Microsoft/vscode-vsce) installed.

There is a long standing bug while authorizing the `vsce` command line tool, set the "Organization" to "All accessible organizations" during token creation even if there is only one organization to work around it.
If it has expired, get a new token. Follow the instructions [here](https://code.visualstudio.com/api/working-with-extensions/publishing-extension#get-a-personal-access-token).

1. The [CHANGELOG](./CHANGELOG.md) has been updated.
1. `git checkout master`
Expand All @@ -32,29 +34,7 @@ There is a long standing bug while authorizing the `vsce` command line tool, set

# Getting CI to work

Unfortunately, that yaml does not fully specify the build process. There remain settings
which are *uncontrollable from the pipeline yaml*. An export button exists on the azure website,
but it is greyed out and unclickable.

## Triggers

Despite what the [documentation](https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema?view=azure-devops&tabs=schema#triggers)
says, it doesn't seem like Azure Pipelines automatically trigger builds on branches or pull requests.
To get around this, `trigger` and `pr` sections were added to [azure-pipelines.yml](./azure-pipelines.yml).
However, `pr` builds are still not working correctly.

Even with these edits, pull requests from forks are not automatically enabled, and this must be enabled through the GUI.
As of writing, you can do this by going to pipelines page, clicking "Edit" ->
three veritcal dots -> "Triggers" -> "Pull request validation" ->
"Build pull requests from forks of this repository".

It is impossible to schedule builds in the YAML, so that must also be done through the GUI.

## GitHub has old pipeline names

If you update the name of the CI build pipeline, GitHub may continue to expect the old name.
To fix this, go to the repo settings page on GitHub -> branches -> "edit" next to the branch of your choice
-> check/uncheck the desired build names.
...

# Extension reporting hub

Expand Down
40 changes: 0 additions & 40 deletions azure-pipelines.yml

This file was deleted.

Loading