diff --git a/.github/workflows/ci.generate.ts b/.github/workflows/ci.generate.ts index 984010d..5dcec7b 100644 --- a/.github/workflows/ci.generate.ts +++ b/.github/workflows/ci.generate.ts @@ -10,6 +10,7 @@ enum OperatingSystem { interface ProfileData { os: OperatingSystem; target: string; + cross?: boolean; runTests?: boolean; } @@ -38,6 +39,10 @@ const profileDataItems: ProfileData[] = [{ }, { os: OperatingSystem.Linux, target: "aarch64-unknown-linux-musl", +}, { + os: OperatingSystem.Linux, + cross: true, + target: "riscv64gc-unknown-linux-gnu", }]; const profiles = profileDataItems.map((profile) => { return { @@ -69,6 +74,7 @@ const ci = { os: profile.os, run_tests: (profile.runTests ?? false).toString(), target: profile.target, + cross: (profile.cross ?? false).toString(), })), }, }, @@ -91,8 +97,11 @@ const ci = { name: "Cache cargo", if: "startsWith(github.ref, 'refs/tags/') != true", uses: "Swatinem/rust-cache@v2", + with: { + key: "${{ matrix.config.target }}", + }, }, - { uses: "denoland/setup-deno@v1" }, + { uses: "denoland/setup-deno@v2" }, { name: "Setup (Linux x86_64-musl)", if: "matrix.config.target == 'x86_64-unknown-linux-musl'", @@ -116,14 +125,20 @@ const ci = { if: "matrix.config.target == 'aarch64-unknown-linux-musl'", run: [ "sudo apt update", - "sudo apt install gcc-aarch64-linux-gnu", - "sudo apt install musl musl-dev musl-tools", + "sudo apt install gcc-aarch64-linux-gnu musl musl-dev musl-tools", "rustup target add aarch64-unknown-linux-musl", ].join("\n"), }, + { + name: "Setup cross", + if: "matrix.config.cross == 'true'", + run: [ + "cargo install cross --git https://github.com/cross-rs/cross --rev 88f49ff79e777bef6d3564531636ee4d3cc2f8d2", + ].join("\n"), + }, { name: "Build (Debug)", - if: "!startsWith(github.ref, 'refs/tags/')", + if: "matrix.config.cross != 'true' && !startsWith(github.ref, 'refs/tags/')", env: { "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER": "aarch64-linux-gnu-gcc", }, @@ -131,12 +146,26 @@ const ci = { }, { name: "Build release", - if: "startsWith(github.ref, 'refs/tags/')", + if: "matrix.config.cross != 'true' && startsWith(github.ref, 'refs/tags/')", env: { "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER": "aarch64-linux-gnu-gcc", }, run: "cargo build --locked --all-targets --target ${{matrix.config.target}} --release", }, + { + name: "Build cross (Debug)", + if: "matrix.config.cross == 'true' && !startsWith(github.ref, 'refs/tags/')", + run: [ + "cross build --locked --target ${{matrix.config.target}}", + ].join("\n"), + }, + { + name: "Build cross (Release)", + if: "matrix.config.cross == 'true' && startsWith(github.ref, 'refs/tags/')", + run: [ + "cross build --locked --target ${{matrix.config.target}} --release", + ].join("\n"), + }, { name: "Lint", if: @@ -191,7 +220,7 @@ const ci = { name: `Upload artifacts (${profile.target})`, if: `matrix.config.target == '${profile.target}' && startsWith(github.ref, 'refs/tags/')`, - uses: "actions/upload-artifact@v2", + uses: "actions/upload-artifact@v4", with: { name: profile.artifactsName, path: `target/${profile.target}/release/${profile.zipFileName}`, @@ -206,9 +235,9 @@ const ci = { needs: "build", "runs-on": "ubuntu-latest", steps: [ - { name: "Checkout", uses: "actions/checkout@v2" }, - { name: "Download artifacts", uses: "actions/download-artifact@v2" }, - { uses: "denoland/setup-deno@v1" }, + { name: "Checkout", uses: "actions/checkout@v4" }, + { name: "Download artifacts", uses: "actions/download-artifact@v4" }, + { uses: "denoland/setup-deno@v2" }, { name: "Move downloaded artifacts to root directory", run: profiles.map((profile) => { diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2845598..5ddfe13 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -23,24 +23,35 @@ jobs: - os: macos-12 run_tests: 'true' target: x86_64-apple-darwin + cross: 'false' - os: macos-latest run_tests: 'true' target: aarch64-apple-darwin + cross: 'false' - os: windows-latest run_tests: 'true' target: x86_64-pc-windows-msvc + cross: 'false' - os: ubuntu-20.04 run_tests: 'true' target: x86_64-unknown-linux-gnu + cross: 'false' - os: ubuntu-20.04 run_tests: 'false' target: x86_64-unknown-linux-musl + cross: 'false' - os: ubuntu-20.04 run_tests: 'false' target: aarch64-unknown-linux-gnu + cross: 'false' - os: ubuntu-20.04 run_tests: 'false' target: aarch64-unknown-linux-musl + cross: 'false' + - os: ubuntu-20.04 + run_tests: 'false' + target: riscv64gc-unknown-linux-gnu + cross: 'true' outputs: ZIP_CHECKSUM_X86_64_APPLE_DARWIN: '${{steps.pre_release_x86_64_apple_darwin.outputs.ZIP_CHECKSUM}}' ZIP_CHECKSUM_AARCH64_APPLE_DARWIN: '${{steps.pre_release_aarch64_apple_darwin.outputs.ZIP_CHECKSUM}}' @@ -49,6 +60,7 @@ jobs: ZIP_CHECKSUM_X86_64_UNKNOWN_LINUX_MUSL: '${{steps.pre_release_x86_64_unknown_linux_musl.outputs.ZIP_CHECKSUM}}' ZIP_CHECKSUM_AARCH64_UNKNOWN_LINUX_GNU: '${{steps.pre_release_aarch64_unknown_linux_gnu.outputs.ZIP_CHECKSUM}}' ZIP_CHECKSUM_AARCH64_UNKNOWN_LINUX_MUSL: '${{steps.pre_release_aarch64_unknown_linux_musl.outputs.ZIP_CHECKSUM}}' + ZIP_CHECKSUM_RISCV64GC_UNKNOWN_LINUX_GNU: '${{steps.pre_release_riscv64gc_unknown_linux_gnu.outputs.ZIP_CHECKSUM}}' env: CARGO_INCREMENTAL: 0 RUST_BACKTRACE: full @@ -58,7 +70,9 @@ jobs: - name: Cache cargo if: 'startsWith(github.ref, ''refs/tags/'') != true' uses: Swatinem/rust-cache@v2 - - uses: denoland/setup-deno@v1 + with: + key: '${{ matrix.config.target }}' + - uses: denoland/setup-deno@v2 - name: Setup (Linux x86_64-musl) if: matrix.config.target == 'x86_64-unknown-linux-musl' run: |- @@ -75,19 +89,27 @@ jobs: if: matrix.config.target == 'aarch64-unknown-linux-musl' run: |- sudo apt update - sudo apt install gcc-aarch64-linux-gnu - sudo apt install musl musl-dev musl-tools + sudo apt install gcc-aarch64-linux-gnu musl musl-dev musl-tools rustup target add aarch64-unknown-linux-musl + - name: Setup cross + if: matrix.config.cross == 'true' + run: 'cargo install cross --git https://github.com/cross-rs/cross --rev 88f49ff79e777bef6d3564531636ee4d3cc2f8d2' - name: Build (Debug) - if: '!startsWith(github.ref, ''refs/tags/'')' + if: 'matrix.config.cross != ''true'' && !startsWith(github.ref, ''refs/tags/'')' env: CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc run: 'cargo build --locked --all-targets --target ${{matrix.config.target}}' - name: Build release - if: 'startsWith(github.ref, ''refs/tags/'')' + if: 'matrix.config.cross != ''true'' && startsWith(github.ref, ''refs/tags/'')' env: CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc run: 'cargo build --locked --all-targets --target ${{matrix.config.target}} --release' + - name: Build cross (Debug) + if: 'matrix.config.cross == ''true'' && !startsWith(github.ref, ''refs/tags/'')' + run: 'cross build --locked --target ${{matrix.config.target}}' + - name: Build cross (Release) + if: 'matrix.config.cross == ''true'' && startsWith(github.ref, ''refs/tags/'')' + run: 'cross build --locked --target ${{matrix.config.target}} --release' - name: Lint if: '!startsWith(github.ref, ''refs/tags/'') && matrix.config.target == ''x86_64-unknown-linux-gnu''' run: cargo clippy @@ -145,48 +167,61 @@ jobs: cd target/aarch64-unknown-linux-musl/release zip -r dprint-plugin-exec-aarch64-unknown-linux-musl.zip dprint-plugin-exec echo "::set-output name=ZIP_CHECKSUM::$(shasum -a 256 dprint-plugin-exec-aarch64-unknown-linux-musl.zip | awk '{print $1}')" + - name: Pre-release (riscv64gc-unknown-linux-gnu) + id: pre_release_riscv64gc_unknown_linux_gnu + if: 'matrix.config.target == ''riscv64gc-unknown-linux-gnu'' && startsWith(github.ref, ''refs/tags/'')' + run: |- + cd target/riscv64gc-unknown-linux-gnu/release + zip -r dprint-plugin-exec-riscv64gc-unknown-linux-gnu.zip dprint-plugin-exec + echo "::set-output name=ZIP_CHECKSUM::$(shasum -a 256 dprint-plugin-exec-riscv64gc-unknown-linux-gnu.zip | awk '{print $1}')" - name: Upload artifacts (x86_64-apple-darwin) if: 'matrix.config.target == ''x86_64-apple-darwin'' && startsWith(github.ref, ''refs/tags/'')' - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: x86_64-apple-darwin-artifacts path: target/x86_64-apple-darwin/release/dprint-plugin-exec-x86_64-apple-darwin.zip - name: Upload artifacts (aarch64-apple-darwin) if: 'matrix.config.target == ''aarch64-apple-darwin'' && startsWith(github.ref, ''refs/tags/'')' - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: aarch64-apple-darwin-artifacts path: target/aarch64-apple-darwin/release/dprint-plugin-exec-aarch64-apple-darwin.zip - name: Upload artifacts (x86_64-pc-windows-msvc) if: 'matrix.config.target == ''x86_64-pc-windows-msvc'' && startsWith(github.ref, ''refs/tags/'')' - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: x86_64-pc-windows-msvc-artifacts path: target/x86_64-pc-windows-msvc/release/dprint-plugin-exec-x86_64-pc-windows-msvc.zip - name: Upload artifacts (x86_64-unknown-linux-gnu) if: 'matrix.config.target == ''x86_64-unknown-linux-gnu'' && startsWith(github.ref, ''refs/tags/'')' - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: x86_64-unknown-linux-gnu-artifacts path: target/x86_64-unknown-linux-gnu/release/dprint-plugin-exec-x86_64-unknown-linux-gnu.zip - name: Upload artifacts (x86_64-unknown-linux-musl) if: 'matrix.config.target == ''x86_64-unknown-linux-musl'' && startsWith(github.ref, ''refs/tags/'')' - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: x86_64-unknown-linux-musl-artifacts path: target/x86_64-unknown-linux-musl/release/dprint-plugin-exec-x86_64-unknown-linux-musl.zip - name: Upload artifacts (aarch64-unknown-linux-gnu) if: 'matrix.config.target == ''aarch64-unknown-linux-gnu'' && startsWith(github.ref, ''refs/tags/'')' - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: aarch64-unknown-linux-gnu-artifacts path: target/aarch64-unknown-linux-gnu/release/dprint-plugin-exec-aarch64-unknown-linux-gnu.zip - name: Upload artifacts (aarch64-unknown-linux-musl) if: 'matrix.config.target == ''aarch64-unknown-linux-musl'' && startsWith(github.ref, ''refs/tags/'')' - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: aarch64-unknown-linux-musl-artifacts path: target/aarch64-unknown-linux-musl/release/dprint-plugin-exec-aarch64-unknown-linux-musl.zip + - name: Upload artifacts (riscv64gc-unknown-linux-gnu) + if: 'matrix.config.target == ''riscv64gc-unknown-linux-gnu'' && startsWith(github.ref, ''refs/tags/'')' + uses: actions/upload-artifact@v4 + with: + name: riscv64gc-unknown-linux-gnu-artifacts + path: target/riscv64gc-unknown-linux-gnu/release/dprint-plugin-exec-riscv64gc-unknown-linux-gnu.zip draft_release: name: draft_release if: 'startsWith(github.ref, ''refs/tags/'')' @@ -194,10 +229,10 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Download artifacts - uses: actions/download-artifact@v2 - - uses: denoland/setup-deno@v1 + uses: actions/download-artifact@v4 + - uses: denoland/setup-deno@v2 - name: Move downloaded artifacts to root directory run: |- mv x86_64-apple-darwin-artifacts/dprint-plugin-exec-x86_64-apple-darwin.zip . @@ -207,6 +242,7 @@ jobs: mv x86_64-unknown-linux-musl-artifacts/dprint-plugin-exec-x86_64-unknown-linux-musl.zip . mv aarch64-unknown-linux-gnu-artifacts/dprint-plugin-exec-aarch64-unknown-linux-gnu.zip . mv aarch64-unknown-linux-musl-artifacts/dprint-plugin-exec-aarch64-unknown-linux-musl.zip . + mv riscv64gc-unknown-linux-gnu-artifacts/dprint-plugin-exec-riscv64gc-unknown-linux-gnu.zip . - name: Output checksums run: |- echo "dprint-plugin-exec-x86_64-apple-darwin.zip: ${{needs.build.outputs.ZIP_CHECKSUM_X86_64_APPLE_DARWIN}}" @@ -216,6 +252,7 @@ jobs: echo "dprint-plugin-exec-x86_64-unknown-linux-musl.zip: ${{needs.build.outputs.ZIP_CHECKSUM_X86_64_UNKNOWN_LINUX_MUSL}}" echo "dprint-plugin-exec-aarch64-unknown-linux-gnu.zip: ${{needs.build.outputs.ZIP_CHECKSUM_AARCH64_UNKNOWN_LINUX_GNU}}" echo "dprint-plugin-exec-aarch64-unknown-linux-musl.zip: ${{needs.build.outputs.ZIP_CHECKSUM_AARCH64_UNKNOWN_LINUX_MUSL}}" + echo "dprint-plugin-exec-riscv64gc-unknown-linux-gnu.zip: ${{needs.build.outputs.ZIP_CHECKSUM_RISCV64GC_UNKNOWN_LINUX_GNU}}" - name: Create plugin file run: deno run --allow-read=. --allow-write=. scripts/create_plugin_file.ts - name: Get tag version @@ -239,6 +276,7 @@ jobs: dprint-plugin-exec-x86_64-unknown-linux-musl.zip dprint-plugin-exec-aarch64-unknown-linux-gnu.zip dprint-plugin-exec-aarch64-unknown-linux-musl.zip + dprint-plugin-exec-riscv64gc-unknown-linux-gnu.zip plugin.json deployment/schema.json body: |- diff --git a/dprint.json b/dprint.json index 8216384..77ac420 100644 --- a/dprint.json +++ b/dprint.json @@ -1,5 +1,4 @@ { - "incremental": true, "indentWidth": 2, "lineWidth": 100, "exec": { @@ -15,10 +14,10 @@ "**/*-lock.json" ], "plugins": [ - "https://plugins.dprint.dev/json-0.19.3.wasm", - "https://plugins.dprint.dev/markdown-0.17.1.wasm", - "https://plugins.dprint.dev/toml-0.6.2.wasm", + "https://plugins.dprint.dev/json-0.19.4.wasm", + "https://plugins.dprint.dev/markdown-0.17.8.wasm", + "https://plugins.dprint.dev/toml-0.6.3.wasm", "https://plugins.dprint.dev/exec-0.5.0.json@8d9972eee71fa1590e04873540421f3eda7674d0f1aae3d7c788615e7b7413d0", - "https://plugins.dprint.dev/typescript-0.91.3.wasm" + "https://plugins.dprint.dev/typescript-0.93.3.wasm" ] } diff --git a/scripts/create_plugin_file.ts b/scripts/create_plugin_file.ts index 0ae60d3..3b02137 100644 --- a/scripts/create_plugin_file.ts +++ b/scripts/create_plugin_file.ts @@ -1,15 +1,15 @@ -import * as path from "https://deno.land/std@0.153.0/path/mod.ts"; import { - extractCargoVersionOrThrow, + $, + CargoToml, processPlugin, -} from "https://raw.githubusercontent.com/dprint/automation/0.7.0/mod.ts"; +} from "https://raw.githubusercontent.com/dprint/automation/0.10.0/mod.ts"; -const currentDirPath = path.dirname(path.fromFileUrl(import.meta.url)); -const cargoFilePath = path.join(currentDirPath, "../", "Cargo.toml"); +const currentDirPath = $.path(import.meta.dirname!); +const cargoFilePath = currentDirPath.join("../Cargo.toml"); await processPlugin.createDprintOrgProcessPlugin({ pluginName: "dprint-plugin-exec", - version: await extractCargoVersionOrThrow(cargoFilePath), + version: new CargoToml(cargoFilePath).version(), platforms: [ "darwin-aarch64", "darwin-x86_64", @@ -17,6 +17,7 @@ await processPlugin.createDprintOrgProcessPlugin({ "linux-aarch64-musl", "linux-x86_64", "linux-x86_64-musl", + "linux-riscv64", "windows-x86_64", ], isTest: Deno.args.some(a => a == "--test"), diff --git a/scripts/generate_release_notes.ts b/scripts/generate_release_notes.ts index 680707a..f7444aa 100644 --- a/scripts/generate_release_notes.ts +++ b/scripts/generate_release_notes.ts @@ -1,4 +1,4 @@ -import { generateChangeLog } from "https://raw.githubusercontent.com/dprint/automation/0.9.0/changelog.ts"; +import { generateChangeLog } from "https://raw.githubusercontent.com/dprint/automation/0.10.0/changelog.ts"; const version = Deno.args[0]; const checksum = Deno.args[1];