CI/CD #20
This file contains hidden or 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
| --- | |
| name: CI/CD | |
| on: | |
| push: | |
| branches: | |
| - "main" | |
| pull_request: | |
| types: | |
| - opened | |
| - synchronize | |
| merge_group: | |
| schedule: | |
| - cron: "0 14 * * 1" # every monday at 9 in the morning CST | |
| workflow_dispatch: | |
| env: | |
| CI: true | |
| FLUTTER_CHANNEL: stable | |
| permissions: | |
| contents: read | |
| jobs: | |
| setup: | |
| name: Setup | |
| timeout-minutes: 5 | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: π Git checkout | |
| uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
| with: | |
| submodules: recursive | |
| clean: true | |
| persist-credentials: false | |
| set-safe-directory: true | |
| fetch-depth: 1 | |
| - name: π¦ Set up Flutter | |
| id: flutter | |
| uses: subosito/flutter-action@fd55f4c5af5b953cc57a2be44cb082c8f6635e8e # v2.21.0 | |
| with: | |
| channel: ${{ env.FLUTTER_CHANNEL }} | |
| flutter-version-file: pubspec.yaml | |
| cache: true | |
| - name: π Disable analytics | |
| run: flutter --disable-analytics | |
| - name: π¦ Install dependencies | |
| run: dart pub get --enforce-lockfile | |
| - name: βοΈ Generate code | |
| run: dart run build_runner build | |
| - name: π² Check for uncommitted changes | |
| uses: infotroph/tree-is-clean@69d598a958e8cb8f3d0e3d52b5ebcd8684f2adc2 # v1.0.6 | |
| build: | |
| name: Build | |
| needs: ["setup"] | |
| timeout-minutes: ${{ (matrix.target == 'web') && 5 || 20 }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| target: | |
| - web | |
| - appbundle | |
| # - ios | |
| # - macos | |
| # - windows | |
| include: | |
| - target: web | |
| os: ubuntu-latest | |
| flutter-flags: --release --wasm | |
| - target: appbundle | |
| os: ubuntu-latest | |
| # This is the least optimized, but is significantly faster in CI. | |
| # Android releases should be built locally on a beefy machine. | |
| flutter-flags: --debug --no-tree-shake-icons --no-shrink | |
| # - target: ios | |
| # os: macos-latest | |
| # flutter-flags: --debug --no-tree-shake-icons | |
| # - target: macos | |
| # os: macos-latest | |
| # flutter-flags: --debug --no-tree-shake-icons | |
| # - target: windows | |
| # os: windows-latest | |
| # flutter-flags: --debug --no-tree-shake-icons | |
| steps: | |
| - name: π Git checkout | |
| uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
| with: | |
| submodules: recursive | |
| clean: true | |
| persist-credentials: false | |
| set-safe-directory: true | |
| fetch-depth: 1 | |
| - name: π¦ Set up Flutter | |
| id: flutter | |
| uses: subosito/flutter-action@fd55f4c5af5b953cc57a2be44cb082c8f6635e8e # v2.21.0 | |
| with: | |
| channel: ${{ env.FLUTTER_CHANNEL }} | |
| flutter-version-file: pubspec.yaml | |
| cache: true | |
| - name: β Setup Java | |
| if: ${{ matrix.target == 'appbundle' }} | |
| uses: actions/setup-java@dded0888837ed1f317902acf8a20df0ad188d165 # v5.0.0 | |
| with: | |
| distribution: "jetbrains" | |
| java-version: "17" | |
| cache: "gradle" | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: π Disable analytics | |
| run: flutter --disable-analytics | |
| - name: π¦ Install dependencies | |
| run: dart pub get --enforce-lockfile | |
| - name: π§ Build | |
| run: flutter build ${{ matrix.target }} --no-pub ${{ matrix.flutter-flags }} | |
| - name: βοΈ Upload build | |
| if: ${{ matrix.target == 'web' }} | |
| uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 | |
| with: | |
| name: build-${{ matrix.target }} | |
| path: "./build/${{ matrix.target }}/" | |
| if-no-files-found: error | |
| lint: | |
| name: Linting | |
| needs: ["setup"] | |
| timeout-minutes: 5 | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: π Git checkout | |
| uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
| with: | |
| submodules: recursive | |
| clean: true | |
| persist-credentials: false | |
| set-safe-directory: true | |
| fetch-depth: 1 | |
| - name: π¦ Set up Flutter | |
| id: flutter | |
| uses: subosito/flutter-action@fd55f4c5af5b953cc57a2be44cb082c8f6635e8e # v2.21.0 | |
| with: | |
| channel: ${{ env.FLUTTER_CHANNEL }} | |
| flutter-version-file: pubspec.yaml | |
| cache: true | |
| - name: π Disable analytics | |
| run: flutter --disable-analytics | |
| - name: π¦ Install dependencies | |
| run: dart pub get --enforce-lockfile | |
| - name: π΅οΈ Analyze project source | |
| run: dart analyze --fatal-infos | |
| - name: π΅οΈ Run Custom Lint Rules | |
| run: dart run custom_lint | |
| format: | |
| name: Formatting | |
| needs: ["setup"] | |
| timeout-minutes: 3 | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: π Git checkout | |
| uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
| with: | |
| submodules: recursive | |
| clean: true | |
| persist-credentials: false | |
| set-safe-directory: true | |
| fetch-depth: 1 | |
| - name: π¦ Set up Flutter | |
| id: flutter | |
| uses: subosito/flutter-action@fd55f4c5af5b953cc57a2be44cb082c8f6635e8e # v2.21.0 | |
| with: | |
| channel: ${{ env.FLUTTER_CHANNEL }} | |
| flutter-version-file: pubspec.yaml | |
| cache: true | |
| - name: π Disable analytics | |
| run: flutter --disable-analytics | |
| - name: π¦ Install dependencies | |
| run: dart pub get --enforce-lockfile | |
| - name: β¨ Verify formatting | |
| run: dart format . --output=none --set-exit-if-changed | |
| spell-check: | |
| name: Check Spelling | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: π Git Checkout | |
| uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
| with: | |
| submodules: recursive | |
| clean: true | |
| persist-credentials: false | |
| set-safe-directory: true | |
| - name: πͺ Spell Check Repo | |
| uses: crate-ci/typos@85f62a8a84f939ae994ab3763f01a0296d61a7ee # v1.36.2 | |
| link-check: | |
| name: Check Links | |
| timeout-minutes: 2 | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: π Git checkout | |
| uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
| with: | |
| submodules: recursive | |
| clean: true | |
| persist-credentials: false | |
| set-safe-directory: true | |
| - name: βοΈ Restore lychee cache | |
| uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4 | |
| with: | |
| path: .lycheecache | |
| key: cache-lychee-${{ github.sha }} | |
| restore-keys: cache-lychee- | |
| - name: πͺ Link check | |
| uses: lycheeverse/lychee-action@885c65f3dc543b57c898c8099f4e08c8afd178a2 # v2.6.1 | |
| with: | |
| args: --cache --max-cache-age 1d . | |
| token: ${{ github.token }} | |
| markdownlint: | |
| name: Lint Markdown | |
| timeout-minutes: 4 | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: π Git checkout | |
| uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
| with: | |
| submodules: recursive | |
| clean: true | |
| persist-credentials: false | |
| set-safe-directory: true | |
| fetch-depth: 1 | |
| - name: π΅οΈ Lint Markdown | |
| uses: DavidAnson/markdownlint-cli2-action@992badcdf24e3b8eb7e87ff9287fe931bcb00c6e # v20.0.0 | |
| id: markdownlint | |
| with: | |
| fix: true | |
| # Surprisingly, the default is to only lint the project root. | |
| globs: | | |
| **/*.md | |
| zizmor: | |
| name: Run zizmor | |
| timeout-minutes: 1 | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| security-events: write | |
| actions: read | |
| steps: | |
| - name: π Git Checkout | |
| uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
| with: | |
| submodules: recursive | |
| clean: true | |
| persist-credentials: false | |
| set-safe-directory: true | |
| - name: π Run zizmor | |
| uses: zizmorcore/zizmor-action@5ca5fc7a4779c5263a3ffa0e1f693009994446d1 # v0.1.2 | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |