Skip to content

Commit

Permalink
Feature: make-pretty for all languages / Updates: Github yml build fi…
Browse files Browse the repository at this point in the history
…les and make-pretty applied (#169)

This updates the `make-pretty` script to support all used languages in the project. It's based on the same script in the `openthread` repo. Also make-pretty is applied on all sources.

Additionally, Github yml files are updated to better comply with recommended steps order and to bump setup-go to v5. Some steps are renamed to provide more clarity what it does. And the 'build' test is now split in the Go build part and the OT nodes build part. These 2 parts each require a separate matrix (since the nodes build doesn't involve Go, and the Go build doesn't involve C/C++ )

* [ot-rfsim] make-pretty clang-tidy
* [ot-rfsim] make-pretty clang-format
* [all] make-pretty markdown .md
* [ot-rfsim] make-pretty shell
* [pylibs][script] make-pretty python (excluding generates files in proto/)
* [.github] Updated Github yml workflow names; split OTNS and Nodes builds in build.yml; bring checkout before setup-go to avoid warnings. I.e. apply standard order as recommended.
* [script] moved cmake and ninja to requires packages -> needed now with Lint requiring a node-build.
  • Loading branch information
EskoDijk authored Sep 11, 2024
1 parent 8b80b6d commit 2c94faf
Show file tree
Hide file tree
Showing 95 changed files with 1,898 additions and 1,963 deletions.
22 changes: 19 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,21 +37,37 @@ concurrency:
cancel-in-progress: true

jobs:
build:
name: Build (Go ${{ matrix.go }}, ${{ matrix.os }})
build-otns:
name: Build OTNS (Go ${{ matrix.go }}, ${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
go: [ '1.18', '1.20', '1.22' ]
os: [ ubuntu-22.04, macos-13, macos-14 ]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go }}
- uses: actions/checkout@v3
- name: Build
run: |
./script/install-deps
./script/install
build-nodes:
name: Build Nodes (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ ubuntu-22.04, macos-13, macos-14 ]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '1.22'
- name: Build
run: |
./script/install-deps
./script/install-nodes
8 changes: 4 additions & 4 deletions .github/workflows/develop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,25 +38,25 @@ concurrency:

jobs:
develop:
name: Develop (Go${{ matrix.go }}, ${{ matrix.os }})
name: Develop (Go${{ matrix.go }}, Python${{ matrix.python-version }}, ${{ matrix.os }})
runs-on: ${{ matrix.os }}
env:
HOMEBREW_NO_AUTO_UPDATE: 1
strategy:
fail-fast: false
matrix:
go: [1.22]
go: ['1.22']
python-version: ['3.10']
os: [ubuntu-22.04]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go }}
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- uses: actions/checkout@v3
- name: Build
- name: Build OTNS Web
run: |
docker build -t otns-env -f etc/docker/environment/Dockerfile .
docker run -t -v$PWD:/otns otns-env -c "./script/pack-web"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
- "environment"
- "playground"
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,17 @@ concurrency:

jobs:
go-lint:
name: Go/Shell Lint
name: Go/Shell/Python/C/Markdown Lint
runs-on: ubuntu-22.04
env:
HOMEBREW_NO_AUTO_UPDATE: 1
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '1.22'
- uses: actions/checkout@v3
- name: Check pretty
run: |
./script/install-deps
./script/install
./script/make-pretty check
2 changes: 1 addition & 1 deletion .github/workflows/stress.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ jobs:
env:
HOMEBREW_NO_AUTO_UPDATE: 1
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
Expand All @@ -59,7 +60,6 @@ jobs:
python-version: ${{ matrix.python-version }}
- run: |
mkdir -p /home/runner/work/_temp/_github_home
- uses: actions/checkout@v3
- name: Stress Test
env:
STRESS_LEVEL: 2
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ jobs:
env:
HOMEBREW_NO_AUTO_UPDATE: 1
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '1.18'
- uses: actions/checkout@v3
- name: Test
run: |
./script/test go-tests
Expand All @@ -70,14 +70,14 @@ jobs:
env:
HOMEBREW_NO_AUTO_UPDATE: 1
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '1.22'
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- uses: actions/checkout@v3
- name: Test latest OT-version
run: |
./script/test py-unittests
Expand All @@ -97,14 +97,14 @@ jobs:
env:
HOMEBREW_NO_AUTO_UPDATE: 1
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '1.22'
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- uses: actions/checkout@v3
- name: Run Examples
run: |
./script/test py-examples
7 changes: 7 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"$schema": "http://json.schemastore.org/prettierrc",
"printWidth": 80,
"tabWidth": 2,
"useTabs": false,
"proseWrap": "never"
}
66 changes: 19 additions & 47 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,73 +2,45 @@

## Our Pledge

