From fc0e1dde0e5be5e8346004fac50f2571c7db47a6 Mon Sep 17 00:00:00 2001 From: Discookie Date: Thu, 8 Jun 2023 13:15:23 +0200 Subject: [PATCH 1/3] Fix vsce package with yarn 2 --- .github/workflows/deploy.yml | 50 +++++++++++++---------------------- .github/workflows/package.yml | 49 ++++++++++++++++++++++++++++++++++ .github/workflows/test.yml | 20 ++++++++++++++ 3 files changed, 87 insertions(+), 32 deletions(-) create mode 100644 .github/workflows/package.yml diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 37f9fe3..9dacd18 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -6,12 +6,26 @@ on: types: [published] jobs: + version: + name: Version dummy + runs-on: ubuntu-22.04 + steps: + - name: Get the version + id: get_version + run: echo ::set-output name=version::${GITHUB_REF#refs/tags/} + 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. @@ -31,38 +45,10 @@ 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() @@ -70,4 +56,4 @@ jobs: with: pat: ${{ secrets[matrix.token] }} registryUrl: ${{ matrix.registryUrl }} - extensionFile: ${{ steps.build.outputs.vsixPath }} + extensionFile: ./${{ matrix.name }}-${{ needs.version.output.version }}.vsix diff --git a/.github/workflows/package.yml b/.github/workflows/package.yml new file mode 100644 index 0000000..78f4a69 --- /dev/null +++ b/.github/workflows/package.yml @@ -0,0 +1,49 @@ +name: Package CodeChecker VSCode extension + +# Triggers the workflow on push or pull request events. +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 ::set-output name=vsixPath::$(readlink -f *.vsix) + + - name: Create vsix artifact + if: success() + uses: actions/upload-artifact@master + with: + name: ${{ matrix.registry }}-package + path: ${{ steps.build.outputs.vsixPath }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c5c1685..e2f2180 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -4,21 +4,41 @@ name: codechecker-vscodeplugin-tests on: [push, pull_request, workflow_call] jobs: + version: + name: Version dummy + runs-on: ubuntu-22.04 + steps: + - name: Get the version + id: get_version + run: echo ::set-output name=version::0.0.0-$(echo ${GITHUB_SHA} | head -c 7) + + package: + needs: [version] + uses: ./.github/workflows/package.yml + with: + version: ${{ needs.version.outputs.version }} + test: name: Tests runs-on: ubuntu-22.04 + needs: [package] + 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/xvfb-action@v1.6 with: From b4c3ae2d4b06d6b5579d6a9a228494db2f1cf0ae Mon Sep 17 00:00:00 2001 From: Discookie Date: Thu, 8 Jun 2023 13:29:36 +0200 Subject: [PATCH 2/3] Update Actions outputs to new syntax --- .github/workflows/deploy.yml | 2 +- .github/workflows/package.yml | 2 +- .github/workflows/test.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 9dacd18..30d8d8f 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -12,7 +12,7 @@ jobs: steps: - name: Get the version id: get_version - run: echo ::set-output name=version::${GITHUB_REF#refs/tags/} + run: echo version=${GITHUB_REF#refs/tags/} >>$GITHUB_OUTPUT test: uses: ./.github/workflows/test.yml diff --git a/.github/workflows/package.yml b/.github/workflows/package.yml index 78f4a69..78917ae 100644 --- a/.github/workflows/package.yml +++ b/.github/workflows/package.yml @@ -39,7 +39,7 @@ jobs: 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 ::set-output name=vsixPath::$(readlink -f *.vsix) + echo vsixPath=$(readlink -f *.vsix) >>$GITHUB_OUTPUT - name: Create vsix artifact if: success() diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e2f2180..699e48c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -10,7 +10,7 @@ jobs: steps: - name: Get the version id: get_version - run: echo ::set-output name=version::0.0.0-$(echo ${GITHUB_SHA} | head -c 7) + run: echo version=0.0.0-$(echo ${GITHUB_SHA} | head -c 7) >>$GITHUB_OUTPUT package: needs: [version] From 4003c96ed3fa88b9b38c05624704b99fdf8a17c0 Mon Sep 17 00:00:00 2001 From: Discookie Date: Thu, 8 Jun 2023 14:14:22 +0200 Subject: [PATCH 3/3] Separate package and test passes --- .github/workflows/deploy.yml | 2 +- .github/workflows/package.yml | 1 - .github/workflows/test-commit.yml | 31 +++++++++++++++++++++++++++++++ .github/workflows/test.yml | 20 ++------------------ 4 files changed, 34 insertions(+), 20 deletions(-) create mode 100644 .github/workflows/test-commit.yml diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 30d8d8f..1c7f636 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -7,7 +7,7 @@ on: jobs: version: - name: Version dummy + name: Get version number runs-on: ubuntu-22.04 steps: - name: Get the version diff --git a/.github/workflows/package.yml b/.github/workflows/package.yml index 78917ae..ac2ff64 100644 --- a/.github/workflows/package.yml +++ b/.github/workflows/package.yml @@ -1,6 +1,5 @@ name: Package CodeChecker VSCode extension -# Triggers the workflow on push or pull request events. on: workflow_call: inputs: diff --git a/.github/workflows/test-commit.yml b/.github/workflows/test-commit.yml new file mode 100644 index 0000000..bf19c20 --- /dev/null +++ b/.github/workflows/test-commit.yml @@ -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: ":" diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 699e48c..e9d33ef 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,27 +1,11 @@ -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: - version: - name: Version dummy - 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: name: Tests runs-on: ubuntu-22.04 - needs: [package] steps: - uses: actions/checkout@v3