Update to 1.0.6 #23
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: Tests | |
| on: | |
| push: | |
| branches: | |
| - main | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| packages: write | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up JDK 17 | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: temurin | |
| java-version: 17 | |
| cache: gradle | |
| - name: Grant execute permission for gradlew | |
| run: chmod +x gradlew | |
| - name: Build project with cache | |
| run: ./gradlew assembleDebug --stacktrace | |
| - name: Run app unit tests | |
| run: ./gradlew :app:testDebugUnitTest | |
| - name: Run combot unit tests | |
| run: ./gradlew :combot:testDebugUnitTest | |
| - name: Run UI tests | |
| uses: reactivecircus/android-emulator-runner@v2 | |
| with: | |
| api-level: 29 | |
| arch: x86_64 | |
| profile: Nexus 6 | |
| disable-animations: true | |
| emulator-options: -no-snapshot -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none -no-accel | |
| script: ./gradlew :app:connectedDebugAndroidTest --continue | |
| - name: Get version from Gradle | |
| id: get_version | |
| run: | | |
| VERSION=$(./gradlew :combot:properties -q | grep '^version:' | awk '{print $2}') | |
| if [[ "$VERSION" == "unspecified" ]]; then | |
| echo "ERROR: Version not set in Gradle!" | |
| exit 1 | |
| fi | |
| echo "VERSION=$VERSION" >> $GITHUB_ENV | |
| echo "Detected version: $VERSION" | |
| - name: Create Git tag automatically | |
| if: github.ref == 'refs/heads/main' | |
| run: | | |
| git config user.name "Gabriel Brasileiro" | |
| git config user.email "[email protected]" | |
| git fetch --tags | |
| if git tag --list "${{ env.VERSION }}" | grep -q "${{ env.VERSION }}"; then | |
| echo "Tag ${{ env.VERSION }} already exists. Skipping." | |
| else | |
| echo "Creating tag ${{ env.VERSION }}..." | |
| git tag -a "${{ env.VERSION }}" -m "Release ${{ env.VERSION }}" | |
| git push https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git "${{ env.VERSION }}" | |
| fi | |