easy-install 1.3.0

easy-install
Documentation
name: Test

permissions:
  contents: write

on: [push]
env:
  GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

defaults:
  run:
    shell: bash --noprofile --norc -CeEuo pipefail {0}

jobs:
  rust-test:
    strategy:
      matrix:
        os: [
          ubuntu-24.04,
          windows-latest,
          macos-latest,
          macos-13,
        ]
    runs-on: ${{ matrix.os }}
    env:
      GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
    steps:
      - uses: actions/checkout@v3
      - uses: actions/setup-node@v4
      - name: Install latest nightly
        uses: actions-rs/toolchain@v1
        with:
          toolchain: nightly
          override: true
      - name: cargo test
        # FIXME: add macos test
        if: matrix.os == 'ubuntu-24.04' || matrix.os == 'windows-latest'
        run: |
          cargo test

      - name: install

        run: |
          if [ ! -f ~/.bashrc ]; then
              touch ~/.bashrc
          fi

          cargo run -- starship
          cargo run -- https://github.com/denoland/deno
          cargo run -- https://github.com/ahaoboy/mujs-build
          cargo run -- https://github.com/ahaoboy/neofetch
          cargo run -- https://github.com/axodotdev/cargo-dist
          cargo run -- https://github.com/ahaoboy/jsc-build
          cargo run -- https://github.com/ahaoboy/spidermonkey-build
          cargo run -- https://github.com/ahaoboy/v8-build
          cargo run -- https://github.com/ahaoboy/txiki.js-build
          cargo run -- https://github.com/easy-install/easy-install/releases/latest/download/ffmpeg.json

          for file in ./dist-manifest/*.json; do
            echo $file
            cargo run -- $file
            source ~/.bashrc
          done

      - name: test which on windows
        if: matrix.os == 'windows-latest'
        shell: powershell
        run: |
          $env:PATH -split ';' | Write-Host

          Copy-Item -Path "C:\Users\runneradmin\.easy-install\graaljs\bin\js.exe" -Destination "C:\Users\runneradmin\.easy-install\graaljs\bin\graaljs.exe"

          get-command mujs
          get-command neofetch
          get-command dist
          get-command deno
          get-command ffmpeg
          get-command zig
          get-command llrt
          get-command alist
          get-command bun
          get-command fnm
          get-command 7z
          get-command starship
          get-command ScreenToGif
          get-command yt-dlp
          get-command pnpm
          get-command biome
          get-command qjs
          get-command qjsc
          get-command boa
          get-command graaljs
          get-command hermes
          get-command xst
          get-command mpv
          get-command esbuild
          get-command rcedit

      - name: test which on ubuntu
        if: matrix.os == 'ubuntu-24.04'
        run: |
          echo $PATH
          # cp /usr/local/bin/graaljs/bin/js /usr/local/bin/graaljs/bin/graaljs
          mv ~/.easy-install/graaljs/bin/js ~/.easy-install/graaljs/bin/graaljs
          # cat ~/.bashrc
          # source ~/.bashrc
          # echo $PATH

          which jsc
          which js
          which d8
          which deno
          which ffmpeg
          which zig
          which llrt
          which alist
          which bun
          which fnm
          which 7z
          which starship
          which yt-dlp
          which pnpm
          which biome
          which qjs
          which qjsc
          which boa
          which graaljs
          which hermes
          which xst
          which esbuild

          echo "var o=Function('return this')(),n=o.print||o.console.log;n('hello world')" >> test.js
          d8 ./test.js
          js ./test.js
          jsc ./test.js
          boa ./test.js
          llrt ./test.js

      - name: test which on macos
        if: startsWith(matrix.os, 'macos')
        run: |
          echo $PATH
          # cp /usr/local/bin/graaljs/bin/js /usr/local/bin/graaljs/bin/graaljs
          # mv ~/.easy-install/graaljs/bin/js ~/.easy-install/graaljs/bin/graaljs

          # which deno
          which zig
          which llrt
          which alist
          which mujs
          # which bun
          which fnm
          # which 7z
          # which starship
          # which yt-dlp
          which pnpm
          which biome
          which qjs
          which qjsc
          # which boa
          # which graaljs
          # which js
          which hermes
          which xst
          which esbuild
          fnm --version

          echo "var o=Function('return this')(),n=o.print||o.console.log;n('hello world')" >> test.js
          # d8 ./test.js
          # js ./test.js
          # jsc ./test.js
          mujs test.js
          qjs test.js
          # boa test.js
          llrt ./test.js

  js-test:
    strategy:
      matrix:
        os: [ubuntu-24.04, windows-latest, macos-latest, macos-13]
    runs-on: ${{ matrix.os }}
    env:
      GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
    steps:
      - uses: actions/checkout@v3
      - uses: actions/setup-node@v4
      - uses: pnpm/action-setup@v4
        with:
          version: 10
      - name: vitest
        run: |
          pnpm install
          pnpm run build
          pnpm run test:run
      - name: install
        run: |
          if [ ! -f ~/.bashrc ]; then
              touch ~/.bashrc
          fi

          # skip when release
          # ./cli/cli.js https://github.com/easy-install/easy-install

          ./cli/cli.js https://github.com/denoland/deno
          ./cli/cli.js https://github.com/starship/starship
          ./cli/cli.js https://github.com/ahaoboy/mujs-build
          ./cli/cli.js https://github.com/ahaoboy/neofetch
          ./cli/cli.js https://github.com/axodotdev/cargo-dist
          ./cli/cli.js https://github.com/ahaoboy/jsc-build
          ./cli/cli.js https://github.com/ahaoboy/spidermonkey-build
          ./cli/cli.js https://github.com/ahaoboy/v8-build
          ./cli/cli.js https://github.com/ahaoboy/txiki.js-build
          for file in ./dist-manifest/*.json; do
            echo $file
            ./cli/cli.js $file
            source ~/.bashrc
          done

          ls -lhR ~/.easy-install

      - name: test windows
        if: matrix.os == 'windows-latest'
        shell: powershell
        run: |
          $env:PATH -split ';' | Write-Host

          Copy-Item -Path "C:\Users\runneradmin\.easy-install\graaljs\bin\js.exe" -Destination "C:\Users\runneradmin\.easy-install\graaljs\bin\graaljs.exe"

          get-command mujs
          get-command neofetch
          get-command dist
          get-command deno
          get-command denort
          get-command ffmpeg
          get-command zig
          get-command llrt
          get-command alist
          get-command bun
          get-command fnm
          get-command 7z
          get-command starship
          get-command ScreenToGif
          get-command yt-dlp
          get-command pnpm
          get-command biome
          get-command qjs
          get-command qjsc
          get-command boa
          get-command graaljs
          get-command hermes
          get-command xst
          get-command mpv
          get-command esbuild
          get-command rcedit
          get-command tjs

      - name: test ubuntu
        if: matrix.os == 'ubuntu-24.04'
        run: |
          echo $PATH
          mv ~/.easy-install/graaljs/bin/js ~/.easy-install/graaljs/bin/graaljs
          # cat ~/.bashrc
          # source ~/.bashrc
          # echo $PATH

          which jsc
          which js
          which d8
          which deno
          which denort
          which ffmpeg
          which zig
          which llrt
          which alist
          which bun
          which fnm
          which 7z
          which starship
          which yt-dlp
          which pnpm
          which biome
          which qjs
          which qjsc
          which boa
          which graaljs
          which hermes
          which xst
          which esbuild
          which tjs

          echo "var o=Function('return this')(),n=o.print||o.console.log;n('hello world')" >> test.js
          d8 ./test.js
          js ./test.js
          jsc ./test.js
          llrt ./test.js

      - name: test macos
        if: startsWith(matrix.os, 'macos')
        run: |
          # which ei
          which dist
          which js
          which starship
          which qjs
          which qjsc
          # which boa
          which llrt
          which hermes
          which xst
          which tjs
          which pnpm