From ff1d8c310e30a184dc0916ded163184ea44490eb Mon Sep 17 00:00:00 2001 From: Arun Babu Neelicattu Date: Thu, 25 Mar 2021 12:26:26 +0100 Subject: [PATCH] ci: add initial github actions pipelines --- .github/workflows/build.yml | 59 +++++++++++++++++++++++++++++++++++ .github/workflows/quality.yml | 46 +++++++++++++++++++++++++++ .github/workflows/tests.yml | 39 +++++++++++++++++++++++ 3 files changed, 144 insertions(+) create mode 100644 .github/workflows/build.yml create mode 100644 .github/workflows/quality.yml create mode 100644 .github/workflows/tests.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000000..6df5bb7c70 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,59 @@ +name: Build + +on: + pull_request: {} + push: + branches: [master, develop] + +jobs: + debug: + name: Build debug APK (${{ matrix.target }}) + runs-on: ubuntu-latest + if: github.ref != 'refs/heads/master' + strategy: + matrix: + target: [ Gplay, Fdroid ] + steps: + - uses: actions/checkout@v2 + - uses: actions/cache@v2 + with: + path: | + ~/.gradle/caches + ~/.gradle/wrapper + key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} + restore-keys: | + ${{ runner.os }}-gradle- + - name: Assemble ${{ matrix.target }} debug apk + run: ./gradlew clean lint${{ matrix.target }}Release assemble${{ matrix.target }}Debug --stacktrace + - name: Upload APKs + uses: actions/upload-artifact@v2 + with: + name: release-debug-${{ matrix.target }} + path: | + vector/build/outputs/apk/*/debug/*.apk + vector/build/reports/*.* + + gplay: + name: Build unsigned GPlay APK + runs-on: ubuntu-latest + if: github.ref == 'refs/heads/master' + steps: + - uses: actions/checkout@v2 + - uses: actions/cache@v2 + with: + path: | + ~/.gradle/caches + ~/.gradle/wrapper + key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} + restore-keys: | + ${{ runner.os }}-gradle- + - name: Assemble GPlay unsigned apk + run: ./gradlew clean assembleGplayRelease --stacktrace + - name: Upload APKs + uses: actions/upload-artifact@v2 + with: + name: release-unsigned-GPlay + path: | + vector/build/outputs/apk/*/debug/*.apk + +# TODO: add exodus checks diff --git a/.github/workflows/quality.yml b/.github/workflows/quality.yml new file mode 100644 index 0000000000..fe41dfde74 --- /dev/null +++ b/.github/workflows/quality.yml @@ -0,0 +1,46 @@ +name: Code Quality Checks + +on: + pull_request: {} + push: + branches: [master, develop] + +jobs: + check: + name: Project Check Suite + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Run code quality check suite + run: ./tools/check/check_code_quality.sh + + klint: + name: Kotlin Linter + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Run klint + run: | + curl -sSLO https://github.com/pinterest/ktlint/releases/download/0.36.0/ktlint && chmod a+x ktlint + ./ktlint --android --experimental -v + + android-lint: + name: Android Linter + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/cache@v2 + with: + path: | + ~/.gradle/caches + ~/.gradle/wrapper + key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} + restore-keys: | + ${{ runner.os }}-gradle- + - name: Lint analysis of the SDK + run: ./gradlew clean :matrix-sdk-android:lintRelease --stacktrace + - name: Upload reports + uses: actions/upload-artifact@v2 + with: + name: report-lint-andorid-sdk + path: matrix-sdk-android/build/reports/*.* diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000000..d95b6bbc21 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,39 @@ +name: Test + +on: + pull_request: {} + push: + branches: [master, develop] + +jobs: + unit-tests: + name: Unit Tests + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/cache@v2 + with: + path: | + ~/.gradle/caches + ~/.gradle/wrapper + key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} + restore-keys: | + ${{ runner.os }}-gradle- + - name: Run unit tests + run: ./gradlew clean test --stacktrace -PallWarningsAsErrors=false + + android-tests: + name: Android Tests + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/cache@v2 + with: + path: | + ~/.gradle/caches + ~/.gradle/wrapper + key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} + restore-keys: | + ${{ runner.os }}-gradle- + - name: Run android tests + run: ./gradlew clean assembleAndroidTest --stacktrace -PallWarningsAsErrors=false