Skip to content

Commit

Permalink
Merge branch 'micro5k:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
ale5000-git authored Sep 14, 2024
2 parents 0c18bf0 + 9ef0321 commit b0468f4
Show file tree
Hide file tree
Showing 24 changed files with 609 additions and 196 deletions.
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ switch_case_indent = true
space_redirects = true
function_next_line = true

[Makefile]
indent_style = tab

[*.bat]
end_of_line = crlf

Expand Down
28 changes: 14 additions & 14 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,33 @@ docs/CODEOWNERS text eol=lf
.gitattributes text eol=lf
.gitignore text eol=lf
.gitmodules text eol=lf

.editorconfig text eol=lf
.semgrepignore text eol=lf
.shellcheckrc text eol=lf
.simplecov text eol=lf

*.yml text eol=lf
*.xml text eol=lf
*.json text eol=lf
*.dis text eol=lf
.simplecov text eol=lf
.shellcheckrc text eol=lf
.editorconfig text eol=lf

.reuse/dep5 text eol=lf
*.license text eol=lf
*.spdx text eol=lf

Makefile text eol=lf
etc/profile text eol=lf

# Batch scripts
*.bat text eol=crlf

# Text
# Gradle files
gradlew text eol=lf
*.gradle text eol=lf

# Textual formats
*.properties text eol=lf
*.rst text eol=lf
*.md text eol=lf
*.txt text eol=lf
Expand All @@ -43,25 +52,16 @@ docs/CODEOWNERS text eol=lf
*.py text eol=lf

