Continuous Integration #1893
This file contains hidden or 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: Continuous Integration | |
| on: | |
| push: | |
| branches: [ main ] | |
| tags: | |
| - "v*.*.*" | |
| pull_request: | |
| branches: [ main ] | |
| schedule: | |
| - cron: "0 7 */3 * *" | |
| merge_group: | |
| types: [ checks_requested ] | |
| jobs: | |
| build: | |
| name: Build and test | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout (with history) | |
| uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
| with: | |
| fetch-depth: 0 | |
| fetch-tags: true | |
| - name: Set up JDK | |
| uses: actions/setup-java@dded0888837ed1f317902acf8a20df0ad188d165 # v5.0.0 | |
| with: | |
| distribution: 'zulu' | |
| java-version: '17' | |
| - name: Setup Gradle | |
| uses: gradle/actions/setup-gradle@4d9f0ba0025fe599b4ebab900eb7f3a1d93ef4c2 # v5.0.0 | |
| - name: Delete old Android SDK cmdline-tools | |
| run: | | |
| rm -rf $ANDROID_HOME/cmdline-tools/latest | |
| - name: Setup Android SDK | |
| uses: android-actions/setup-android@9fc6c4e9069bf8d3d10b2204b1fb8f6ef7065407 # v3.2.2 | |
| with: | |
| cmdline-tools-version: '13114758' | |
| packages: 'cmdline-tools;latest tools platform-tools' | |
| - name: Cache Gradle Home files | |
| uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 | |
| continue-on-error: true | |
| with: | |
| path: ~/.gradle/caches | |
| key: ${{ runner.os }}-gradle-home-examples-${{ hashFiles('**/*.gradle') }} | |
| - name: Build ConnectBot | |
| run: ./gradlew build bundleGoogleRelease | |
| - name: Enable KVM for emulator | |
| run: | | |
| echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules | |
| sudo udevadm control --reload-rules | |
| sudo udevadm trigger --name-match=kvm | |
| - name: Run instrument tests | |
| uses: reactivecircus/android-emulator-runner@1dcd0090116d15e7c562f8db72807de5e036a4ed # v2.34.0 | |
| with: | |
| api-level: 29 | |
| target: default | |
| arch: x86_64 | |
| script: ./gradlew connectedCheck --continue | |
| - name: Prepare release | |
| if: ${{ github.event_name == 'push' }} | |
| run: | | |
| if git describe --exact-match; then \ | |
| TAGGED=yes | |
| fi | |
| if [[ -n $TAGGED ]]; then | |
| GITHUB_TAG="$(git describe)" | |
| echo "${GITHUB_TAG}" > tag.txt | |
| echo "Release ${GITHUB_TAG}" > release-title.txt | |
| else \ | |
| GITHUB_TAG="git-$(git describe)" | |
| GITHUB_TITLE="$(git log -1 --pretty=%B | head -1)" | |
| echo "${GITHUB_TAG}" > tag.txt | |
| echo "${GITHUB_TAG}: ${GITHUB_TITLE}" > release-title.txt | |
| fi | |
| cp ./app/build/outputs/apk/oss/release/app-oss-release-unsigned.apk ConnectBot-${GITHUB_TAG}-oss-unsigned.apk | |
| cp ./app/build/outputs/apk/google/release/app-google-release-unsigned.apk ConnectBot-${GITHUB_TAG}-google-unsigned.apk | |
| cp ./app/build/outputs/bundle/googleRelease/app-google-release.aab ConnectBot-${GITHUB_TAG}-google-unsigned.aab | |
| cp ./app/build/outputs/native-debug-symbols/googleRelease/native-debug-symbols.zip ConnectBot-${GITHUB_TAG}-google.native-debug-symbols.zip | |
| cp ./app/build/outputs/native-debug-symbols/ossRelease/native-debug-symbols.zip ConnectBot-${GITHUB_TAG}-oss.native-debug-symbols.zip | |
| - name: Store artifacts for upload | |
| if: ${{ github.event_name == 'push' }} | |
| uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0 | |
| with: | |
| name: apk | |
| path: | | |
| release-title.txt | |
| tag.txt | |
| ConnectBot-*-unsigned.apk | |
| ConnectBot-*-unsigned.aab | |
| ConnectBot-*.native-debug-symbols.zip | |
| upload: | |
| name: Upload to GitHub releases | |
| needs: build | |
| if: ${{ (github.event_name == 'push') && (github.repository == 'connectbot/connectbot') && ((github.ref == 'refs/heads/main') || startsWith(github.ref, 'refs/tags/v')) }} | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Download artifacts from previous job | |
| uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6.0.0 | |
| with: | |
| name: apk | |
| - name: Set release name | |
| id: name | |
| run: | | |
| echo "RELEASE_TITLE=$(cat release-title.txt)" >> "$GITHUB_OUTPUT" | |
| echo "GITHUB_TAG=$(cat tag.txt)" >> "$GITHUB_OUTPUT" | |
| - name: Upload release | |
| uses: softprops/action-gh-release@6da8fa9354ddfdc4aeace5fc48d7f679b5214090 # v2.4.1 | |
| with: | |
| body: "Untested build" | |
| draft: true | |
| tag_name: ${{ steps.name.outputs.GITHUB_TAG }} | |
| name: ${{ steps.name.outputs.RELEASE_TITLE }} | |
| generate_release_notes: true | |
| files: | | |
| ConnectBot-*-unsigned.apk | |
| ConnectBot-*-unsigned.aab | |
| ConnectBot-*.native-debug-symbols.zip | |
| signing: | |
| name: Trigger remote signing | |
| needs: upload | |
| if: ${{ (github.event_name == 'push') && (github.repository == 'connectbot/connectbot') && ((github.ref == 'refs/heads/main') || startsWith(github.ref, 'refs/tags/v')) }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Download artifacts from previous job | |
| uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6.0.0 | |
| with: | |
| name: apk | |
| - name: Set release name | |
| id: name | |
| run: | | |
| echo "GITHUB_TAG=$(cat tag.txt)" >> "$GITHUB_OUTPUT" | |
| - name: Call remote signer | |
| uses: distributhor/workflow-webhook@2381f0e9c7b6bf061fb1405bd0804b8706116369 # v3.0.8 | |
| with: | |
| webhook_url: ${{ secrets.SIGNER_WEBHOOK_URL }} | |
| data: '{"tag_id": "${{ steps.name.outputs.GITHUB_TAG }}"}' |