Skip to content

Commit

Permalink
Merge pull request #128 from Discookie/ericsson/fix-vsce
Browse files Browse the repository at this point in the history
Fix vsce rewriting and refactor tests
  • Loading branch information
vodorok authored Jun 9, 2023
2 parents e306b8f + 4003c96 commit b5b67ab
Show file tree
Hide file tree
Showing 4 changed files with 104 additions and 35 deletions.
50 changes: 18 additions & 32 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,26 @@ on:
types: [published]

jobs:
version:
name: Get version number
runs-on: ubuntu-22.04
steps:
- name: Get the version
id: get_version
run: echo version=${GITHUB_REF#refs/tags/} >>$GITHUB_OUTPUT

test:
uses: ./.github/workflows/test.yml
package:
needs: [version]
uses: ./.github/workflows/package.yml
with:
version: ${{ needs.version.output.version }}

build:
name: Create extension
runs-on: ubuntu-22.04
needs: [test]
needs: [test, package, version]

# Each registry should have the following fields:
# - name: unique extension id.
Expand All @@ -31,43 +45,15 @@ jobs:
token: VS_MARKETPLACE_TOKEN

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Install Node.js
uses: actions/setup-node@v1
with:
node-version: 16.x

- name: Enable Yarn 2
run: yarn set version stable

- name: Install dependencies
run: yarn install --immutable

- name: Get the version
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF#refs/tags/}

- name: Create vsix package
if: success()
id: build
run: |
sed -i 's/"name": "codechecker"/"name": "${{ matrix.name }}"/' package.json
yarn run vsce package --no-git-tag-version --yarn ${{ steps.get_version.outputs.VERSION }}
echo ::set-output name=vsixPath::$(readlink -f *.vsix)
- name: Create vsix artifact
if: success()
uses: actions/upload-artifact@master
- name: Get vsix artifact
uses: actions/download-artifact@v3
with:
name: ${{ matrix.registry }}-package
path: ${{ steps.build.outputs.vsixPath }}

- name: Publish package
if: success()
uses: HaaLeo/publish-vscode-extension@v1
with:
pat: ${{ secrets[matrix.token] }}
registryUrl: ${{ matrix.registryUrl }}
extensionFile: ${{ steps.build.outputs.vsixPath }}
extensionFile: ./${{ matrix.name }}-${{ needs.version.output.version }}.vsix
48 changes: 48 additions & 0 deletions .github/workflows/package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Package CodeChecker VSCode extension

on:
workflow_call:
inputs:
version:
required: true
type: string

jobs:
package:
name: Create extension package
runs-on: ubuntu-22.04

strategy:
matrix:
registry: [open-vsx, vs-marketplace]
include:
- registry: open-vsx
name: codechecker
- registry: vs-marketplace
name: vscode-codechecker

steps:
- uses: actions/checkout@v3

- name: Enable Yarn 2
run: yarn set version stable

- name: Install dependencies
run: yarn install --immutable

# Should be kept in sync with `deploy.yml`.
- name: Create vsix package
if: success()
id: build
run: |
sed -i 's/"name": "codechecker"/"name": "${{ matrix.name }}"/' package.json
sed -i 's/codechecker@workspace/${{ matrix.name }}@workspace/' yarn.lock
yarn run vsce package --no-git-tag-version --yarn ${{ inputs.version }}
echo vsixPath=$(readlink -f *.vsix) >>$GITHUB_OUTPUT
- name: Create vsix artifact
if: success()
uses: actions/upload-artifact@master
with:
name: ${{ matrix.registry }}-package
path: ${{ steps.build.outputs.vsixPath }}
31 changes: 31 additions & 0 deletions .github/workflows/test-commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: codechecker-vscodeplugin-tests

# Triggers the workflow on push or pull request events.
on: [push, pull_request]

jobs:
version:
name: Get version number
runs-on: ubuntu-22.04
steps:
- name: Get the version
id: get_version
run: echo version=0.0.0-$(echo ${GITHUB_SHA} | head -c 7) >>$GITHUB_OUTPUT

package:
needs: [version]
uses: ./.github/workflows/package.yml
with:
version: ${{ needs.version.outputs.version }}

test:
uses: ./.github/workflows/test.yml

# Needed to run the packaging and tests in parallel
test-commit:
name: Run commit tests
needs: [package, test]
runs-on: ubuntu-22.04
steps:
- name: Do nothing
run: ":"
10 changes: 7 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,28 @@
name: codechecker-vscodeplugin-tests
name: Run plugin tests

# Triggers the workflow on push or pull request events.
on: [push, pull_request, workflow_call]
on: [workflow_call]

jobs:
test:
name: Tests
runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@v3

- name: Enable Yarn 2
run: yarn set version stable

- name: Install dependencies
run: yarn install --immutable

- name: Install CodeChecker
run: |
sudo apt install -y clang-tidy
sudo snap install codechecker --classic
sudo snap alias codechecker CodeChecker
CodeChecker version
- name: Run tests
uses: GabrielBB/[email protected]
with:
Expand Down

0 comments on commit b5b67ab

Please sign in to comment.