diff --git a/.github/workflows/ci-workflow.yml b/.github/workflows/ci-workflow.yml new file mode 100644 index 0000000..282a50a --- /dev/null +++ b/.github/workflows/ci-workflow.yml @@ -0,0 +1,52 @@ +name: Continuous Integration +on: [push] # Will make the workflow run every time you push to any branch + +jobs: + build: + name: Build and test + runs-on: ubuntu-latest # Sets the build environment a machine with the latest Ubuntu installed + steps: + - uses: actions/checkout@v4 # Adds a step to checkout the repository code + + - name: Build c-sharp + run: dotnet build + + - name: Install dependancies + working-directory: ./DotnetTemplate.Web + run: npm install + + - name: Build TypeScript + working-directory: ./DotnetTemplate.Web + run: npm run build + + - name: Run TS linter + working-directory: ./DotnetTemplate.Web + run: npm run lint + + - name: Run TS tests + working-directory: ./DotnetTemplate.Web + run: npm t + + - name: Run c-sharp tests + run: dotnet test + + - name: Post to slack + id: slack + uses: slackapi/slack-github-action@v1.26.0 + with: + payload: | + { + "text": "Your MR pipeline has finished! Result: ${{ job.status }}\n${{ github.event.pull_request.html_url || github.event.head_commit.url }}", + "blocks": [ + { + "type": "section", + "text": { + "type": "mrkdwn", + "text": "GitHub Action build result: ${{ job.status }}\n${{ github.event.pull_request.html_url || github.event.head_commit.url }}" + } + } + ] + } + env: + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} + SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK \ No newline at end of file diff --git a/azure-pipelines.yml b/azure-pipelines.yml new file mode 100644 index 0000000..52c8cd3 --- /dev/null +++ b/azure-pipelines.yml @@ -0,0 +1,52 @@ +# Here we specify what causes the pipeline to run; in this case changes to any branch +trigger: +- '*' + +# Here we specify what type of machine (agent) to run on +pool: + vmImage: 'ubuntu-latest' + +# And here we specify a list of "jobs" +jobs: + - job: buildAndTestCsharp + displayName: "Build C Sharp and Run Tests" + # Each job has a sequence of steps to run + steps: + - task: DotNetCoreCLI@2 + inputs: + command: 'build' + - task: DotNetCoreCLI@2 + inputs: + command: 'test' + - job: buildTypeScript + displayName: Build TypeScript + steps: + - task: Npm@1 + inputs: + workingDir: ./DotnetTemplate.Web + command: 'install' + - task: Npm@1 + inputs: + command: 'custom' + customCommand: 'run build' + workingDir: ./DotnetTemplate.Web + - task: Npm@1 + inputs: + command: 'custom' + customCommand: 'run lint' + workingDir: ./DotnetTemplate.Web + - task: Npm@1 + inputs: + command: 'custom' + customCommand: 't' + workingDir: ./DotnetTemplate.Web + - job: publishArtefact + displayName: Publish Artefact + steps: + - script: dotnet publish -c Release -o ./dist + displayName: Generate the executable + - task: PublishPipelineArtifact@1 + displayName: Publish the artefact + inputs: + targetPath: '$(Pipeline.Workspace)' + publishLocation: 'pipeline' \ No newline at end of file