Skip to content

Commit

Permalink
Add CI/CD (#74)
Browse files Browse the repository at this point in the history
## Additions

- Documented development and release process.
- Roslyn analyzers.
- Pull request pipeline with analyzers and tests.
- Automated releases pipeline.
- Dependabot.
- Force all pull requests to have labels.
- Issue templates.
- Pull request templates.
- Rough icon prototype.

## Changes

- Added formatting and other changes from analyzers.

## Removed

- x86 support.
  • Loading branch information
dalyIsaac authored Jun 26, 2022
1 parent b483dbe commit 0762861
Show file tree
Hide file tree
Showing 53 changed files with 1,174 additions and 305 deletions.
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ tab_width = 4

# New line preferences
end_of_line = crlf
insert_final_newline = false
insert_final_newline = true

#### .NET Coding Conventions ####

Expand Down
59 changes: 59 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: 🐞 Bug
description: File a bug/issue
title: "Title"
labels: ["bug", "triage"]
body:
- type: checkboxes
attributes:
label: Is there an existing issue for this?
description: Please search to see if an issue already exists for the bug you encountered.
options:
- label: I have searched the existing issues
required: true
- type: textarea
attributes:
label: Current Behavior
description: A concise description of what you're experiencing.
validations:
required: true
- type: textarea
attributes:
label: Expected Behavior
description: A concise description of what you expected to happen.
validations:
required: true
- type: textarea
attributes:
label: Steps To Reproduce
description: Steps to reproduce the behavior.
placeholder: |
1. In this environment...
2. With this config...
3. Run '...'
4. See error...
validations:
required: true
- type: textarea
attributes:
label: Environment
description: |
examples:
- **Windows**: Version 21H2 (OS Build 22000.708)
- **Architecture**: x86_64
- **Whim**: 0.2.4
value: |
- Windows:
- Architecture:
- Whim:
render: markdown
validations:
required: true
- type: textarea
attributes:
label: Anything else?
description: |
Links? References? Anything that will give us more context about the issue you are encountering!
Tip: You can attach images or log files by clicking this area to highlight it and then dragging files in.
validations:
required: false
33 changes: 33 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: 💡 Feature request
description: Suggest an idea for this project
title: "Title"
labels: ["enhancement"]
body:
- type: checkboxes
attributes:
label: Is there an existing issue for this?
description: Please search to see if an issue already exists for the feature you would like.
options:
- label: I have searched the existing issues
required: true
- type: textarea
attributes:
label: Proposal
description: A clear and concise description of the feature you would like to see.
validations:
required: true
- type: textarea
attributes:
label: Alternatives
description: A clear and concise description of any alternative solutions or features you've considered.
validations:
required: false
- type: textarea
attributes:
label: Additional context
description: |
Links? References? Anything that will give us more context about the feature you are suggesting!
Tip: You can attach images or log files by clicking this area to highlight it and then dragging files in.
validations:
required: false
8 changes: 8 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
version: 2
updates:
- directory: /
open-pull-requests-limit: 5
package-ecosystem: nuget
rebase-strategy: auto
schedule:
interval: daily
12 changes: 12 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!--
* Thanks for submitting a Pull Request.
* Before making this Pull Request, please make sure that there's a
* corresponding bug or feature request which can be associated with this Pull
* Request.
-->

- [ ] This code is up-to-date with the `main` branch.

This PR fixes #

Describe your changes here.
49 changes: 49 additions & 0 deletions .github/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
changelog:
exclude:
labels:
- "whim version"

authors:
- dependabot

categories:
- title: Documentation 📄
labels:
- documentation

- title: Core
labels:
- core
- "layout engine"

- title: Runner 🏃🏻
labels:
- "runner 🏃🏻"

- title: Bar
labels:
- bar

- title: Command Palette
labels:
- "command palette"

- title: Floating Layout ☁️
labels:
- "floating layout"

- title: Focus Indicator 👀
labels:
- "focus indicator"

- title: Gaps
labels:
- gaps

- title: Tree Layout 🌳
labels:
- "tree layout"

- title: Other Changes 🖋
labels:
- "*"
72 changes: 72 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"

on:
push:
branches: [ "main" ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ "main" ]
schedule:
- cron: '41 19 * * 6'

jobs:
analyze:
name: Analyze
runs-on: windows-latest
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: [ 'csharp' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support

steps:
- name: Checkout repository
uses: actions/checkout@v3

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.

# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality


# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2

# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun

# If the Autobuild fails above, remove it and uncomment the following three lines.
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.

# - run: |
# echo "Run, Build Application using script"
# ./location_of_script_within_repo/buildscript.sh

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
59 changes: 59 additions & 0 deletions .github/workflows/commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: commit

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
commit:
strategy:
matrix:
configuration: [Debug, Release]
platform: [x64, arm64]

runs-on: windows-latest

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Restore dependencies
run: |
dotnet restore Whim.sln /p:Configuration=$env:Configuration
env:
Configuration: ${{ matrix.configuration }}

# TODO: Replace commented code with the uncommented code once the 6.0.4 SDK has been released.
# - name: Check formatting
# run: |
# dotnet format Whim.sln --verify-no-changes --no-restore

- name: Check whitespace formatting
run: |
dotnet format whitespace Whim.sln
- name: Check style
run: |
dotnet format style Whim.sln
# END TODO

- name: Add msbuild to PATH
uses: microsoft/[email protected]

- name: Build
run: |
msbuild Whim.sln /p:Configuration=$env:Configuration /p:Platform=$env:Platform
env:
Configuration: ${{ matrix.configuration }}
Platform: ${{ matrix.platform }}

- name: Test
run: |
dotnet test Whim.sln /p:CollectCoverage=true /p:CoverletOutputFormat=opencover
- name: Upload coverage to Codecov
uses: codecov/[email protected]
with:
files: src/**/*.opencover.xml
46 changes: 46 additions & 0 deletions .github/workflows/pull_request_labels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: pull_request_labels

on:
pull_request:
types: [opened, labeled, unlabeled]

jobs:
opened:
# When the pull request, there won't be any labels attached. To force the `label` job to run,
# we add the `triage` label.
runs-on: ubuntu-latest
if: github.event_name == 'pull_request' && github.pull_request.action == 'opened'
concurrency: pr-labels-{{ github.pull_request.number }}
steps:
- name: Label opened pull requests with triage
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh pr edit --add-labels "triage"
label:
# If the triage label is attached and there are other labels, remove triage.
# If triage is attached, fail.
runs-on: ubuntu-latest
if: github.event_name == 'pull_request' && github.pull_request.action != 'opened'
concurrency: pr-labels-{{ github.pull_request.number }}
steps:
- name: Require labels
shell: pwsh
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_PR_LABELS: ${{ join(github.event.pull_request.labels.*.name, ',') }}
run: |
if ($null -eq $env:GITHUB_PR_LABELS) {
throw "Missing required labels"
}
$labels = $env:GITHUB_PR_LABELS.Split(',')
if ($labels.Contains("triage")) {
gh pr edit --remove-labels "triage"
$labels = $labels | Where-Object { $_ -ne "triage" }
}
if ($labels.Length -eq 0) {
throw "Pull request must have at least one label (excluding triage)"
}
Loading

0 comments on commit 0762861

Please sign in to comment.