diff options
Diffstat (limited to '.github/workflows')
| -rw-r--r-- | .github/workflows/dependency-review.yml | 27 | ||||
| -rw-r--r-- | .github/workflows/quality-check.yml | 91 | ||||
| -rw-r--r-- | .github/workflows/release.yml | 126 | ||||
| -rw-r--r-- | .github/workflows/scorecards.yml | 76 |
4 files changed, 320 insertions, 0 deletions
diff --git a/.github/workflows/dependency-review.yml b/.github/workflows/dependency-review.yml new file mode 100644 index 0000000..93101e7 --- /dev/null +++ b/.github/workflows/dependency-review.yml @@ -0,0 +1,27 @@ +# Dependency Review Action +# +# This Action will scan dependency manifest files that change as part of a Pull Request, +# surfacing known-vulnerable versions of the packages declared or updated in the PR. +# Once installed, if the workflow run is marked as required, +# PRs introducing known-vulnerable packages will be blocked from merging. +# +# Source repository: https://github.com/actions/dependency-review-action +name: 'Dependency Review' +on: [pull_request] + +permissions: + contents: read + +jobs: + dependency-review: + runs-on: ubuntu-latest + steps: + - name: Harden Runner + uses: step-security/harden-runner@20cf305ff2072d973412fa9b1e3a4f227bda3c76 # v2.14.0 + with: + egress-policy: audit + + - name: 'Checkout Repository' + uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 + - name: 'Dependency Review' + uses: actions/dependency-review-action@3c4e3dcb1aa7874d2c16be7d79418e9b7efd6261 # v4.8.2 diff --git a/.github/workflows/quality-check.yml b/.github/workflows/quality-check.yml new file mode 100644 index 0000000..e92291f --- /dev/null +++ b/.github/workflows/quality-check.yml @@ -0,0 +1,91 @@ +name: Quality check + +on: + push: + branches: [ "develop", "main" ] + pull_request: + branches: [ "develop", "main" ] + types: [ opened, synchronize, reopened ] + schedule: + - cron: '17 8 * * 3' + +# Declare default permissions as read only. +permissions: read-all + +jobs: + analyze_flutter: + name: Flutter analysis + runs-on: ubuntu-latest + steps: + - name: Harden Runner + uses: step-security/harden-runner@20cf305ff2072d973412fa9b1e3a4f227bda3c76 # v2.14.0 + with: + egress-policy: audit + + - name: Checkout repository + uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 + + - name: Get Flutter packages + run: ./flutterw pub get + + - name: Generate app localizations + run: ./flutterw gen-l10n + + - name: Static analysis. + run: ./flutterw analyze + + - name: Unit tests. + run: ./flutterw test + + analyze_codeql: + name: CodeQL analysis (${{ matrix.language }}) + runs-on: ubuntu-latest + permissions: + # required for all workflows + security-events: write + + # required to fetch internal or private CodeQL packs + packages: read + + strategy: + fail-fast: false + matrix: + include: + - language: java-kotlin + build-mode: manual + steps: + - name: Harden Runner + uses: step-security/harden-runner@20cf305ff2072d973412fa9b1e3a4f227bda3c76 # v2.14.0 + with: + egress-policy: audit + + # Building relies on the Android Gradle plugin, + # which requires a modern Java version (not the default one). + - name: Set up JDK for Android Gradle plugin + uses: actions/setup-java@f2beeb24e141e01a676f977032f5a29d81c9e27e # v5.1.0 + with: + distribution: 'temurin' + java-version: '21' + + - name: Checkout repository + uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 + + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@5d4e8d1aca955e8d8589aabd499c5cae939e33c7 # v4.31.9 + with: + languages: ${{ matrix.language }} + build-mode: ${{ matrix.build-mode }} + + - if: matrix.build-mode == 'manual' + shell: bash + # build in profile mode, instead of release, + # so that setting up signing environment variables is not required + run: | + scripts/apply_flavor_play.sh + ./flutterw build apk --profile -t lib/main_play.dart --flavor play + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@5d4e8d1aca955e8d8589aabd499c5cae939e33c7 # v4.31.9 + with: + category: "/language:${{matrix.language}}" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..6b4c0c4 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,126 @@ +name: Release on tag + +on: + push: + tags: + - v* + +# Declare default permissions as read only. +permissions: read-all + +jobs: + release_github: + name: GitHub release + runs-on: ubuntu-latest + permissions: + attestations: write + contents: write + id-token: write + steps: + - name: Harden Runner + uses: step-security/harden-runner@20cf305ff2072d973412fa9b1e3a4f227bda3c76 # v2.14.0 + with: + egress-policy: audit + + # Building relies on the Android Gradle plugin, + # which requires a modern Java version (not the default one). + - name: Set up JDK for Android Gradle plugin + uses: actions/setup-java@f2beeb24e141e01a676f977032f5a29d81c9e27e # v5.1.0 + with: + distribution: 'temurin' + java-version: '21' + + - name: Checkout repository + uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 + + - name: Get Flutter packages + run: ./flutterw pub get + + - name: Generate app localizations + run: ./flutterw gen-l10n + + - name: Update Flutter version file + run: scripts/update_flutter_version.sh + + - name: Build signed artifacts + # `KEY_JKS` should contain the result of: + # gpg -c --armor keystore.jks + # `KEY_JKS_PASSPHRASE` should contain the passphrase used for the command above + # The SkSL bundle must be produced with the same Flutter engine as the one used to build the artifact + # flutter build <subcommand> --bundle-sksl-path shaders.sksl.json + # do not bundle shaders for izzy/libre flavours, to avoid crashes in some environments: + # cf https://github.com/deckerst/aves/issues/388 + # cf https://github.com/deckerst/aves/issues/398 + run: | + echo "${{ secrets.KEY_JKS }}" > release.keystore.asc + gpg -d --passphrase "${{ secrets.KEY_JKS_PASSPHRASE }}" --batch release.keystore.asc > $AVES_STORE_FILE + rm release.keystore.asc + mkdir outputs + scripts/apply_flavor_play.sh + ./flutterw build appbundle -t lib/main_play.dart --flavor play --bundle-sksl-path shaders.sksl.json + cp build/app/outputs/bundle/playRelease/*.aab outputs + ./flutterw build apk -t lib/main_play.dart --flavor play --bundle-sksl-path shaders.sksl.json + cp build/app/outputs/apk/play/release/*.apk outputs + scripts/apply_flavor_izzy.sh + ./flutterw build apk -t lib/main_izzy.dart --flavor izzy --split-per-abi + cp build/app/outputs/apk/izzy/release/*.apk outputs + scripts/apply_flavor_libre.sh + ./flutterw build appbundle -t lib/main_libre.dart --flavor libre + cp build/app/outputs/bundle/libreRelease/*.aab outputs + ./flutterw build apk -t lib/main_libre.dart --flavor libre --split-per-abi + cp build/app/outputs/apk/libre/release/*.apk outputs + ./flutterw build apk -t lib/main_libre.dart --flavor libre_rom + cp build/app/outputs/apk/libre_rom/release/*.apk outputs + rm $AVES_STORE_FILE + env: + AVES_STORE_FILE: ${{ github.workspace }}/key.jks + AVES_STORE_PASSWORD: ${{ secrets.AVES_STORE_PASSWORD }} + AVES_KEY_ALIAS: ${{ secrets.AVES_KEY_ALIAS }} + AVES_KEY_PASSWORD: ${{ secrets.AVES_KEY_PASSWORD }} + AVES_GOOGLE_API_KEY: ${{ secrets.AVES_GOOGLE_API_KEY }} + + - name: Generate artifact attestation + uses: actions/attest-build-provenance@00014ed6ed5efc5b1ab7f7f34a39eb55d41aa4f8 # v3.1.0 + with: + subject-path: 'outputs/*' + + - name: Create GitHub release + uses: ncipollo/release-action@b7eabc95ff50cbeeedec83973935c8f306dfcd0b # v1.20.0 + with: + artifacts: "outputs/*" + body: "[Changelog](https://github.com/${{ github.repository }}/blob/develop/CHANGELOG.md#${{ github.ref_name }})" + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Upload app bundle + uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0 + with: + name: appbundle + path: outputs/app-play-release.aab + + release_play: + name: Play Store beta release + needs: [ release_github ] + runs-on: ubuntu-latest + steps: + - name: Harden Runner + uses: step-security/harden-runner@20cf305ff2072d973412fa9b1e3a4f227bda3c76 # v2.14.0 + with: + egress-policy: audit + + - name: Checkout repository + uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 + + - name: Get appbundle from artifacts + uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0 + with: + name: appbundle + + - name: Release to beta channel + uses: r0adkll/upload-google-play@935ef9c68bb393a8e6116b1575626a7f5be3a7fb # v1.1.3 + with: + serviceAccountJsonPlainText: ${{ secrets.PLAYSTORE_ACCOUNT_KEY }} + packageName: deckers.thibault.aves + releaseFiles: app-play-release.aab + track: beta + status: completed + whatsNewDirectory: whatsnew diff --git a/.github/workflows/scorecards.yml b/.github/workflows/scorecards.yml new file mode 100644 index 0000000..eefd90c --- /dev/null +++ b/.github/workflows/scorecards.yml @@ -0,0 +1,76 @@ +# This workflow uses actions that are not certified by GitHub. They are provided +# by a third-party and are governed by separate terms of service, privacy +# policy, and support documentation. + +name: Scorecard supply-chain security +on: + # For Branch-Protection check. Only the default branch is supported. See + # https://github.com/ossf/scorecard/blob/main/docs/checks.md#branch-protection + branch_protection_rule: + # To guarantee Maintained check is occasionally updated. See + # https://github.com/ossf/scorecard/blob/main/docs/checks.md#maintained + schedule: + - cron: '20 7 * * 2' + push: + branches: ["develop"] + +# Declare default permissions as read only. +permissions: read-all + +jobs: + analysis: + name: Scorecard analysis + runs-on: ubuntu-latest + permissions: + # Needed to upload the results to code-scanning dashboard. + security-events: write + # Needed to publish results and get a badge (see publish_results below). + id-token: write + contents: read + actions: read + + steps: + - name: Harden Runner + uses: step-security/harden-runner@20cf305ff2072d973412fa9b1e3a4f227bda3c76 # v2.14.0 + with: + egress-policy: audit + + - name: "Checkout code" + uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 + with: + persist-credentials: false + + - name: "Run analysis" + uses: ossf/scorecard-action@4eaacf0543bb3f2c246792bd56e8cdeffafb205a # v2.4.3 + with: + results_file: results.sarif + results_format: sarif + # (Optional) "write" PAT token. Uncomment the `repo_token` line below if: + # - you want to enable the Branch-Protection check on a *public* repository, or + # - you are installing Scorecards on a *private* repository + # To create the PAT, follow the steps in https://github.com/ossf/scorecard-action#authentication-with-pat. + # repo_token: ${{ secrets.SCORECARD_TOKEN }} + + # Public repositories: + # - Publish results to OpenSSF REST API for easy access by consumers + # - Allows the repository to include the Scorecard badge. + # - See https://github.com/ossf/scorecard-action#publishing-results. + # For private repositories: + # - `publish_results` will always be set to `false`, regardless + # of the value entered here. + publish_results: true + + # Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF + # format to the repository Actions tab. + - name: "Upload artifact" + uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0 + with: + name: SARIF file + path: results.sarif + retention-days: 5 + + # Upload the results to GitHub's code scanning dashboard. + - name: "Upload to code-scanning" + uses: github/codeql-action/upload-sarif@5d4e8d1aca955e8d8589aabd499c5cae939e33c7 # v4.31.9 + with: + sarif_file: results.sarif |
