From b605013805cdd02e343c64d9407f5aaf1f0a3773 Mon Sep 17 00:00:00 2001 From: Calvin Tam Date: Tue, 27 Jul 2021 12:28:56 -0700 Subject: [PATCH] Adding Github Actions for CI/CD (#30) * Add flutter-action for test * Run flutter-action on every push * Flutter analyze ignore fatal infos * Add format job in flutter-action * Rename flutter-action to ci * Adding caches to ci * Use github.ref + pubspec.yaml hash for cache key * Limit pull_request trigger for ci * Add cd github action * Ignore push with changes on folder starting with `.` and files ending with `.md` * Remove empty lines * Remove empty lines * Remove comments * Update cd.yml * Fix cat -> echo $ENV * Remove all comments * Remove comments * Remove empty line * Use k-paxian/dart-package-publisher action for CD * Add line break at EOF Co-authored-by: Felix --- .github/workflows/cd.yml | 18 ++++++++++++++++ .github/workflows/ci.yml | 46 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 64 insertions(+) create mode 100644 .github/workflows/cd.yml create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml new file mode 100644 index 0000000..097cde1 --- /dev/null +++ b/.github/workflows/cd.yml @@ -0,0 +1,18 @@ +name: cd + +on: + release: + types: + - published + +jobs: + publish: + runs-on: ubuntu-latest + environment: release + steps: + - uses: actions/checkout@v2 + - uses: k-paxian/dart-package-publisher@master + with: + accessToken: ${{ secrets.OAUTH_ACCESS_TOKEN }} + refreshToken: ${{ secrets.OAUTH_REFRESH_TOKEN }} + format: true diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..f13c7b6 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,46 @@ +name: ci + +on: + push: + paths-ignore: + - '**/*.md' + - '.*/**' + pull_request: + types: + - ready_for_review + - synchronize + workflow_dispatch: + +jobs: + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-java@v1 + with: + java-version: '12.x' + - uses: actions/cache@v2 + with: + path: /opt/hostedtoolcache/flutter + key: ${{ github.ref }}-${{ hashFiles('pubspec.yaml') }} + - uses: subosito/flutter-action@v1 + - run: flutter doctor -v + - run: flutter pub get + - run: flutter analyze --no-fatal-infos + - run: flutter test + + format: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-java@v1 + with: + java-version: '12.x' + - uses: actions/cache@v2 + with: + path: /opt/hostedtoolcache/flutter + key: ${{ github.ref }}-${{ hashFiles('pubspec.yaml') }} + - uses: subosito/flutter-action@v1 + - run: flutter doctor -v + - run: flutter pub get + - run: flutter format --set-exit-if-changed --dry-run .