From b7cd429db475b17c873d61688afdea87e1559131 Mon Sep 17 00:00:00 2001 From: Chris Simon Date: Wed, 22 Nov 2023 06:58:02 +0000 Subject: [PATCH] experiment: testing vscode pipeline with on push trigger until it's on main --- .github/workflows/contextive-vscode.yml | 25 ++++++++----- src/language-server/build.fsx | 47 +++---------------------- src/vscode/build.fsx | 13 +++++++ 3 files changed, 33 insertions(+), 52 deletions(-) create mode 100644 src/vscode/build.fsx diff --git a/.github/workflows/contextive-vscode.yml b/.github/workflows/contextive-vscode.yml index 04f13adc..2b4e018e 100644 --- a/.github/workflows/contextive-vscode.yml +++ b/.github/workflows/contextive-vscode.yml @@ -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: @@ -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 diff --git a/src/language-server/build.fsx b/src/language-server/build.fsx index a3137f5c..37c0f8ac 100644 --- a/src/language-server/build.fsx +++ b/src/language-server/build.fsx @@ -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" @@ -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" } @@ -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 @@ -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" { diff --git a/src/vscode/build.fsx b/src/vscode/build.fsx new file mode 100644 index 00000000..d39103f6 --- /dev/null +++ b/src/vscode/build.fsx @@ -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 +}