Skip to content
This repository has been archived by the owner on Jul 3, 2024. It is now read-only.

Commit

Permalink
merge: dev into main
Browse files Browse the repository at this point in the history
  • Loading branch information
0xmemorygrinder committed Nov 22, 2023
2 parents 6309e59 + 7369634 commit 7d53b7d
Show file tree
Hide file tree
Showing 288 changed files with 33,714 additions and 13,383 deletions.
91 changes: 91 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
on:
workflow_call:
inputs:
workspace:
required: true
type: string
description: "yarn workspace name"
command:
required: true
type: string
description: "yarn command to run"
workflow_dispatch:
inputs:
workspace:
required: true
type: string
description: "yarn workspace name"
command:
required: true
type: string
description: "yarn command to run"

jobs:
build:
strategy:
fail-fast: false
matrix:
include:
- os: windows-latest
target: x86_64-pc-windows-msvc
code-target: win32-x64
- os: windows-latest
target: i686-pc-windows-msvc
- os: windows-latest
target: aarch64-pc-windows-msvc
code-target: win32-arm64
- os: ubuntu-20.04
target: x86_64-unknown-linux-gnu
code-target: linux-x64
#container: ubuntu:18.04
#- os: ubuntu-20.04
# target: aarch64-unknown-linux-gnu
# code-target: linux-arm64
#- os: ubuntu-20.04
# target: arm-unknown-linux-gnueabihf
# code-target: linux-armhf
- os: macos-11
target: x86_64-apple-darwin
code-target: darwin-x64
- os: macos-11
target: aarch64-apple-darwin
code-target: darwin-arm64
runs-on: ${{ matrix.os }}
#container: ${{ matrix.container }}

steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3

- name: Setup yarn
id: setup-yarn
run: |
corepack enable
corepack prepare yarn@stable --activate
yarn set version stable
yarn -v
- name: Setup rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: ${{ matrix.target }}
override: true

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- run: yarn install --frozen-lockfile
if: steps.yarn-cache.outputs.cache-hit != 'true'

- run: yarn workspace ${{ inputs.workspace }} run ${{ inputs.command }}
env:
CARGO_BUILD_TARGET: ${{ matrix.target }}

163 changes: 125 additions & 38 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ on:
branches:
- main
- dev
# pull_request:
# branches: [master]
workflow_dispatch:

jobs:
find-last-commit:
Expand All @@ -27,18 +26,58 @@ jobs:
with:
from: ${{ github.sha }}
since: ${{ needs.find-last-commit.outputs.commit }}


publish:
publish-libraries:
if : ${{ needs.setup.outputs.libraries != '[]' }}
runs-on: ubuntu-latest
continue-on-error: true
needs: setup
strategy:
fail-fast: false
matrix:
workspace: ${{ fromJson(needs.setup.outputs.libraries)}}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-node@v3
with:
node-version: '18.16.1'

- id: setup-yarn
# Install yarn 3 & workspace-tools
run: |
corepack enable
corepack prepare yarn@stable --activate
yarn -v
- name: Install dependencies
run: |
yarn install --immutable
- name: Build
run: |
yarn workspace ${{ matrix.workspace.name }} build
- name: Publish
run: yarn workspace ${{ matrix.workspace.name }} run publish
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}

