diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000000..85148a2632 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,59 @@ +name: APK Build + +on: + pull_request: { } + push: + branches: [ main, develop ] + +jobs: + debug: + name: Build debug APKs (${{ matrix.target }}) + runs-on: ubuntu-latest + if: github.ref != 'refs/heads/main' + strategy: + fail-fast: false + 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 assemble${{ matrix.target }}Debug --stacktrace + - name: Upload ${{ matrix.target }} debug APKs + uses: actions/upload-artifact@v2 + with: + name: vector-${{ matrix.target }}-debug + path: | + vector/build/outputs/apk/*/debug/*.apk + + release: + name: Build unsigned GPlay APKs + runs-on: ubuntu-latest + if: github.ref == 'refs/heads/main' + 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 Gplay unsigned APKs + uses: actions/upload-artifact@v2 + with: + name: vector-gplay-release-unsigned + path: | + vector/build/outputs/apk/*/release/*.apk + +# TODO: add exodus checks diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml new file mode 100644 index 0000000000..cb6f1b0e48 --- /dev/null +++ b/.github/workflows/integration.yml @@ -0,0 +1,49 @@ +name: Integration Test + +on: + pull_request: { } + push: + branches: [ main, develop ] + +jobs: + integration-tests: + name: Integration Tests (Synapse) + runs-on: ubuntu-latest + strategy: + matrix: + api-level: [21, 30] + steps: + - uses: actions/checkout@v2 + - name: Set up Python 3.8 + uses: actions/setup-python@v2 + with: + python-version: 3.8 + - name: Cache pip + uses: actions/cache@v2 + with: + path: ~/.cache/pip + key: ${{ runner.os }}-pip + restore-keys: | + ${{ runner.os }}-pip- + ${{ runner.os }}- + - 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: Start synapse server + run: | + python3 -m venv .synapse + source .synapse/bin/activate + pip install synapse matrix-synapse + curl -sL https://raw.githubusercontent.com/matrix-org/synapse/develop/demo/start.sh --no-rate-limit \ + | sed s/127.0.0.1/0.0.0.0/g | bash + - name: Run integration tests on API ${{ matrix.api-level }} + uses: reactivecircus/android-emulator-runner@v2 + with: + api-level: ${{ matrix.api-level }} + # script: ./gradlew -PallWarningsAsErrors=false vector:connectedAndroidTest matrix-sdk-android:connectedAndroidTest + script: ./gradlew -PallWarningsAsErrors=false connectedCheck diff --git a/.github/workflows/quality.yml b/.github/workflows/quality.yml new file mode 100644 index 0000000000..a65e6b5dee --- /dev/null +++ b/.github/workflows/quality.yml @@ -0,0 +1,74 @@ +name: Code Quality Checks + +on: + pull_request: { } + push: + branches: [ main, 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: linting-report-android-sdk + path: matrix-sdk-android/build/reports/*.* + + apk-lint: + name: Lint APK (${{ matrix.target }}) + runs-on: ubuntu-latest + if: github.ref != 'refs/heads/main' + strategy: + fail-fast: false + 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: Lint ${{ matrix.target }} release + run: ./gradlew clean lint${{ matrix.target }}Release --stacktrace + - name: Upload ${{ matrix.target }} linting report + uses: actions/upload-artifact@v2 + if: always() + with: + name: release-debug-linting-report-${{ matrix.target }} + path: | + vector/build/reports/*.* diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000000..6e51368ce5 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,23 @@ +name: Test + +on: + pull_request: {} + push: + branches: [main, develop] + +jobs: + unit-tests: + name: Run 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