Skip to content

EmuF dotGitHub files #832

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: emuflight-1.0.0-master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
custom: https://paypal.me/betaflight
patreon: betaflight
patreon: EmuFlight
12 changes: 6 additions & 6 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
blank_issues_enabled: false
contact_links:
- name: Configuration and other support questions
url: https://github.com/betaflight/betaflight#support-and-developers-channel
about: Official Slack chat channel and Facebook group about Betaflight
- name: Hardware Issues
url: https://github.com/betaflight/betaflight#hardware-issues
about: What to do in the case of hardware issues
- name: Help and Support
url: https://discord.gg/BWqgBg3
about: EmuFlight Discord
- name: Configurator software bugs
url: https://github.com/emuflight/EmuConfigurator/issues
about: Configurator software issues
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/feature-request.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Feature Request
description: Suggest an idea for for a new feature for Betaflight.
description: Suggest an idea for for a new feature for EmuFlight.
labels: ["Template: Feature Request"]
body:

Expand Down
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/firmware-bug-report.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Firmware Bug Report
description: Create a report to help us fix bugs in the Betaflight firmware.
description: Create a report to help us fix bugs in the EmuFlight firmware.
labels: ["Template: Bug"]
body:

Expand Down Expand Up @@ -33,7 +33,7 @@ body:
attributes:
label: Flight controller configuration
description: |
Create a `diff` and post it here in a code block. Put (three backticks) at the start and end of the diff block (instructions on how to do a diff: https://oscarliang.com/use-diff-not-dump-betaflight/).
Create a `diff` and post it here in a code block.
Use `resource show all` to create a resource allocation list and post it here in a code block. Put (three backticks) at the start and end of the output block.
value: |
```
Expand Down
38 changes: 15 additions & 23 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -1,35 +1,27 @@
## Important: Feature freeze / release candidate phase for Betaflight 4.3
### Thank you for contributing to EmuFlight!

From 29 November 2021 until the release of Betaflight 4.3.0 (scheduled for early 2022), the project is in a 'feature freeze / release candidate' phase. This means:
### Important considerations when opening a pull request:

1. Pull requests can still be submitted as normal. Comments / discussions will probably be slower than normal due to shifted priorities;
1. Please code all changes into a new branch based on master and Pull-Request from this branch, do not modify `master`.

2. If your pull request is a fix for an existing bug, or an update for a single target that has a low risk of side effect for other targets, it will be reviewed. It may be accepted merged into `master` for the 4.3 release, or held over to 4.4;
2. Pull-Requests will only be accepted if they are opened against the `master` branch. Pull-Requests opened against other branches without prior consent from the maintainers will be closed;

3. All other pull requests will be scheduled for 4.4, and discussed / reviewed / merged into `master` after 4.30 has been released. Please keep in mind that this potentially means that you will have to rebase your changes if they are broken by bugfixes made for 4.3.
3. Please follow the coding style guidelines: https://github.com/emuflight/EmuFlight/blob/master/docs/development/CodingStyle.md



## Important considerations when opening a pull request:

1. Make sure you do not make the changes you want to open a pull request for on the `master` branch of your fork, or open the pull request from the `master` branch of your fork. Some of our integrations will fail if you do this, resulting in your pull request not being accepted. If this is your first pull request, it is probably a good idea to first read up on how opening pull requests work (https://opensource.com/article/19/7/create-pull-request-github is a good introduction);

2. Pull requests will only be accepted if they are opened against the `master` branch of our repository. Pull requests opened against other branches without prior consent from the maintainers will be closed;

3. Please follow the coding style guidelines: https://github.com/betaflight/betaflight/blob/master/docs/development/CodingStyle.md

4. Keep your pull requests as small and concise as possible. One pull request should only ever add / update one feature. If the change that you are proposing has a wider scope, consider splitting it over multiple pull requests. In particular, pull requests that combine changes to features and one or more new targets are not acceptable.
4. Keep your Pull-Requests as small and concise as possible. One pull request should only ever add / update one feature. If the change that you are proposing has a wider scope, consider splitting it over multiple Pull-Requests. In particular, Pull-Requests that combine changes to features and one or more new targets are not acceptable.

5. Ideally, a pull request should contain only one commit, with a descriptive message. If your changes use more than one commit, rebase / squash them into one commit before submitting a pull request. If you need to amend your pull request, make sure that the additional commit has a descriptive message, or - even better - use `git commit --amend` to amend your original commit.

6. All pull requests are reviewed. Be ready to receive constructive criticism, and to learn and improve your coding style. Also, be ready to clarify anything that isn't already sufficiently explained in the code and text of the pull request, and to defend your ideas.

7. If your pull request is for a new target or an update to an existing target, please be aware that all targets have to be submitted as Unified Target configurations if a Unified Target for the MCU type is available. Read and follow [these instructions](https://github.com/betaflight/betaflight/blob/master/docs/TargetMaintenance/CreatingAUnifiedTarget.md).
6. All Pull-Requests are reviewed. Be ready to receive constructive criticism, and to learn and improve your coding style. Also, be ready to clarify anything that isn't already sufficiently explained in the code and text of the pull request, and to defend your ideas.

8. We use continuous integration (CI) with [Azure Pipelines](https://dev.azure.com/Betaflight/Betaflight%20Nightlies/_build) to build all targets and run the test suite for every pull request. Pull requests that fail any of the builds or fail tests will most likely not be reviewed before they are fixed to build successfully and pass the tests. In order to get a quick idea if there are things that need fixing **before** opening a pull request or pushing an update into an existing pull request, run `make pre-push` to run a representative subset of the CI build. _Note: This is not an exhaustive test (which will take hours to run on any desktop type system), so even if this passes the CI build might still fail._
7. If your pull request is a fix for one or more issues that are open in GitHub, add a comment to your pull request, and add the issue numbers of the issues that are fixed in the form `Fixes #<issue number>`. This will cause the issues to be closed when the pull request is merged;

9. If your pull request is a fix for one or more issues that are open in GitHub, add a comment to your pull request, and add the issue numbers of the issues that are fixed in the form `Fixes #<issue number>`. This will cause the issues to be closed when the pull request is merged;
8. All PR's should pass the following commands as well as Codacy.com checks.
* `make EXTRA_FLAGS=-Werror checks`
* `make EXTRA_FLAGS=-Werror test-all`
* `make EXTRA_FLAGS=-Werror all`

10. If your pull request contains a change that can be tested by other users, please build a set of test firmware files for all Unified Targets and attach them to the pull request. The required firmware files can be built in zipped form ready for upload to GitHub with `make unified_zip`. When attaching test firmware files, you can point users to this video for instructions on how to install the test firmware: https://youtu.be/I1uN9CN30gw
9. Remove this Text :).