compute-version:
if : ${{ needs.setup.outputs.extensions != '[]' }}
strategy:
fail-fast: false
matrix:
workspace: ${{ fromJson(needs.setup.outputs.extensions)}}
runs-on: ubuntu-latest
needs:
- setup
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- uses: actions/setup-node@v3
with:
node-version: '18.16.1'
Expand All @@ -49,34 +88,51 @@ jobs:
corepack enable
corepack prepare yarn@stable --activate
yarn -v
yarn plugin import workspace-tools
- name: Get workspace path
id: workspace-path
run: |
echo "workspace-path=$(yarn workspaces info ${{ matrix.workspace.name }} --json | jq -r '.data[0].location')" >> $GITHUB_OUTPUT
- name: Check .unstable
id: check-unstable
run: |
cd ${{ steps.workspace-path.outputs.workspace-path }}
if [ -f ".unstable" ]; then
echo "is-unstable=true" >> $GITHUB_OUTPUT
else
echo "is-unstable=false" >> $GITHUB_OUTPUT
fi
- name: Get tag prefix
id: get-tag-prefix
uses: actions/github-script@v6
with:
result-encoding: string
script: |
const workspace = "${{ matrix.workspace.name }}";
const language = workspace.split('-')[1];
return language;
- uses: paulhatch/semantic-version@d43966692519e4a5d4423b3da1b4b903c58c8f6b
id: find-new-version
with:
# The prefix to use to identify tags
tag_prefix: ""
tag_prefix: "${{ steps.get-tag-prefix.outputs.result }}-"
# A string which, if present in a git commit, indicates that a change represents a
# major (breaking) change, supports regular expressions wrapped with '/'
major_pattern: "!:"
# Same as above except indicating a minor change, supports regular expressions wrapped with '/'
minor_pattern: "/feat\\(?/"
# A string to determine the format of the version output
version_format: "${major}.${minor}.${patch}"
# Optional path to check for changes. If any changes are detected in the path the
# 'changed' output will true. Enter multiple paths separated by spaces.
#change_path: "src/my-service"
# Named version, will be used as suffix for name version tag
namespace: my-service
# If this is set to true, *every* commit will be treated as a new version.
bump_each_commit: false
# If true, the body of commits will also be searched for major/minor patterns to determine the version type.
search_commit_body: false
# The output method used to generate list of users, 'csv' or 'json'.
user_format_type: "csv"
# Prevents pre-v1.0.0 version from automatically incrementing the major version.
# If enabled, when the major version is 0, major releases will be treated as minor and minor as patch. Note that the version_type output is unchanged.
enable_prerelease_mode: true
enable_prerelease_mode: ${{ steps.check-unstable.outputs.is-unstable }}

- name: Normalize version
uses: actions/github-script@v6
Expand All @@ -86,39 +142,70 @@ jobs:
script: |
const fs = require('fs')
console.log("Change type is : ", "${{ steps.find-new-version.outputs.version_type}}")
if (fs.existsSync('.unstable') && "${{ steps.find-new-version.outputs.version_type}}" == "patch") {
const patch = parseInt('${{steps.find-new-version.outputs.patch}}', 10);
return "${{steps.find-new-version.outputs.major}}.${{steps.find-new-version.outputs.minor}}." + (patch + 1).toString();
} else
return "${{steps.find-new-version.outputs.major}}.${{steps.find-new-version.outputs.minor}}.${{steps.find-new-version.outputs.patch}}"
- name: Set tag
run: |
git tag "${{ steps.get-tag-prefix.outputs.result }}-${{ steps.tag.outputs.result }}"
git push origin "${{ steps.get-tag-prefix.outputs.result }}-${{ steps.tag.outputs.result }}"
publish-core:
if: ${{ needs.setup.outputs.extensions != '[]' }}
needs:
- setup
- publish-libraries
- compute-version
strategy:
fail-fast: false
matrix:
workspace: ${{ fromJson(needs.setup.outputs.extensions)}}
runs-on: ubuntu-latest
continue-on-error: true
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-node@v3
with:
node-version: '18.16.1'

- id: setup-yarn
# Install yarn 3 & workspace-tools
run: |
corepack enable
corepack prepare yarn@stable --activate
yarn -v
- name: Install dependencies
run: |
yarn install --immutable
- name: Build
run: |
yarn workspace ${{ matrix.workspace.name }} build
yarn workspace ${{ matrix.workspace.name }} core:build
- name: Publish
run: yarn workspace ${{ matrix.workspace.name }} dlx @vscode/vsce publish ${{ github.ref_name == 'dev' && '--pre-release' || '' }} ${{ steps.tag.outputs.result }}
#- name: Run latest-tag
# uses: EndBug/latest-tag@latest
# with:
# # You can change the name of the tag or branch with this input.
# # Default: 'latest'
# ref: ${{ steps.tag.outputs.result }}
#
# # If a description is provided, the action will use it to create an annotated tag. If none is given, the action will create a lightweight tag.
# # Default: ''
# description: Description for the tag

# - name: Create GitHub release
# uses: Roang-zero1/github-create-release-action@v3
# with:
# created_tag: ${{ steps.find-new-version.outputs.version_tag }}
# release_title: ${{ steps.find-new-version.outputs.version_tag }}
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: yarn workspace ${{ matrix.workspace.name }} run core:publish
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}

publish-extensions:
if : ${{ needs.setup.outputs.extensions != '[]' }}
needs:
- setup
- publish-libraries
- compute-version
strategy:
fail-fast: false
matrix:
workspace: ${{ fromJson(needs.setup.outputs.extensions)}}
uses: ./.github/workflows/publish-extension.yml
with:
workspace: ${{ matrix.workspace.name }}
secrets:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
VSCE_PAT: ${{ secrets.VSCE_PAT }}
Loading

0 comments on commit 7d53b7d

Please sign in to comment.