Skip to content

Latest commit

 

History

History
163 lines (122 loc) · 3.44 KB

File metadata and controls

163 lines (122 loc) · 3.44 KB

About

This repo includes common CI workflows for the Instant-Messaging team. It might still include some of the old gitlab templates, but those aren't used anymore.

How to use

Include the workflows you want to use in your projects main workflow, for example:

name: "All the app specific jobs"

on:
  push:
    branches:
      - main
  pull_request:
  merge_group:

concurrency:
  group: ${{ github.ref }}
  cancel-in-progress: true

jobs:
  build_web:
    runs-on: ubuntu-latest
    container:
      image: ghcr.io/famedly/container-image-flutter/flutter:latest
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0
      # You may need to pull this repo instead using a checkout action
      - name: Enable pulling private dependencies
        uses: famedly/frontend-ci-templates/.github/actions/dart-prepare
        with:
          ssh_key: "${{ secrets.CI_SSH_PRIVATE_KEY }}"
      - name: Do dart stuff
        run: |
          ./scripts/prepare-web.sh
          apk add yq
  review_app:
    needs: build_web
    secrets: inherit
    uses: famedly/frontend-ci-templates/.github/workflows/review-app.yml
    with:
      projectname: "app"
      pr: ${{ github.events.pull_request.number }}

  dart:
    permissions:
      contents: read
    uses: famedly/frontend-ci-templates/.github/workflows/dart.yml
    with:
      env_file: ".github/workflows/versions.env"
    secrets:
      ssh_key: "${{ secrets.CI_SSH_PRIVATE_KEY }}"

  general:
    permissions:
      contents: read
    uses: famedly/frontend-ci-templates/.github/workflows/general.yml

You can also include specific subsets of files to reduce the amount of reused jobs.

Workflow Descriptions

This section describes the different workflows and jobs in the template.

general/

These jobs should be useful for all Frontend projects.

conventional_commits

This job checks new commits on a merge request, if they follow the conventional commit specification.

This means commit with the following prefixes in the summary line are allowed:

  • builds
  • chore
  • ci
  • docs
  • feat
  • fix
  • refactor
  • style
  • test
  • revert

dart/

These are dart project specific checks.

Make sure you define the flutter_version and dart_version in an env file and pass it, so that CI knows what container to use.

dart_analyzer

Runs the dart analyzer, formatter and pub get.

review_app

Allows deploying a review app to our testservers. This is currently just done on PRs and they are not cleaned up.

Use unified analysis options:

Import the package as dev dependency:

For Dart projects:

dart_code_linter: any
famedly_dart_lints:
  git:
    url: https://github.com/famedly/frontend-ci-templates.git
    path: lints/dart
lints: any

Add it to your analysis_options.yaml:

include: package:famedly_dart_lints/analysis_options.yaml

For Flutter projects:

dart_code_linter: any
famedly_flutter_lints:
  git:
    url: https://github.com/famedly/frontend-ci-templates.git
    path: lints/flutter
flutter_lints: any

Add it to your analysis_options.yaml:

include: package:famedly_flutter_lints/analysis_options.yaml

Disable a rule:

If your project is not yet ready you can temporarily disable a linter rule like this:

include: package:famedly_flutter_lints/analysis_options.yaml

linter:
  rules:
    avoid_print: false # https://link-to-issue

Please always link an issue to the disabled rule to track the progress!