Skip to content

Commit

Permalink
CI build workflow (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
koliyo authored Oct 1, 2023
1 parent 0663ce7 commit bb81bec
Show file tree
Hide file tree
Showing 4 changed files with 142 additions and 1 deletion.
94 changes: 94 additions & 0 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
@@ -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/[email protected]
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
46 changes: 46 additions & 0 deletions .github/workflows/publish-release-version.yml
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions .vscodeignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ vsc-extension-quickstart.md
**/.eslintrc.json
**/*.map
**/*.ts
hylo-lsp-*/**
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit bb81bec

Please sign in to comment.