# Our custom files
build text eol=lf
recovery-simulator/override/* text eol=lf

# Gradle files
gradlew text eol=lf
*.gradle text eol=lf
*.properties text eol=lf

# Other files
fastlane/Appfile text eol=lf
fastlane/Fastfile text eol=lf

# Uncompressed text manuals
*.1 text eol=lf

# Binaries
*.exe binary
*.bin binary
*.apk binary
*.zip binary
*.jar binary
*.gz binary
*.png binary
Expand Down
10 changes: 3 additions & 7 deletions .github/workflows/base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@ name: "Base"
permissions: {}
on:
push:
branches:
- main
tags:
- "v*"
pull_request:
workflow_dispatch:
jobs:
Expand Down Expand Up @@ -38,7 +34,7 @@ jobs:
run: |
### Executing code coverage...
workspace_path='${{ github.workspace }}'; readonly workspace_path
export OPENSOURCE_ONLY='true'
export BUILD_TYPE=oss
#sudo apt-get -qq -y install moreutils 1>/dev/null
bashcov "${workspace_path:?}/build.sh" # To timestamp the output pipe it to: TZ=UTC ts '[%H:%M:%S]'
printf '\n'
Expand Down Expand Up @@ -68,14 +64,14 @@ jobs:
sha256_hash='${{ steps.coverage.outputs.sha256_hash }}'; readonly sha256_hash
echo "::notice::${sha256_hash:-Missing hash}"
- name: "Upload artifacts"
if: "${{ github.ref == 'refs/heads/main' }}"
if: "${{ github.event_name != 'pull_request' }}"
uses: actions/upload-artifact@v4
with:
name: "microG unofficial installer OSS build (extract it)"
path: "output/*.zip*"
retention-days: 7
- name: "Upload coverage reports to Codecov"
if: "${{ github.repository_owner == 'micro5k' }}"
if: "${{ github.ref == 'refs/heads/main' && github.event_name != 'pull_request' && github.repository_owner == 'micro5k' }}"
uses: codecov/codecov-action@v4
with:
fail_ci_if_error: true
Expand Down
10 changes: 3 additions & 7 deletions .github/workflows/code-linting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@ name: "Code linting"
permissions: {}
on:
push:
branches:
- main
tags:
- "v*"
pull_request:
workflow_dispatch:
jobs:
Expand Down Expand Up @@ -37,7 +33,7 @@ jobs:

codacy:
name: "Codacy"
if: "${{ github.event_name != 'pull_request' && github.repository_owner == 'micro5k' }}"
if: "${{ github.ref == 'refs/heads/main' && github.event_name != 'pull_request' && github.repository_owner == 'micro5k' }}"
runs-on: ubuntu-latest
permissions:
security-events: write
Expand Down Expand Up @@ -68,7 +64,7 @@ jobs:

sonarcloud:
name: "SonarCloud"
if: "${{ github.event_name != 'pull_request' && github.repository_owner == 'micro5k' }}"
if: "${{ github.ref == 'refs/heads/main' && github.event_name != 'pull_request' && github.repository_owner == 'micro5k' }}"
runs-on: ubuntu-latest

steps:
Expand All @@ -82,7 +78,7 @@ jobs:
# Removing build.gradle...
rm -f build.gradle
- name: "Run SonarCloud scan"
uses: SonarSource/sonarcloud-github-action@v2
uses: SonarSource/sonarcloud-github-action@v3
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
Expand Down
36 changes: 25 additions & 11 deletions .github/workflows/periodic-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,30 +7,32 @@ permissions: {}
on:
push:
paths:
- ".github/workflows/periodic-checks.yml"
- "gradle/wrapper/gradle-wrapper.jar"
- ".reuse/dep5"
- "**codecov.yml"
- "Makefile"
- ".reuse/dep5"
pull_request:
paths:
- ".github/workflows/periodic-checks.yml"
- "gradle/wrapper/gradle-wrapper.jar"
- ".reuse/dep5"
- "**codecov.yml"
- "Makefile"
- ".reuse/dep5"
schedule:
- cron: "0 0 * * 1"
workflow_dispatch:

jobs:
base-job:
base:
name: "Base job"
runs-on: ubuntu-latest

steps:
- name: "Check out code"
- name: "Checkout sources"
uses: actions/checkout@v4
with:
fetch-depth: "0"
- name: "Gradle Wrapper validation"
uses: gradle/actions/wrapper-validation@v3
- name: "Validate Gradle Wrapper"
uses: gradle/actions/wrapper-validation@v4
- name: "Validate Codecov configuration"
shell: bash
run: |
Expand All @@ -48,14 +50,26 @@ jobs:
if test "${status:?}" -eq 0; then echo 'Result: pass'; else echo 'Result: fail'; exit "${status:?}"; fi
fi
dep5-validator:
makefile-validation:
name: "Validate makefile"
runs-on: ubuntu-latest

steps:
- name: "Checkout sources"
uses: actions/checkout@v4
- name: "Validation"
uses: Uno-Takashi/checkmake-action@v2
with:
makefile: "Makefile"

dep5-validation:
name: "Validate dep5"
runs-on: ubuntu-latest

steps:
- name: "Check out code"
- name: "Checkout sources"
uses: actions/checkout@v4
- name: "Validate dep5"
- name: "Validation"
shell: bash
run: |
# Validating dep5
Expand Down
10 changes: 6 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@
# VS Code files
/.vscode/launch.json

# Local files
/.local/
/local/

# Gradle files
/.gradle/
/build/
Expand All @@ -23,6 +19,12 @@
local.properties
user.gradle

# Files to ignore
/local/
/.local/
/build
/cmdline

# Code scanning, log and other files
*.log
*.sarif
Expand Down
10 changes: 5 additions & 5 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,11 @@
},
"options": {
"env": {
"OPENSOURCE_ONLY": "false"
"BUILD_TYPE": "full"
}
},
"group": {
"kind": "build",
"isDefault": true
"kind": "build"
},
"problemMatcher": []
},
Expand All @@ -38,11 +37,12 @@
},
"options": {
"env": {
"OPENSOURCE_ONLY": "true"
"BUILD_TYPE": "oss"
}
},
"group": {
"kind": "build"
"kind": "build",
"isDefault": true
},
"problemMatcher": []
},
Expand Down
23 changes: 23 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/usr/bin/env -S make -f

# SPDX-FileCopyrightText: (c) 2024 ale5000
# SPDX-License-Identifier: GPL-3.0-or-later

.POSIX:
.PHONY: all build clean test cmdline

all: buildota buildotaoss ;

buildota:
BUILD_TYPE=full "$(CURDIR)/build.sh" --no-default-build-type --no-pause $(ARGS)

build: buildotaoss ;
buildotaoss:
BUILD_TYPE=oss "$(CURDIR)/build.sh" --no-default-build-type --no-pause $(ARGS)

clean:
rm -f "$(CURDIR)/output/"*.zip
rm -f "$(CURDIR)/output/"*.zip.md5
rm -f "$(CURDIR)/output/"*.zip.sha256

cmdline: ;
2 changes: 1 addition & 1 deletion SECURITY.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Security Policy
# Security policy

You will found the security policy [here](./docs/SECURITY.rst).
14 changes: 8 additions & 6 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,10 @@ initialize()

/* ===BLOCKS=== */

