Skip to content

Commit

Permalink
CI Pipeline Improvements (#27)
Browse files Browse the repository at this point in the history
Consolidates build & test into a single workflow file

Generates a VSIX vscode package during the build
  • Loading branch information
lbuesching committed Jan 11, 2024
1 parent 7e7f7fb commit d104062
Show file tree
Hide file tree
Showing 4 changed files with 90 additions and 54 deletions.
61 changes: 61 additions & 0 deletions .github/workflows/build_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# This workflow will build a .NET project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net

name: Build And Test

on:
workflow_call:
inputs:
environment:
description: Environment to run tests against
type: string
default: CI
test_args:
description: Additional arguments to dotnet test
type: string
build_configuration:
description: Whether to build debug or release configuration of the code
type: string
default: debug
store_artifacts:
description: Determines whether or not to upload artifacts
type: boolean
default: false

jobs:
build_test_archive:
runs-on: ubuntu-latest
environment: ${{ inputs.environment }}
steps:
- uses: actions/checkout@v3
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 8.0.x
- name: Setup NPM
uses: actions/setup-node@v3
with:
node-version: '18'
cache-dependency-path: './src/vscode/package-lock.json'
cache: 'npm'
- name: Restore NPM
run: npm install -g typescript vsce ovsx
- name: Restore dependencies
working-directory: ./src
run: dotnet restore
- name: Build
working-directory: ./src
run: dotnet build --configuration ${{ inputs.build_configuration }} --no-restore
- name: Package VSCode Plugin
working-directory: ./src/vscode
run: vsce package
- name: Upload Sage VSCode Plugin
if: ${{ inputs.store_artifacts }}
uses: actions/upload-artifact@v3
with:
name: VSCode-Plugin
path: ./src/vscode/*.vsix
retention-days: 3
- name: Test
working-directory: ./src
run: dotnet test --no-build --verbosity normal ${{ inputs.test_args }}
46 changes: 28 additions & 18 deletions .github/workflows/ci_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,36 @@ name: CI Tests

on:
push:
branches: [ "main" ]
branches: [ "main", "release", "ci-dev" ]
pull_request:
branches: [ "main" ]
branches: [ "main", "release", "ci-dev" ]

jobs:
build:
init:
runs-on: ubuntu-latest

outputs:
build_configuration: ${{ steps.set_buildconfig.outputs.build_configuration }}
steps:
- uses: actions/checkout@v3
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 8.0.x
- name: Restore dependencies
working-directory: ./src
run: dotnet restore
- name: Build
working-directory: ./src
run: dotnet build --no-restore
- name: Test
working-directory: ./src
run: dotnet test --no-build --verbosity normal --filter TestCategory!="Compatibility"
- name: Set release configuration for release branches
id: set_buildconfig
run: |
if [[ "${{ github.ref_name }}" == "release" ]]; then
echo "::set-output name=build_configuration::Release"
else
echo "::set-output name=build_configuration::Debug"
fi
build_test:
uses: ./.github/workflows/build_test.yml
needs: init
with:
test_args: --filter TestCategory!="Compatibility"
build_configuration: ${{ needs.init.outputs.build_configuration }}
store_artifacts: true
build_test_backward_compatibility:
uses: ./.github/workflows/build_test.yml
needs: init
with:
environment: "MC Integration"
test_args: --filter TestCategory="Compatibility"
build_configuration: ${{ needs.init.outputs.build_configuration }}
35 changes: 0 additions & 35 deletions .github/workflows/compatibility_tests.yml

This file was deleted.

2 changes: 1 addition & 1 deletion src/vscode/vscode.proj
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<Touch Files="node_modules/.install-stamp" AlwaysCreate="true" />
</Target>

<Target Name="NpmRunBuild" DependsOnTargets="NpmInstall" BeforeTargets="BeforeBuild">
<Target Name="NpmRunBuild" DependsOnTargets="NpmInstall" AfterTargets="AfterBuild">
<ItemGroup>
<SageOutput Include="..\Sage.Webhost\$(OutputPath)\**\*.*" />
</ItemGroup>
Expand Down

0 comments on commit d104062

Please sign in to comment.