Skip to content

Commit

Permalink
experiment: testing vscode pipeline with on push trigger until it's o…
Browse files Browse the repository at this point in the history
…n main
  • Loading branch information
chrissimon-au committed Nov 22, 2023
1 parent 50719de commit b7cd429
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 52 deletions.
25 changes: 16 additions & 9 deletions .github/workflows/contextive-vscode.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
name: Contextive VSCode Extension
on:
# temporary, for testing on branch
push:
paths:
- 'src/**'
- '.github/**'
# long term
workflow_run:
workflows: [Contextive Language Server]
types:
Expand All @@ -18,18 +24,19 @@ jobs:
build-and-test:
name: 'Build and Test'
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
# uncomment after finished branch testing
# if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- name: Triggered by '${{ github.event_name }}' @ '${{ github.ref }}''. Running on ${{ runner.os }}
run: |
echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event."
echo "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub!"
echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}."
- name: Checkout Repo
uses: actions/checkout@v3
- uses: actions/checkout@v3
with:
persist-credentials: false


- uses: ./.github/actions/init-dotnet

- name: Build
run: dotnet fsi vscode/build.fsx
working-directory: src


# - name: Restore npm dependencies
# run: npm install
Expand Down
47 changes: 4 additions & 43 deletions src/language-server/build.fsx
Original file line number Diff line number Diff line change
@@ -1,28 +1,11 @@
#r "nuget: Fun.Build, 1.0.4"
#load "../build/common.fsx"

open Fun.Build

type Component = { Name: string; Path: string }
open Common

let args =
{| dotnetRuntime =
CmdArg.Create(
"-r",
"--runtime",
"Dotnet Runtime for Publishing, see https://learn.microsoft.com/en-us/dotnet/core/rid-catalog#known-rids",
isOptional = true
)
dotnetVersion =
EnvArg.Create(
"DOTNET_VERSION",
"Version of the DotNet SDK",
isOptional = true

)
os = EnvArg.Create("RUNNER_OS", "Operating System", isOptional = true)
event = EnvArg.Create("GITHUB_EVENT_NAME", isOptional = true)
ref = EnvArg.Create("GITHUB_REF", isOptional = true)
repo = EnvArg.Create("GITHUB_REPOSITORY", isOptional = true) |}
type Component = { Name: string; Path: string }

let core =
{ Name = "Contextive.Core"
Expand All @@ -32,8 +15,6 @@ let languageServer =
{ Name = "Contextive.LanguageServer"
Path = "language-server/Contextive.LanguageServer" }

let env (envArg: EnvArg) =
System.Environment.GetEnvironmentVariable(envArg.Name)

let toolInstall tool =
stage $"Install {tool}" { run $"dotnet tool install {tool} --global" }
Expand All @@ -48,13 +29,6 @@ let dotnetTest app =
$"""dotnet test --logger "trx;LogFileName=TestResults.{app.Name}-{env args.dotnetVersion}-{env args.os}.xml" -- Expecto.fail-on-focused-tests=true Expecto.no-spinner=true Expecto.summary=true"""
}

let logGroup (s: Internal.StageContext) =
stage s.Name {
echo $"::group::{s.Name}"
s
echo "::endgroup::"
}

let dotnetPublish app =
stage $"Publish {app.Name}" {
workingDir app.Path
Expand All @@ -73,20 +47,7 @@ pipeline languageServer.Name {
description "Build & Test"
noPrefixForStep

logGroup
<| stage "Log Environment" {
run "dotnet --version"
whenEnvVar args.event
whenEnvVar args.os
whenEnvVar args.ref
whenEnvVar args.repo

echo
$"""
🎉 The job was automatically triggered by a {env args.event} event.
🐧 This job is now running on a {env args.os} server hosted by GitHub!
🔎 The name of your branch is {env args.ref} and your repository is {env args.repo}."""
}
logEnvironment

logGroup
<| stage "Setup Github Actions Runner" {
Expand Down
13 changes: 13 additions & 0 deletions src/vscode/build.fsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#r "nuget: Fun.Build, 1.0.4"
#load "../build/common.fsx"

open Fun.Build

open Common

pipeline "Contextive VsCode Extension" {
description "Build & Test"
noPrefixForStep

logEnvironment
}

0 comments on commit b7cd429

Please sign in to comment.