gradleEnterprise.buildScan {
termsOfServiceUrl 'https://gradle.com/terms-of-service'
termsOfServiceAgree 'yes'
publishAlwaysIf System.getenv('UPLOAD_BUILD_SCAN') != null
develocity.buildScan {
termsOfUseUrl.set 'https://gradle.com/help/legal-terms-of-use'
termsOfUseAgree.set 'yes'
publishing.onlyIf { System.getenv('UPLOAD_BUILD_SCAN') != null }
}

base {
Expand Down Expand Up @@ -125,7 +125,8 @@ tasks.register('buildOta', Exec) {

doFirst {
println 'Building the flashable OTA zip with Gradle...'
environment OPENSOURCE_ONLY: 'false'
environment BUILD_TYPE: 'full'
environment NO_PAUSE: '1'
executable "${projectDir}/build" + getScriptExt()
}
}
Expand All @@ -136,7 +137,8 @@ tasks.register('buildOtaOSS', Exec) {

doFirst {
println 'Building the flashable OTA zip (open-source components only) with Gradle...'
environment OPENSOURCE_ONLY: 'true'
environment BUILD_TYPE: 'oss'
environment NO_PAUSE: '1'
executable "${projectDir}/build" + getScriptExt()
}
}
Expand Down
29 changes: 29 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,38 @@ detect_script_dir()
}
detect_script_dir || return 1 2>&- || exit 1

unset DO_INIT_CMDLINE
# shellcheck source=SCRIPTDIR/includes/common.sh
if test "${A5K_FUNCTIONS_INCLUDED:-false}" = 'false'; then . "${MAIN_DIR}/includes/common.sh"; fi

if test -n "${OPENSOURCE_ONLY-}"; then
ui_error 'You must set BUILD_TYPE instead of OPENSOURCE_ONLY'
fi

# Parse parameters
default_build_type='true'
while test "${#}" -gt 0; do
case "${1?}" in
--no-default-build-type) default_build_type='false' ;;
--no-pause) export NO_PAUSE=1 ;;
--)
shift
break
;;
--* | -*) ;; # Ignore unsupported options
*) break ;;
esac

shift
done

test "${default_build_type:?}" = 'false' || BUILD_TYPE="${BUILD_TYPE:-full}"
case "${BUILD_TYPE-}" in
'full') export OPENSOURCE_ONLY='false' ;;
'oss') export OPENSOURCE_ONLY='true' ;;
*) ui_error "Invalid build type => '${BUILD_TYPE-}'" ;;
esac

save_last_title
change_title 'Building the flashable OTA zip...'

Expand Down
8 changes: 7 additions & 1 deletion cmdline.bat
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ SETLOCAL 2> nul
REM Fix the working directory when using "Run as administrator"
IF "%CD%" == "%windir%\system32" CD /D "%~dp0"

IF NOT EXIST "%~dp0tools\win\busybox.exe" (
ENDLOCAL 2> nul
ECHO BusyBox is missing
EXIT /B 127
)

SET "LANG=en_US.UTF-8"
SET "MAIN_DIR=%~dp0"

Expand All @@ -19,7 +25,7 @@ IF "%USER_HOME%" == "" (

SET "STARTED_FROM_BATCH_FILE=1"
SET "IS_PATH_INITIALIZED="
SET "QUOTED_PARAMS="
SET "__QUOTED_PARAMS="

SET "DO_INIT_CMDLINE=1"
"%~dp0tools\win\busybox.exe" ash -s -c ". '%~dp0includes\common.sh' || exit ${?}" "ash" %*
Expand Down
Loading

0 comments on commit b0468f4

Please sign in to comment.