name: CI
on: [push, pull_request]
jobs:
build:
name: ${{ matrix.config.kind }} ${{ matrix.config.os }}
runs-on: ${{ matrix.config.os }}
strategy:
matrix:
config:
- os: ubuntu-16.04
kind: test_release
- os: ubuntu-16.04
kind: test_debug
env:
CARGO_INCREMENTAL: 0
RUST_BACKTRACE: full
steps:
- uses: actions/checkout@v2
- name: Install wasm32 target
if: matrix.config.kind == 'test_release'
run: rustup target add wasm32-unknown-unknown
- name: Cache cargo
uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Build debug
if: matrix.config.kind == 'test_debug'
run: cargo build --verbose
- name: Build release
if: matrix.config.kind == 'test_release'
run: cargo build --target wasm32-unknown-unknown --features wasm --release --locked --verbose
- name: Test debug
if: matrix.config.kind == 'test_debug'
run: cargo test --verbose
- name: Test release
if: matrix.config.kind == 'test_release'
run: cargo test --release --locked --verbose
- name: Get tag version
if: matrix.config.kind == 'test_release' && startsWith(github.ref, 'refs/tags/')
id: get_tag_version
run: echo ::set-output name=TAG_VERSION::${GITHUB_REF/refs\/tags\//}
- name: Pre-release
if: matrix.config.kind == 'test_release' && startsWith(github.ref, 'refs/tags/')
run: |
cd target/wasm32-unknown-unknown/release/
mv dprint_plugin_jsonc.wasm json-${{ steps.get_tag_version.outputs.TAG_VERSION }}.wasm
- name: Release
uses: softprops/action-gh-release@v1
if: matrix.config.kind == 'test_release' && startsWith(github.ref, 'refs/tags/')
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: |
target/wasm32-unknown-unknown/release/json-${{ steps.get_tag_version.outputs.TAG_VERSION }}.wasm
body: |
## Install
[Install](https://dprint.dev/install/) and [setup](https://dprint.dev/setup/) dprint.
Then in your project's *.dprintrc.json*:
1. Specify the plugin url in the `"plugins"` array.
2. Ensure `.json` file extensions are matched in an `"includes"` pattern.
3. Add a `"json"` configuration property if desired.
```jsonc
{
// ...etc...
"json": {
// json config goes here
},
"includes": [
"**/*.{json}"
],
"plugins": [
"https://plugins.dprint.dev/json-${{ steps.get_tag_version.outputs.TAG_VERSION }}.wasm"
]
}
```
draft: true