11. Remove this Text :).
### Any questions?
* Please join our discord server: https://discord.gg/BWqgBg3
File renamed without changes.
279 changes: 279 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,279 @@
on:
push:
tags:
- '*'
pull_request:
branches:
- '*'
# repository_dispatch is a newer github-actions feature that will allow building from triggers other than code merge/PR
repository_dispatch:
types: [build]

name: Build EmuFlight
jobs:
build:
continue-on-error: false
timeout-minutes: 75
strategy:
max-parallel: 1
matrix:
targets: [all]
outputs:
buildtag: ${{ steps.ids.outputs.buildtag }}
shortsha: ${{ steps.ids.outputs.shortsha }}
artifact: ${{ steps.ids.outputs.artifact }}
version: ${{ steps.ids.outputs.version }}
runs-on: ubuntu-latest

steps:
# curl, by default, may timeout easily
- name: CURL Fix
run: function curl () { command curl --connect-timeout 30 --retry 10 "$@" ; }

# checkout with speedup #0 works, but maybe 5 safe for revisions/recompiles
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 5

# arm_sdk_install
- name: ARM_SDK_Install
id: arm_sdk_install
run: |
make arm_sdk_install --trace

# EmuFlight version
- name: Get Firmware Version
id: get_version
run: echo "VERSION=$(make version)" >> $GITHUB_ENV

# for Makefile interaction
- name: Get GitHub Build Number (ENV)
id: get_buildno
run: echo "GITHUBBUILDNUMBER=${{ github.run_number }}" >> $GITHUB_ENV

