diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml new file mode 100644 index 0000000..40fc59f --- /dev/null +++ b/.github/workflows/build-and-test.yml @@ -0,0 +1,94 @@ +name: Build and test + +# README: +# +# The semantics for running shell commands in GitHub actions is non-obvious. Please read +# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsshell +# before modifying this file. Our strategy is to rely on the built-in (unspecified) shell, and +# explicitly set the shell settings we want (with `set -eo pipefail`) at the beginning of any +# bash script. For more information on these settings, see `man bash`. +# +# GitHub Actions files can be difficult to modify with confidence, because testing changes often +# requires pushing to a branch and running CI remotely. To make this process easier, consider +# the following: +# +# 1) Use Visual Studio Code with the GitHub Actions Extension (github.vscode-github-actions). +# This allows you to check the validity of your action schema and syntax without pushing to a +# branch. +# 2) Use https://github.com/nektos/act to run your CI steps locally. Note this will only work with +# steps run on Linux platforms, as `act` is implemented with Docker containers. + +on: + workflow_call: + push: + tags: ["v*.*.*"] + branches: [ main ] + paths-ignore: + - "Docs/**" + - "**.md" + - "README.md" + - "LICENSE" + - ".gitignore" + # pull_request: + # branches: [ "**" ] + # paths-ignore: + # - "Docs/**" + # - "**.md" + # - "README.md" + # - "LICENSE" + # - ".gitignore" + +jobs: + package-vscode-extension: + name: "Package VSCode extension" + strategy: + fail-fast: false + matrix: + host: [ + { + type: linux, os: ubuntu-latest, + } + ] + + runs-on: ${{ matrix.host.os }} + steps: + - name: Checkout + uses: actions/checkout@v3 + + - uses: actions/setup-node@v3 + with: + node-version: 20 + + - uses: robinraju/release-downloader@v1.8 + with: + # The source repository path. + # Expected format {owner}/{repo} + # Default: ${{ github.repository }} + repository: koliyo/hylo-lsp + latest: ${{ github.ref == 'refs/heads/main' && 'true' || 'false' }} + tag: ${{ github.ref == 'refs/heads/main' && '' || format(github.ref_name) }} + extract: false + out-file-path: hylo-lsp-artifacts + + - name: Package VSCode extension + run: | + set -eo pipefail + DIST_DIR=dist + ARTIFACTS_DIR=hylo-lsp-artifacts + mkdir -p $DIST_DIR + rm -rf $DIST_DIR/stdlib + tar -xvf $ARTIFACTS_DIR/hylo-stdlib.tar.gz + tar -xvf $ARTIFACTS_DIR/hylo-lsp-mac.tar.gz + mv hylo-stdlib $DIST_DIR/stdlib + mkdir -p $DIST_DIR/bin/mac/arm64 + mv hylo-lsp-mac/hylo-lsp-server $DIST_DIR/bin/mac/arm64/ + npm install + npm run vscode:package + + - name: Upload VSCode extension artifacts + uses: actions/upload-artifact@v3 + with: + name: vscode-extension-artifacts + path: | + *.vsix + diff --git a/.github/workflows/publish-release-version.yml b/.github/workflows/publish-release-version.yml new file mode 100644 index 0000000..ddb0ca6 --- /dev/null +++ b/.github/workflows/publish-release-version.yml @@ -0,0 +1,46 @@ +name: Publish release version + +on: + push: + tags: ["v*.*.*"] + +jobs: + build: + uses: ./.github/workflows/build-and-test.yml + publish-release: + needs: [build] + strategy: + fail-fast: false + + matrix: + host: [ + { + type: macos, os: macos-13, + build-options: "--build-tests -Xswiftc -enable-testing", + # No coverage support on MacOS + test-options: "-v" + } + ] + + runs-on: ${{ matrix.host.os }} + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Download VSCode extension artifact + id: download-artifact + uses: dawidd6/action-download-artifact@v2 + with: + workflow: build-and-test.yml + name: vscode-extension-artifacts + + - name: Display structure of downloaded files + run: ls -R + + - name: Release + uses: softprops/action-gh-release@v1 + with: + files: | + CHANGELOG.md + LICENSE + vscode-extension-artifacts/*.vsix diff --git a/.vscodeignore b/.vscodeignore index 3899967..da79844 100644 --- a/.vscodeignore +++ b/.vscodeignore @@ -8,3 +8,4 @@ vsc-extension-quickstart.md **/.eslintrc.json **/*.map **/*.ts +hylo-lsp-*/** diff --git a/package.json b/package.json index 6ced25c..622a9eb 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "displayName": "Hylo", "description": "Hylo Language Support for VSCode", "license": "MIT", - "version": "0.5.0", + "version": "0.5.1", "repository": { "type": "git", "url": "https://koliyo/hylo-vscode-extension.git"