diff --git a/.github/workflows/ci-cd.yml b/.github/workflows/ci-cd.yml index effbe006..d3db94f6 100644 --- a/.github/workflows/ci-cd.yml +++ b/.github/workflows/ci-cd.yml @@ -1,87 +1,150 @@ name: CI/CD on: - push: + push: + branches: + - main + - v* + tags: + - v* + pull_request: + workflow_dispatch: + inputs: + publish: + description: "Publish extension to VSCode Marketplace" + type: boolean + required: true + default: false + +concurrency: + group: ci-${{ github.ref }} + cancel-in-progress: true permissions: - contents: write + contents: write env: - TEST_TIMEOUT: 5m + TEST_TIMEOUT: 5m + BRANCH: ${{ startsWith(github.head_ref, '') && github.head_ref || github.ref_name }} jobs: - test: - timeout-minutes: 60 - strategy: - fail-fast: false - matrix: - os: [macos-latest, ubuntu-latest, windows-latest] - runs-on: ${{ matrix.os }} - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Install Node.js - uses: actions/setup-node@v4 - with: - node-version: 20 - - name: Install extension dependencies - run: yarn run install:all - - name: Build webview - if: matrix.os != 'macos-latest' - run: yarn run build:webview - # TODO: fix this command getting stuck on macos - - name: Build webview - if: matrix.os == 'macos-latest' - uses: nick-fields/retry@v3 - with: - timeout_minutes: 1 - max_attempts: 5 - command: yarn run build:webview - - name: Run tests - uses: coactions/setup-xvfb@v1 - with: - run: yarn test - env: - TEST_TIMEOUT: 2m + test: + timeout-minutes: 60 + strategy: + fail-fast: false + matrix: + include: + - os: windows-latest + platform: win32 + arch: x64 + npm_config_arch: x64 + - os: windows-latest + platform: win32 + arch: arm64 + npm_config_arch: arm + - os: ubuntu-latest + platform: linux + arch: x64 + npm_config_arch: x64 + - os: ubuntu-latest + platform: linux + arch: arm64 + npm_config_arch: arm64 + - os: ubuntu-latest + platform: linux + arch: armhf + npm_config_arch: arm + - os: ubuntu-latest + platform: alpine + arch: x64 + npm_config_arch: x64 + - os: ubuntu-latest + platform: alpine + arch: arm64 + npm_config_arch: arm64 + - os: macos-latest + platform: darwin + arch: x64 + npm_config_arch: x64 + - os: macos-latest + platform: darwin + arch: arm64 + npm_config_arch: arm64 + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v5 + - uses: actions/setup-node@v6 + with: + node-version: 20 + - name: Install extension dependencies + run: yarn run install:all + - name: Build webview + run: yarn run build:webview + - name: Run tests + uses: coactions/setup-xvfb@v1 + with: + run: yarn test + env: + TEST_TIMEOUT: 2m + - shell: pwsh + run: echo "target=${{ matrix.platform }}-${{ matrix.arch }}" >> $env:GITHUB_ENV + - run: npx --yes @vscode/vsce package --yarn --githubBranch ${{ env.BRANCH }} --target ${{ env.target }} + - uses: actions/upload-artifact@v5 + with: + name: code-blocks-${{ env.BRANCH }}-${{ env.target }} + path: "*.vsix" - package: - name: Package extension - needs: test - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Install Node.js - uses: actions/setup-node@v4 - with: - node-version: 20 - - name: Install extension dependencies - run: yarn run install:all - - name: Build webview - run: yarn run build:webview - - name: Package extension - run: npx --yes @vscode/vsce package --yarn --githubBranch ${{ github.ref_name }} - - name: Upload extension - uses: actions/upload-artifact@v4 - with: - name: code-blocks-${{ github.ref_name }}.vsix - path: code-blocks-*.vsix + examples: + name: Build examples + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v5 + - name: Install Node.js + uses: actions/setup-node@v6 + with: + node-version: 20 + - name: Install asset generation dependencies + run: | + sudo mkdir -p /usr/local/bin + sudo ln -sf /bin/true /usr/local/bin/mandb # no-op to skip man-db triggers + sudo DEBIAN_FRONTEND=noninteractive apt update + sudo DEBIAN_FRONTEND=noninteractive \ + apt install -y --no-install-recommends \ + ffmpeg libnss3 xvfb \ + -o Dpkg::Options::="--path-exclude=/usr/share/man/*" \ + -o Dpkg::Options::="--path-exclude=/usr/share/doc/*" + - name: Install extension dependencies + run: yarn run install:all + - name: Build webview + run: yarn run build:webview + - name: Build extension + run: yarn run compile + - name: Setting global vscode settings + run: cp -r ./out/examples/examples-editor/.vscode ~/.vscode + - name: Generate assets + run: | + chmod +x ./generate-assets.sh + chmod +x ./generate-example-asset.sh + ./generate-assets.sh ./out/examples . + - name: Upload assets + uses: actions/upload-artifact@v5 + with: + name: ${{ env.BRANCH }}-assets + path: | + *.gif - release: - name: Release extension - if: startsWith(github.ref, 'refs/tags/v') - needs: package - runs-on: ubuntu-latest - steps: - - name: Download package - uses: actions/download-artifact@v4 - with: - name: code-blocks-${{ github.ref_name }}.vsix - path: . - - name: Publish GitHub release - uses: softprops/action-gh-release@v1 - with: - generate_release_notes: true - files: code-blocks-*.vsix - # - name: Publish GitHub release - # run: npx @vscode/vsce publish -i $(ls code-blocks-*.vsix) + publish: + runs-on: ubuntu-latest + needs: test + if: success() && startsWith(github.ref, 'refs/tags/v') && github.event_name == 'workflow_dispatch' && inputs.publish == true + steps: + - uses: actions/download-artifact@v5 + - run: npx --yes @vscode/vsce publish --packagePath $(find . -iname *.vsix) + env: + VSCE_PAT: ${{ secrets.VSCE_PAT }} + - name: Publish GitHub release + uses: softprops/action-gh-release@v2 + with: + generate_release_notes: true + files: code-blocks-*.vsix diff --git a/.github/workflows/jekyll-gh-pages.yml b/.github/workflows/jekyll-gh-pages.yml index 4254a53b..07f81ad7 100644 --- a/.github/workflows/jekyll-gh-pages.yml +++ b/.github/workflows/jekyll-gh-pages.yml @@ -27,7 +27,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v5 - name: Setup Pages uses: actions/configure-pages@v3 - name: Build with Jekyll diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml deleted file mode 100644 index 691748f5..00000000 --- a/.github/workflows/pr.yml +++ /dev/null @@ -1,104 +0,0 @@ -name: Pull request checks - -on: - pull_request: - -env: - TEST_TIMEOUT: 5m - EXAMPLE_TIMEOUT: 5m - BRANCH: ${{ startsWith(github.head_ref, '') && github.head_ref || github.ref_name }} - -jobs: - test: - timeout-minutes: 60 - strategy: - fail-fast: false - matrix: - os: [macos-latest, ubuntu-latest, windows-latest] - runs-on: ${{ matrix.os }} - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Install Node.js - uses: actions/setup-node@v4 - with: - node-version: 20 - - name: Install extension dependencies - run: yarn run install:all - - name: Build webview - if: matrix.os != 'macos-latest' - run: yarn run build:webview - # TODO: fix this command getting stuck on macos - - name: Build webview - if: matrix.os == 'macos-latest' - uses: nick-fields/retry@v3 - with: - timeout_minutes: 1 - max_attempts: 5 - command: yarn run build:webview - - name: Run tests - uses: coactions/setup-xvfb@v1 - with: - run: yarn test - - examples: - name: Build examples - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Install Node.js - uses: actions/setup-node@v4 - with: - node-version: 20 - - name: Install asset generation dependencies - run: | - sudo mkdir -p /usr/local/bin - sudo ln -sf /bin/true /usr/local/bin/mandb # no-op to skip man-db triggers - sudo DEBIAN_FRONTEND=noninteractive apt update - sudo DEBIAN_FRONTEND=noninteractive \ - apt install -y --no-install-recommends \ - ffmpeg libnss3 xvfb \ - -o Dpkg::Options::="--path-exclude=/usr/share/man/*" \ - -o Dpkg::Options::="--path-exclude=/usr/share/doc/*" - - name: Install extension dependencies - run: yarn run install:all - - name: Build webview - run: yarn run build:webview - - name: Build extension - run: yarn run compile - - name: Setting global vscode settings - run: cp -r ./out/examples/examples-editor/.vscode ~/.vscode - - name: Generate assets - run: | - chmod +x ./generate-assets.sh - chmod +x ./generate-example-asset.sh - ./generate-assets.sh ./out/examples . - - name: Upload assets - uses: actions/upload-artifact@v4 - with: - name: ${{ env.BRANCH }}-assets - path: | - *.gif - - package: - name: Package extension - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Install Node.js - uses: actions/setup-node@v4 - with: - node-version: 20 - - name: Install extension dependencies - run: yarn run install:all - - name: Build webview - run: yarn run build:webview - - name: Package extension - run: npx --yes @vscode/vsce package --yarn --githubBranch ${{ env.BRANCH }} - - name: Upload extension - uses: actions/upload-artifact@v4 - with: - name: code-blocks-${{ env.BRANCH }}.vsix - path: code-blocks-*.vsix diff --git a/.github/workflows/update-assets.yml b/.github/workflows/update-assets.yml index acc1fee6..13e88102 100644 --- a/.github/workflows/update-assets.yml +++ b/.github/workflows/update-assets.yml @@ -16,9 +16,9 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v5 - name: Install Node.js - uses: actions/setup-node@v4 + uses: actions/setup-node@v6 with: node-version: 20 - name: Install asset generation dependencies diff --git a/.vscodeignore b/.vscodeignore index 68d19a62..802379a4 100644 --- a/.vscodeignore +++ b/.vscodeignore @@ -10,12 +10,6 @@ !out/extension.js !webview-ui/public -# keep only non-compiled dependency files !node_modules/node-gyp-build !node_modules/node-addon-api -!node_modules/tree-sitter/src -!node_modules/tree-sitter/vendor -!node_modules/tree-sitter/binding.gyp -!node_modules/tree-sitter/index.js -!node_modules/tree-sitter/package.json -!node_modules/tree-sitter/LICENSE +!node_modules/tree-sitter diff --git a/CHANGELOG.md b/CHANGELOG.md index 14e59e21..aced33fa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,8 @@ - Parser build method ([[#193](https://github.com/selfint/code-blocks/issues/193)]), now uses `node-gyp` instead of `tree-sitter-cli`. +- Binary dependency caused extension to fail on non-Mac systems ([#195](https://github.com/selfint/code-blocks/issues/195)). + ## Deprecated - Support for `node` v18, it might still work, but the extension now requires `node` v20+. diff --git a/package.json b/package.json index 85288804..f600c04f 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,7 @@ "email": "selfint@gmail.com" }, "homepage": "https://github.com/selfint/code-blocks#readme", - "icon": "./assets/extension-logo.png", + "icon": "assets/extension-logo.png", "galleryBanner": { "color": "#6295E3", "theme": "dark"