- name: Get Pull-Request Number
id: get_pullno
run: echo "PULL_NUMBER=$(echo "$GITHUB_REF" | awk -F / '{print $3}')" >> $GITHUB_ENV
if: startsWith(github.ref, 'refs/pull/')

- name: Get Revision Tag
if: startsWith(github.ref, 'refs/tags/')
id: get_revtag
run: echo "REVISION_TAG=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV

- name: Get Short-SHA
run: |
echo "SHORT_SHA=$(git rev-parse --short HEAD)" >> $GITHUB_ENV

- name: Build Artifact Name
id: make_artifactname
run: |
if [[ "${{ github.REPOSITORY }}" == "emuflight/EmuFlight" ]] ; then
ARTIFACT_NAME="EmuFlight-${{ env.VERSION }}-${{ github.run_number }}"
else
ARTIFACT_NAME="EmuFlight-${{ env.VERSION }}-${{ github.ACTOR }}-${{ github.run_number }}"
fi
echo "${ARTIFACT_NAME}"
echo "ARTIFACT_NAME=${ARTIFACT_NAME}" >> $GITHUB_ENV

- id: ids
name: Set Outputs (Variables)
run: |
echo "::set-output name=buildtag::${{ env.REVISION_TAG }}"
echo "::set-output name=shortsha::${{ env.SHORT_SHA }}"
echo "::set-output name=artifact::${{ env.ARTIFACT_NAME }}"
echo "::set-output name=version::${{ env.VERSION }}"
continue-on-error: true

# for debugging
- name: Show Variables
id: show_vars
run: |
echo "Actor: ${{ github.ACTOR }}"
echo "Repo: ${{ github.REPOSITORY }}"
echo "Build: ${{ github.run_number }}"
echo "Firmware: ${{ env.VERSION }}"
echo "Commit: ${{ github.sha }}"
echo "ShortSHA: ${{ env.SHORT_SHA }}"
echo "Tag: ${{ env.REVISION_TAG}}"
echo "Artifact name: ${{ env.ARTIFACT_NAME }}"
echo "outputs.buildtag: ${{ steps.ids.outputs.buildtag }}"
echo "outputs.shortsha: ${{ steps.ids.outputs.shortsha }}"
echo "outputs.artifact: ${{ steps.ids.outputs.artifact }}"
echo "outputs.artifact: ${{ steps.ids.outputs.artifact }}"
continue-on-error: true

# install libblocksruntime-dev
- name: Install libblocksruntime-dev
id: libblocksruntime-dev
run: |
sudo apt-get install -y libblocksruntime-dev

# checks
- name: UnitTests Checks
id: checks
run: |
make EXTRA_FLAGS=-Werror checks

# test-all
- name: UnitTests Test-All
id: test-all
run: |
make EXTRA_FLAGS=-Werror test-all

# Build HEX
- name: Compile Targets
run: |
make EXTRA_FLAGS=-Werror ${{ matrix.targets }}

