update ci

This commit is contained in:
Nate Sesti 2024-08-10 17:14:46 -04:00
parent a6ba8f0588
commit ca3ea257e6
4 changed files with 35 additions and 38 deletions

View file

@ -1,11 +1,9 @@
name: Publish Extension
on:
push:
branches:
- main
pull_request:
types: [closed]
create:
tags:
- "v0.8.*-vscode"
branches:
- main
@ -49,8 +47,13 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
# 1. Check-out repository
- name: Check-out repository
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0 # This ensures all tags are fetched
- name: Checkout tag
run: git checkout ${GITHUB_REF#refs/tags/}
- name: Make sure version isn't odd
run: |
@ -99,14 +102,6 @@ jobs:
cd core
npm ci
# 2.25 Run core tests
- name: Run core tests
run: |
cd core
npm run test
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
# 2.5. Pre package
- name: Set var for environment info
shell: pwsh
@ -117,6 +112,14 @@ jobs:
cd extensions/vscode
npm run prepackage -- --target ${{ env.target }}
# 2.75 Run core tests
- name: Run core tests
run: |
cd core
npm run test
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
# 3. Re-install esbuild (for cases that we force installed for another arch in prepackage.js)
- name: Re-install esbuild
run: |
@ -125,19 +128,19 @@ jobs:
# 4. Run tests for the extension
# - name: Install Xvfb for Linux and run tests
# run: |
# sudo apt-get install -y xvfb # Install Xvfb
# Xvfb :99 & # Start Xvfb
# export DISPLAY=:99 # Export the display number to the environment
# cd extensions/vscode
# npm run test
# if: matrix.os == 'ubuntu-latest'
# run: |
# sudo apt-get install -y xvfb # Install Xvfb
# Xvfb :99 & # Start Xvfb
# export DISPLAY=:99 # Export the display number to the environment
# cd extensions/vscode
# npm run test
# if: matrix.os == 'ubuntu-latest'
- name: Run extension tests
run: |
cd extensions/vscode
npm run test
if: matrix.os != 'ubuntu-latest'
# - name: Run extension tests
# run: |
# cd extensions/vscode
# npm run test
# if: matrix.os != 'ubuntu-latest'
# 5. Package the extension
- name: Package the extension
@ -167,20 +170,10 @@ jobs:
# Download the .vsix artifacts
- uses: actions/download-artifact@v3
- name: Tag the repository
id: tag
run: |
# See https://docs.github.com/en/get-started/using-git/dealing-with-special-characters-in-branch-and-tag-names
TAG=v$(grep -o '"version": "[^"]*' extensions/vscode/package.json | cut -d'"' -f4)-vscode
echo "$TAG"
echo "tag=$TAG" >> $GITHUB_OUTPUT
git tag -a $TAG -m "Published version $TAG" ${GITHUB_SHA}
git push origin $TAG
- name: Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.tag.outputs.tag }}
tag_name: ${{ github.ref_name }}
files: |
alpine-x64/*.vsix
darwin-arm64/*.vsix

View file

@ -3,7 +3,7 @@ name: Publish Preview Extension
on:
create:
tags:
- "v*"
- "v0.9.*-vscode"
branches:
- dev

View file

@ -163,6 +163,10 @@ For the sake of rapid development, it is also possible to configure this communi
If you make changes to Kotlin code, they can often be hot-reloaded with "Run -> Debugging Actions -> Reload Changed Classes".
### Our Git Workflow
We keep two permanent branches: `main` and `dev`. All contributions should be made as pull requests to the `dev` branch. When we are ready to create a "pre-release" version, we create a tag on the `dev` branch, which automatically triggers the workflow in [preview.yaml](./.github/workflows/preview.yaml), which builds and releases a version of the VS Code extension. When a release has been sufficiently tested, we will merge its tag into the `main` branch. Creating a tag on the `main` branch will then trigger a similar workflow in [main.yaml](./.github/workflows/main.yaml), which will build and release a main release of the VS Code extension. Any hotfixes can be made by creating a feature branch from the tag for the release in question.
### Formatting
Continue uses [Prettier](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode) to format JavaScript/TypeScript. Please install the Prettier extension in VS Code and enable "Format on Save" in your settings.