forked from flipperdevices/flipperzero-firmware
-
-
Notifications
You must be signed in to change notification settings - Fork 540
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #76 from derskythe/feat/refactor
feat: Some refactoring to clean-up the code
- Loading branch information
Showing
16 changed files
with
395 additions
and
188 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,126 @@ | ||
name: "PR Build" | ||
run-name: "PR Build ${{ inputs.DEPLOY_TARGET }} triggered by ${{ github.EVENT_NAME }} (@${{ github.ACTOR }})" | ||
|
||
on: | ||
pull_request: | ||
types: [opened, reopened] | ||
|
||
jobs: | ||
build-for-pr: | ||
runs-on: ubuntu-latest | ||
env: | ||
REPO_SELF: ${{ vars.REPO_SELF }} | ||
APP_PATH: "applications_user/subbrute" | ||
RELATIVE_PATH: "applications/external/subbrute" | ||
PREV_TAG: "" | ||
APP_NAME: "" | ||
ZIP_NAME: "" | ||
ZIP_TAG: "" | ||
TGZ_NAME: "" | ||
TGZ_TAG: "" | ||
SHA: "" | ||
FW_VERSION: "" | ||
RELEASE_VERSION: "" | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
firmware: [unlshd, official] | ||
include: | ||
- firmware: unlshd | ||
url: ${{ vars.REPO_UNLEASHED }} | ||
version: ${{ vars.FIRMWARE_VERSION }} | ||
src-included: 0 | ||
- firmware: official | ||
url: ${{ vars.REPO_OFFICIAL }} | ||
version: official | ||
src-included: 0 | ||
steps: | ||
- name: Copy Firmware Files | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: ${{ matrix.url }} | ||
clean: true | ||
submodules: true | ||
ref: dev | ||
|
||
- name: Copy Repo Files | ||
if: ${{ matrix.src-included == 0 }} | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: ${{ vars.REPO_SELF }} | ||
clean: true | ||
submodules: true | ||
path: ${{ env.APP_PATH }} | ||
|
||
- name: Remove other apps | ||
shell: pwsh | ||
# rm to remove problem FAP which includes non-existent files | ||
run: | | ||
Remove-Item -Force -Recurse ./applications/debug -ErrorAction SilentlyContinue | ||
Remove-Item -Force -Recurse ./applications/examples -ErrorAction SilentlyContinue | ||
Remove-Item -Force -Recurse ${{ env.RELATIVE_PATH }} -ErrorAction SilentlyContinue | ||
- name: Get SHA of our application and release version | ||
shell: pwsh | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.FLIPPER_TOKEN }} | ||
INPUT_VERSION: ${{ inputs.version }} | ||
run: | | ||
Write-Output "::notice title=${{ matrix.firmware }} Input Version Number::v${{ inputs.version }}" | ||
$fwInfo = ((gh release view --json tagName,url -R ${{ matrix.url }}) | ConvertFrom-Json) | ||
cd '${{ env.APP_PATH }}' | ||
$sha = (git rev-parse --verify HEAD) | ||
$releaseVersion = '' | ||
$latestTag = ((gh release view --json tagName,url -R ${{ vars.REPO_SELF }}) | ConvertFrom-Json ).tagName | ||
if ( [string]::IsNullOrWhitespace($env:INPUT_VERSION) ) { | ||
Write-Output "::notice title=${{ matrix.firmware }} Latest tag::$latestTag" | ||
$lastIndex = $latestTag.LastIndexOf('.') | ||
$minorValue = $latestTag.Substring($latestTag.LastIndexOf('.') + 1) | ||
$minorValue = [Convert]::ToInt32($minorValue) + 1 | ||
$newTag = $latestTag.Substring(0, $lastIndex) | ||
$releaseVersion = ('{0}.{1}' -f $newTag, $minorValue) | ||
} else { | ||
$releaseVersion = "$env:INPUT_VERSION" | ||
} | ||
if ( $releaseVersion.StartsWith('v') ) { | ||
$releaseVersion = $releaseVersion.Substring(1) | ||
} | ||
Write-Output "::notice title=${{ matrix.firmware }} PREV_TAG::$latestTag" | ||
Write-Output "::notice title=${{ matrix.firmware }} RELEASE_VERSION::$releaseVersion" | ||
Write-Output "::notice title=${{ matrix.firmware }} SHA::$sha" | ||
Write-Output ('::notice title=${{ matrix.firmware }} FW_VERSION::{0}' -f $fwInfo.tagName) | ||
Write-Output ('RELEASE_VERSION={0}' -f $releaseVersion) >> $env:GITHUB_ENV | ||
Write-Output ('SHA={0}' -f $sha) >> $env:GITHUB_ENV | ||
Write-Output ('FW_VERSION={0}' -f $fwInfo.tagName) >> $env:GITHUB_ENV | ||
Write-Output ('PREV_TAG={0}' -f $latestTag) >> $env:GITHUB_ENV | ||
- name: Build Firmware | ||
shell: bash | ||
if: ${{ success() }} | ||
env: | ||
FBT_NO_SYNC: 0 | ||
DIST_SUFFIX: ${{ matrix.version }} | ||
WORKFLOW_BRANCH_OR_TAG: release-cfw | ||
run: | | ||
./fbt COMPACT=1 DEBUG=0 FBT_NO_SYNC=0 | ||
- name: Build FAPs | ||
shell: bash | ||
if: ${{ success() }} | ||
env: | ||
FBT_NO_SYNC: 0 | ||
DIST_SUFFIX: ${{ matrix.version }} | ||
WORKFLOW_BRANCH_OR_TAG: release-cfw | ||
# rm to remove problem FAP which includes non-existent files | ||
run: | | ||
./fbt COMPACT=1 DEBUG=0 FBT_NO_SYNC=0 fap_dist | ||
#EOF |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.