# Upload the Builds to ZIP file with existing SHA in .hex names
- name: Upload Artifacts
uses: actions/upload-artifact@v2
with:
name: ${{ env.ARTIFACT_NAME }}
path: obj/*.hex

releases:
if: startsWith(github.ref, 'refs/tags/')
needs: build
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
outputs:
datetime: ${{ steps.ids.outputs.datetime }}
timeout-minutes: 10
runs-on: ubuntu-latest
continue-on-error: false
steps:
- name: Get Date
id: datetime
run: |
echo "::set-output name=datetime::$(date +'%Y%m%dT%H%M%S')"

# for debugging
- name: Show Variables
run: |
echo "Build: ${{ github.RUN_NUMBER }}"
echo "Commit: ${{ github.SHA }}"
echo "Ref: ${{ GITHUB.REF }}"
echo "Actor: ${{ github.ACTOR }}"
echo "Repo: ${{ github.REPOSITORY }}"
echo "outputs.buildtag: ${{ needs.build.outputs.buildtag }}"
echo "outputs.shortsha: ${{ needs.build.outputs.shortsha }}"
echo "outputs.artifact: ${{ needs.build.outputs.artifact }}"
echo "outputs.artifact: ${{ needs.build.outputs.version }}"
echo "outputs.datetime: ${{ steps.datetime.outputs.datetime }}"

continue-on-error: true

- name: Download Artifacts
uses: actions/download-artifact@v2
with:
name: ${{ needs.build.outputs.artifact }} #no name parameter will download all artifacts, but create separate subfolders
path: obj
continue-on-error: false

- name: List/Find Extracted Artifacts
run: |
find ./ -name "*.hex"

# Draft Dev-Unstable releases via ncipollo/release-action
# softprops/action-gh-release fails to release on separate repo
- name: Draft Release Dev-Unstable repo
if: contains(github.ref, 'test') || contains(github.ref, 'unstab')
uses: ncipollo/release-action@v1
with:
repo: dev-unstable
owner: emuflight
token: ${{ secrets.NC_PAT_EMUF }}
tag: "hex-${{ github.run_number }}"
draft: true
prerelease: true
allowUpdates: true
artifacts: obj/*.hex
artifactContentType: raw
name: "DEV-UNSTABLE HEX / Build ${{ github.run_number }}"
body: |
## HEX BUILD for TESTING
### Build ${{ github.run_number }}
### Commit SHA: ${{ needs.build.outputs.shortsha }} (${{ github.sha }})
### BuildTag: ${{ needs.build.outputs.buildtag }}
### EmuFlight ${{ needs.build.outputs.version }} base plus test code
### What to Test/Feedback: (Feedback in EmuFlight's Discord or GitHub Discussions)
<details><summary>Changes in this Build:</summary>
<!-- require single blank line below -->

```
[insert commit history here]
```
</details>
continue-on-error: true

# Draft Dev-master releases via ncipollo/release-action
# softprops/action-gh-release fails to release on separate repo
- name: Draft Release Dev-Master repo
if: contains(github.ref, 'master')
uses: ncipollo/release-action@v1
with:
repo: dev-master
owner: emuflight
token: ${{ secrets.NC_PAT_EMUF }}
tag: "hex-${{ github.run_number }}"
draft: true
prerelease: true
allowUpdates: true
artifacts: obj/*.hex
artifactContentType: raw
name: "DEV-MASTER HEX / Build ${{ github.run_number }}"
body: |
## HEX BUILD of MASTER
### Build ${{ github.run_number }}
### Commit SHA: ${{ needs.build.outputs.shortsha }} (${{ github.sha }})
### BuildTag: ${{ needs.build.outputs.buildtag }}
### EmuFlight ${{ needs.build.outputs.version }} base plus committed code
### Feedback Welcome in EmuFlight's Discord or GitHub Discussions.
<details><summary>Changes in this Build:</summary>
<!-- require single blank line below -->

```
[insert commit history here]
```
</details>
continue-on-error: true

# Rename .hex for true Releases on main repo
- name: Rename Artifacts
if: startsWith(github.ref, 'refs/tags/')
run: |
sudo apt -y install rename
cd obj
rename 's/_Build_.*/.hex/' *.hex

#Draft Releases on main Repo
# could potentially change to ncipollo/release-action as well
- name: Draft Release Main Repo
if: contains(github.ref, 'releas')
uses: ncipollo/release-action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
draft: true
prerelease: true
allowUpdates: true
# tag: use the build Number, but we MUST manually change to version so that it creates a version-tag on release
tag: ${{ env.VERSION }}
artifacts: obj/*.hex
artifactContentType: raw
name: DRAFT / EmuFlight ${{ env.VERSION }} / GitHub Build ${{ github.run_number }}
body: |
## EmuFlight ${{ env.VERSION }}
### Build ${{ github.run_number }}
### Commit SHA: ${{ needs.build.outputs.shortsha }} (${{ github.sha }})
### BuildTag: ${{ needs.build.outputs.buildtag }}
<details><summary>Changes in this Build:</summary>
<!-- require single blank line below -->

```
[insert commit history here]
```
</details>
continue-on-error: false
File renamed without changes.
File renamed without changes.
Loading