Change pub cache key for flutter action to force refresh #159
Workflow file for this run
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
name: CI | |
on: | |
pull_request_target: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
lint-test: | |
name: Lint and Unit Tests | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: subosito/flutter-action@v2 | |
with: | |
channel: 'stable' | |
cache: true | |
cache-key: "flutterCacheV1-:os:-:channel:-:version:-:arch:-:hash:" | |
pub-cache-key: "flutterPubCacheV1-:os:-:channel:-:version:-:arch:-:hash:" | |
- name: Setup .env.dev | |
env: | |
ENV_FILE: ${{ secrets.ENV_DEV }} | |
run: echo -n $ENV_FILE | base64 --decode > .env.dev | |
- name: Activate derry | |
run: flutter pub global activate derry | |
- name: Get Dependencies | |
run: flutter pub get | |
- name: Run build_runner | |
run: derry build_runner | |
- name: Lint | |
run: derry analyze | |
- name: Format | |
run: derry format | |
- name: Unit tests | |
run: derry test exclude-goldens -- --coverage-path=coverage/lcov.base.info --coverage | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: base-coverage-${{ github.event.number }} | |
path: coverage | |
retention-days: 7 | |
build-android: | |
name: Build Android | |
runs-on: ubuntu-latest | |
needs: [ lint-test ] | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: subosito/flutter-action@v2 | |
with: | |
channel: 'stable' | |
cache: true | |
- name: Setup .env.dev | |
env: | |
ENV_FILE: ${{ secrets.ENV_DEV }} | |
run: echo -n $ENV_FILE | base64 --decode > .env.dev | |
- name: Activate derry | |
run: flutter pub global activate derry | |
- name: Get Dependencies | |
run: flutter pub get | |
- name: Run build_runner | |
run: derry build_runner | |
- name: Build Android | |
run: derry build apk dev | |
build-ios: | |
name: Golden Tests and Build iOS | |
runs-on: macos-latest | |
needs: [ lint-test ] | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: subosito/flutter-action@v2 | |
with: | |
channel: 'stable' | |
cache: true | |
- name: Setup .env.dev | |
env: | |
ENV_FILE: ${{ secrets.ENV_DEV }} | |
run: echo -n $ENV_FILE | base64 --decode > .env.dev | |
- name: Activate derry | |
run: flutter pub global activate derry | |
- name: Get Dependencies | |
run: flutter pub get | |
- name: Run build_runner | |
run: derry build_runner | |
- uses: actions/download-artifact@v3 | |
with: | |
name: base-coverage-${{ github.event.number }} | |
path: coverage | |
- name: Setup lcov | |
run: brew install lcov | |
- name: Golden tests | |
run: derry test goldens -- --merge-coverage --coverage | |
- uses: actions/upload-artifact@v3 | |
if: failure() | |
with: | |
name: my-artifact | |
path: test/presentation/goldens/**/failures/*.png | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: coverage-${{ github.event.number }} | |
path: coverage | |
retention-days: 7 | |
- name: Build iOS | |
run: derry build ios dev | |
build-web: | |
name: Build Web | |
runs-on: ubuntu-latest | |
needs: [ lint-test ] | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: subosito/flutter-action@v2 | |
with: | |
channel: 'stable' | |
cache: true | |
- name: Setup .env.dev | |
env: | |
ENV_FILE: ${{ secrets.ENV_DEV }} | |
run: echo -n $ENV_FILE | base64 --decode > .env.dev | |
- name: Activate derry | |
run: flutter pub global activate derry | |
- name: Get Dependencies | |
run: flutter pub get | |
- name: Run build_runner | |
run: derry build_runner | |
- name: Build Web | |
run: derry build web dev | |
sonar-scan: | |
name: SonarQube Scan | |
runs-on: ubuntu-latest | |
needs: [build-android,build-ios,build-web] | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis | |
- uses: actions/download-artifact@v3 | |
with: | |
name: coverage-${{ github.event.number }} | |
path: coverage | |
- uses: sonarsource/sonarqube-scan-action@master | |
env: | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }} | |
# If you wish to fail your job when the Quality Gate is red, uncomment the | |
# following lines. This would typically be used to fail a deployment. | |
# We do not recommend to use this in a pull request. Prefer using pull request | |
# decoration instead. | |
# - uses: sonarsource/sonarqube-quality-gate-action@master | |
# timeout-minutes: 5 | |
# env: | |
# SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} |