In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, gender identity and expression, level of experience,
nationality, personal appearance, race, religion, or sexual identity and
orientation.
In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.

## Our Standards

Examples of behavior that contributes to creating a positive environment
include:
Examples of behavior that contributes to creating a positive environment include:

* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
- Using welcoming and inclusive language
- Being respectful of differing viewpoints and experiences
- Gracefully accepting constructive criticism
- Focusing on what is best for the community
- Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

* The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting
- The use of sexualized language or imagery and unwelcome sexual attention or advances
- Trolling, insulting/derogatory comments, and personal or political attacks
- Public or private harassment
- Publishing others' private information, such as a physical or electronic address, without explicit permission
- Other conduct which could reasonably be considered inappropriate in a professional setting

## Our Responsibilities

Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.
Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.

Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.

## Scope

This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community. Examples of
representing a project or community include using an official project e-mail
address, posting via an official social media account, or acting as an appointed
representative at an online or offline event. Representation of a project may be
further defined and clarified by project maintainers.
This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at [email protected]. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately.
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at [email protected]. All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.

Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at [http://contributor-covenant.org/version/1/4][version]
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]

[homepage]: http://contributor-covenant.org
[version]: http://contributor-covenant.org/version/1/4/
[version]: http://contributor-covenant.org/version/1/4/
17 changes: 7 additions & 10 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,21 @@ You generally only need to submit a CLA once, so if you've already submitted one

## Code of Conduct

Help us keep OTNS open and inclusive. Please read and follow our [Code of Conduct](CODE_OF_CONDUCT.md).
Help us keep OTNS open and inclusive. Please read and follow our [Code of Conduct](CODE_OF_CONDUCT.md).

## Bugs

If you find a bug in the source code, you can help us by [submitting a GitHub Issue](https://github.com/EskoDijk/ot-ns/issues/new).
Even better, you can [submit a Pull Request](#pull-requests) with a fix.
If you find a bug in the source code, you can help us by [submitting a GitHub Issue](https://github.com/EskoDijk/ot-ns/issues/new). Even better, you can [submit a Pull Request](#pull-requests) with a fix.

## New features

You can request a new feature by [submitting a GitHub Issue](https://github.com/EskoDijk/ot-ns/issues/new).

If you would like to implement a new feature, please consider the scope of the new feature:

* *Large feature*[Submit a GitHub Issue](https://github.com/EskoDijk/ot-ns/issues/new) with your proposal so that the community can review and provide feedback first. Early feedback helps to ensure your proposal is accepted by the community, better coordinate our efforts, and minimize duplicated work.
- _Large feature_[Submit a GitHub Issue](https://github.com/EskoDijk/ot-ns/issues/new) with your proposal so that the community can review and provide feedback first. Early feedback helps to ensure your proposal is accepted by the community, better coordinate our efforts, and minimize duplicated work.

* *Small feature* — Can be implemented and directly [submitted as a Pull Request](#pull-requests) without a proposal.
- _Small feature_ — Can be implemented and directly [submitted as a Pull Request](#pull-requests) without a proposal.

## Contributing code

Expand Down Expand Up @@ -99,13 +98,11 @@ This will open up a text editor where you can specify which commits to squash.

#### Coding conventions and style

OTNS requires all Go code be formatted with the [gofmt](https://golang.org/cmd/gofmt/) program.
Refer to [go fmt your code](https://blog.golang.org/go-fmt-your-code) for further guidance.
OTNS requires all Go code be formatted with the [gofmt](https://golang.org/cmd/gofmt/) program. Refer to [go fmt your code](https://blog.golang.org/go-fmt-your-code) for further guidance.

All style and coding suggestions in [Effective Go](https://golang.org/doc/effective_go.html) should be followed, subject to the above rules.

OTNS uses [golangci-lint](https://golangci.com/) in continuous-integration checks.
You can run `./script/make-pretty` and `./script/check-pretty` to automatically reformat code and check for code-style compliance, respectively.
OTNS uses [golangci-lint](https://golangci.com/) in continuous-integration checks. You can run `./script/make-pretty` and `./script/check-pretty` to automatically reformat code and check for code-style compliance, respectively.

#### Push and test

Expand All @@ -121,4 +118,4 @@ This will trigger continuous-integration checks using GitHub Actions. You can vi

#### Submit the pull request

Once you've validated that all continuous-integration checks have passed, go to the page for your fork on GitHub, select your development branch, and click the **Pull Request** button. If you need to make any adjustments to your pull request, push the updates to GitHub. Your pull request will automatically track the changes on your development branch and update.
Once you've validated that all continuous-integration checks have passed, go to the page for your fork on GitHub, select your development branch, and click the **Pull Request** button. If you need to make any adjustments to your pull request, push the updates to GitHub. Your pull request will automatically track the changes on your development branch and update.
Loading

0 comments on commit 2c94faf

Please sign in to comment.