Skip to content

Commit

Permalink
fix: CI (#3)
Browse files Browse the repository at this point in the history
* fix: ci

* 2

* fix 3

* fix 4

* try fix 5

* fix6

* fix7

* fix8

* fix9

* fix10

* fix11

* build: prerelease
  • Loading branch information
CoolLoong authored Sep 4, 2024
1 parent 7aded86 commit adb054b
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 8 deletions.
21 changes: 14 additions & 7 deletions .github/ci.yml → .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,22 +48,29 @@ jobs:
toolchain: nightly
profile: minimal
override: true
- name: cross build
run: cargo install cross && cross build --verbose --release --target=${{ matrix.rust_target }}
- name: Install Cross
if: matrix.arch == 'arm64' && matrix.os == 'ubuntu-latest'
run: cargo install cross
- name: Build with Cargo or Cross
run: |
node -e "const { execSync } = require('child_process'); const arch = process.env.MATRIX_ARCH; const os = process.env.MATRIX_OS; const rustTarget = process.env.MATRIX_RUST_TARGET; if (arch === 'arm64' && os === 'ubuntu-latest') { console.log('Using cross to build...'); execSync('cross build --verbose --release --target=' + rustTarget, { stdio: 'inherit' }); } else { console.log('Using cargo to build...'); execSync('rustup set auto-self-update disable', { stdio: 'inherit' }); execSync('rustup target add ' + rustTarget, { stdio: 'inherit' }); execSync('cargo build --verbose --release --target=' + rustTarget, { stdio: 'inherit' }); }"
env:
MATRIX_ARCH: ${{ matrix.arch }}
MATRIX_OS: ${{ matrix.os }}
MATRIX_RUST_TARGET: ${{ matrix.rust_target }}
- run: npm install
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
npm_config_arch: ${{ matrix.npm_config_arch }}
- name: Move execute file
- name: build client and move execute file
run: |
npx webpack --mode production --config webpack.config.js
node -e "try {fs.renameSync('target/${process.env.TARGET}/release/jsonui-lsp', 'dist');}catch(err) {}"
node -e "try {fs.renameSync('target/${process.env.TARGET}/release/jsonui-lsp.exe', 'dist');}catch(err) {}"
node -e "const fs = require('fs'); const path = require('path'); const targetDir = process.env.TARGET; const sourcePaths = ['target/' + targetDir + '/release/jsonui-lsp', 'target/' + targetDir + '/release/jsonui-lsp.exe']; const destDir = 'dist'; sourcePaths.forEach(sourcePath => { const destPath = path.join(destDir, path.basename(sourcePath)); if (fs.existsSync(sourcePath)) { fs.renameSync(sourcePath, destPath); console.log('File', path.basename(sourcePath), 'moved successfully to', destPath); } else { console.log('File', path.basename(sourcePath), 'not found at', sourcePath); } });"
env:
TARGET: ${{ matrix.rust_target }}
- shell: pwsh
run: echo "target=${{ matrix.platform }}-${{ matrix.arch }}" >> $env:GITHUB_ENV
- run: npx vsce package --target ${{ env.target }}
- run: npx vsce package --pre-release --target ${{ env.target }}
- uses: actions/upload-artifact@v2
with:
name: ${{ env.target }}
Expand All @@ -75,6 +82,6 @@ jobs:
if: success() && startsWith( github.ref, 'refs/tags/')
steps:
- uses: actions/download-artifact@v2
- run: npx vsce publish --packagePath $(find . -iname *.vsix)
- run: npx vsce publish --pre-release --packagePath $(find . -iname *.vsix)
env:
VSCE_PAT: ${{ secrets.VSCE_PAT }}
1 change: 1 addition & 0 deletions .vscodeignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.cargo
.vscode
.github
client/**
node_modules
out
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
"onLanguage:json"
],
"scripts": {
"postinstall": "cd client && pnpm i",
"postinstall": "cd client && npm i",
"vscode:prepublish": "npm run build",
"test-compile": "tsc -p ./",
"compile": "cross-env NODE_ENV=production tsc -b",
Expand Down

0 comments on commit adb054b

Please sign in to comment.