Skip to content

Commit

Permalink
Merge pull request #5 from eclipse-chariott/ladatz/reposetup
Browse files Browse the repository at this point in the history
Add Notice file generation and Markdown files
  • Loading branch information
ladatz authored Jan 19, 2024
2 parents dbe17e1 + 8ab2822 commit 69560f3
Show file tree
Hide file tree
Showing 14 changed files with 320 additions and 0 deletions.
24 changes: 24 additions & 0 deletions .github/ISSUE_TEMPLATE/backlog-item.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
name: Backlog Item
about: Backlog Item with acceptance criteria
title: "[PBI]"
labels: pbi
assignees: ''

---

## Description

<!-- provide a description -->

## Acceptance criteria

<!--
Use a list of clear and concise acceptance criteria
By using the list syntax ("[ ]"), github can track and visualize progress on the story.
-->

- [ ] Criteria 1
- [ ] Criteria 2
- [ ] Criteria 3
- [ ] ...
36 changes: 36 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
name: Bug report
about: Create a report to help us improve
title: "[BUG]"
labels: bug
assignees: ''

---

<!--- Provide a general summary of the issue in the Title above -->

## Expected Behavior
<!--- What should happen -->

## Current Behavior
<!--- What is actually happening -->

## Steps to Reproduce
<!-- Provide a detailed set of steps to reproduce the bug. -->

1.
2.
3.
4.

## Context (Environment)

<!-- Provide some context to the bug, e.g. on which platform, with which account, ... -->

## Logs
<!-- Please share as many logs as possible. This will help to debug -->
<!-- If logs are long, considering putting them in a [gist](https://gist.github.com/) and adding the link here. This helps keep this issue report smaller. -->
<!-- Don't forget to remove any connection string information! -->

## Additional Information
<!-- Please provide any additional information that may be helpful in understanding the issue. -->
15 changes: 15 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "cargo" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "weekly"
groups:
dev-dependencies:
patterns:
- "*" # Groups all dependencies into one PR
39 changes: 39 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<!--- Provide a general summary of your changes in the Title above -->
<!-- Choose an applicable closing keyword and provide the related issue(s) -->
Closes / Fixes / Resolves #0000

## Motivation and Context
<!--- Why is this change required? What problem does it solve? -->

## Description
<!--- Describe your changes in detail -->

<!--
**PR COMMIT MESSAGE**
Use Conventional Commits to describe the PR commit
https://www.conventionalcommits.org/en/v1.0.0
<type>[optional scope]: </description>
[optional body]
[optional footer(s)]
The commit contains the following structural elements, to communicate intent to
the consumers of your library:
- `fix:` a commit of the type fix patches a bug in your codebase (this correlates
with PATCH in Semantic Versioning).
- `feat:` a commit of the type feat introduces a new feature to the codebase (this
correlates with MINOR in Semantic Versioning).
- `BREAKING CHANGE`: a commit that has a footer BREAKING CHANGE:, or appends a !
after the type/scope, introduces a breaking API change (correlating with MAJOR
in Semantic Versioning). A BREAKING CHANGE can be part of commits of any type.
- types other than `fix:` and `feat:` are allowed, for example `build:`, `chore:`
, `ci:`, `docs:`, `style:`, `refactor:`, `perf:`, `test:`, and others.
- footers other than BREAKING CHANGE: <description> may be provided and follow a
convention similar to git trailer format.
-->
33 changes: 33 additions & 0 deletions .github/workflows/markdown-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Lint and Check Markdown

on:
pull_request:
branches:
- main
paths:
- 'docs/**'
- '**.md'
- '**.markdown'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}

jobs:
lint-markdown:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- run: |
npm install markdownlint-cli
- run: |
node_modules/.bin/markdownlint -c ./tools/.markdownlint.jsonc -i node_modules/ .
markdown-link-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: |
npm install markdown-link-check
find . -type d \( -name node_modules -o -name .github \) -prune -o -type f -name '*.md' -print0 | xargs -0 -n1 node_modules/.bin/markdown-link-check --config ./tools/.markdownlinkcheck.jsonc --quiet
26 changes: 26 additions & 0 deletions .github/workflows/notice-generation.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Notice generation
on:
workflow_dispatch:
schedule:
- cron: "0 0 * * 0" # once a week, on sundays at midnight UTC

permissions:
contents: write
pull-requests: write

jobs:
notice_generation:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install stable toolchain
run: rustup show
- name: Cache Dependencies
uses: Swatinem/rust-cache@v1
- run: |
git config --global user.email "[email protected]"
git config --global user.name "Automated Notice Generation Pipeline"
./tools/notice_generation.sh
shell: bash
env:
GITHUB_PAT_TOKEN: ${{ secrets.GITHUB_TOKEN }}
23 changes: 23 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Rust build artifacts
target/

# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
[Aa][Rr][Mm]/
[Aa][Rr][Mm]64/
bld/
[Bb]in/
[Oo]bj/
[Ll]og/
[Ll]ogs/

# These are backup files generated by rustfmt
**/*.rs.bk

# Stops pushes of local vscode files.
/.vscode/*
3 changes: 3 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Eclipse Foundation Community Code of Conduct

This project has adopted the [Eclipse Foundation Community Code of Conduct](https://raw.githubusercontent.com/eclipse/.github/master/CODE_OF_CONDUCT.md).
18 changes: 18 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Contributing

Welcome to the Chariott community. Start here for info on how to contribute and help improve our project.

## How to Contribute

This project welcomes contributions and suggestions.
You'll also need to create an [Eclipse Foundation account](https://accounts.eclipse.org/) and agree to the [Eclipse Contributor Agreement](https://www.eclipse.org/legal/ECA.php). See more info at <https://www.eclipse.org/projects/handbook/#contributing-contributors>.

If you have a bug to report or a feature to suggest, please use the New Issue button on the Issues page to access templates for these items.

## Communication

Please join our [developer mailing list](https://accounts.eclipse.org/mailing-list/chariott-dev) for up to date information.

## Code of Conduct

This project has adopted the [Eclipse Foundation Community Code of Conduct](https://raw.githubusercontent.com/eclipse/.github/master/CODE_OF_CONDUCT.md).
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) Microsoft Corporation.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE
2 changes: 2 additions & 0 deletions rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[toolchain]
channel = "1.70"
17 changes: 17 additions & 0 deletions tools/.markdownlinkcheck.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"ignorePatterns": [
{
"pattern": "^http://localhost"
}
],
"aliveStatusCodes": [
200,
203,
206
],
"_retryComment": "enable retry on 429, this seems to be happening with GitHub links sometimes.",
"retryOn429": true,
"retryCount": 2,
"_fallbackRetryDelayComment": "The `fallbackRetryDelay` is only used when the `retry-after` header of the response has an invalid value. See https://github.com/tcort/markdown-link-check#config-file-format for more info",
"fallbackRetryDelay": "60s"
}
12 changes: 12 additions & 0 deletions tools/.markdownlint.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
// disable line length limitations for existing documentation
"MD013": false,
// allow same headings
"MD024": false,
// allow inline html
"MD033": false,
//ignore first line headers
"MD041": false,
// code block style
"MD046": false
}
51 changes: 51 additions & 0 deletions tools/notice_generation.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#!/bin/bash
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
# SPDX-License-Identifier: MIT

set -e
cd "$(dirname "$0")/.."

if ! command -v gh &> /dev/null
then
echo "GitHub CLI not found. Please install before running the script."
exit
fi

if [ -z "$GITHUB_PAT_TOKEN" ]
then
echo "Missing \$GITHUB_PAT_TOKEN environment variable. Please set it before running the script."
exit
fi

if ! command -v cargo-about &> /dev/null
then
echo "Cargo-about could not be found. Installing now"
cargo install --locked cargo-about
fi

PR_TITLE="chore: Notice file change"
if [ "$(gh pr list --search "$PR_TITLE" --json number | jq '. | length')" -gt 0 ]
then
echo>&2 "A PR is already there for a NOTICE file change. Please merge it or cancel it to have this pipeline properly running."
exit 1
fi

NOTICE_FILENAME="NOTICE"
echo "Running cargo-about for NOTICE file generation..."
cargo about generate --workspace devops/cg/about.hbs --config devops/cg/about.toml | sed -E 's/[ \t]+\r?$//' > $NOTICE_FILENAME

if [ -z "$(git diff --name-only $NOTICE_FILENAME)" ]
then
echo "File not changed"
else
echo "File changed. Checking out a new branch and creating a PR"
BRANCH_NAME="fix/notice-file-update-$(date +%s)"
git checkout -b "$BRANCH_NAME"
git add $NOTICE_FILENAME
git commit -m "New notice file"
git push -f --set-upstream origin "$BRANCH_NAME"
## token needs repo access and read:org
echo "$GITHUB_PAT_TOKEN" | gh auth login --with-token
gh pr create -B main -H "$BRANCH_NAME" --title "$PR_TITLE" --body 'This PR is merging latest changes related to notice file. Please review them before approving.'
fi

0 comments on commit 69560f3

Please sign in to comment.