diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bd3412a..a43783e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,22 +2,28 @@ name: CI on: push: - branches: - - master + branches-ignore: + - cpp-rewrite + - horizon-os paths-ignore: - '.gitignore' - '**.md' - 'LICENSE' - 'drshorizon/**' - 'res/**' + workflow_dispatch: + +defaults: + run: + shell: bash + +env: + VERSION: "0.101.0" jobs: build: name: ${{ matrix.name }} runs-on: ${{ matrix.os }} - defaults: - run: - shell: bash strategy: fail-fast: true matrix: @@ -57,8 +63,8 @@ jobs: if: ${{ matrix.os == 'ubuntu-latest' }} run: sudo apt install libasound2-dev libudev-dev libgl1-mesa-dev pkg-config - - name: Set up cache - uses: actions/cache@v3 + - name: Restore cache + uses: actions/cache/restore@v3 with: path: | ~/.cargo @@ -82,8 +88,10 @@ jobs: run: | if [ "${{ github.ref_type }}" == "tag" ]; then export DRS_BUILD_VERSION_OVERRIDE="{{ github.ref_name }}" + elif [ "${{ github.ref_name }} == "master"]; then + export DRS_BUILD_VERSION_OVERRIDE="$VERSION-$((${{ github.run_number }} + 654))" else - export DRS_BUILD_VERSION_OVERRIDE="0.101.0-$((${{ github.run_number }} + 654))-${{ github.ref_name }}" + export DRS_BUILD_VERSION_OVERRIDE="$VERSION-${GITHUB_SHA:0:7}" fi mkdir release @@ -108,22 +116,28 @@ jobs: path: ./release/* if-no-files-found: error + - name: Save cache + if: ${{ github.ref_name == 'master' || github.ref_type == 'tag' }} + uses: actions/cache/save@v3 + with: + path: | + ~/.cargo + ~/.rustup + target + key: ${{ matrix.target_name }}-cargo + build_android: name: Android build + if: false runs-on: ubuntu-latest env: - ANDROID_SIGNING_KEYSTORE: "${{ secrets.ANDROID_SIGNING_KEYSTORE }}" APP_OUTPUTS_DIR: "app/app/build/outputs/apk/release" - defaults: - run: - shell: bash strategy: fail-fast: true steps: - uses: actions/checkout@v3 - - - name: Set up cache - uses: actions/cache@v3 + - name: Restore cache + uses: actions/cache/restore@v3 with: path: | ~/.cache @@ -147,8 +161,10 @@ jobs: run: | if [ "${{ github.ref_type }}" == "tag" ]; then export DRS_BUILD_VERSION_OVERRIDE="{{ github.ref_name }}" + elif [ "${{ github.ref_name }} == "master"]; then + export DRS_BUILD_VERSION_OVERRIDE="$VERSION-$((${{ github.run_number }} + 654))" else - export DRS_BUILD_VERSION_OVERRIDE="0.101.0-$((${{ github.run_number }} + 654))-${{ github.ref_name }}" + export DRS_BUILD_VERSION_OVERRIDE="$VERSION-${GITHUB_SHA:0:7}" fi cd app @@ -157,12 +173,10 @@ jobs: ./gradlew assembleRelease - name: Sign app - if: ${{ env.ANDROID_SIGNING_KEYSTORE != '' }} run: | BUILD_TOOLS=$ANDROID_HOME/build-tools/33.0.0 echo "${{ secrets.ANDROID_SIGNING_KEYSTORE }}" | base64 --decode > keystore.jks - $BUILD_TOOLS/zipalign -c -v 4 $APP_OUTPUTS_DIR/app-release-unsigned.apk if [ "${{ secrets.ANDROID_SIGNING_KEY_PASS }}" != "" ]; then $BUILD_TOOLS/apksigner sign --ks ./keystore.jks --ks-key-alias "${{ secrets.ANDROID_SIGNING_ALIAS }}" --ks-pass "pass:${{ secrets.ANDROID_SIGNING_KEYSTORE_PASS }}" --key-pass "pass:${{ secrets.ANDROID_SIGNING_KEY_PASS }}" --out $APP_OUTPUTS_DIR/app-signed.apk $APP_OUTPUTS_DIR/app-release-unsigned.apk else @@ -174,11 +188,7 @@ jobs: - name: Prepare artifact run: | mkdir release - if [ "${{ env.ANDROID_SIGNING_KEYSTORE }}" != "" ]; then - mv $APP_OUTPUTS_DIR/app-signed.apk release/doukutsu-rs.apk - else - cp $APP_OUTPUTS_DIR/app-release-unsigned.apk release/doukutsu-rs.apk - fi + mv $APP_OUTPUTS_DIR/app-signed.apk release/doukutsu-rs.apk cp LICENSE ./release - name: Upload artifact @@ -187,3 +197,17 @@ jobs: name: doukutsu-rs_android path: ./release/* if-no-files-found: error + + - name: Save cache + if: ${{ github.ref_name == 'master' || github.ref_type == 'tag' }} + uses: actions/cache/save@v3 + with: + path: | + ~/.cache + ~/.cargo + ~/.rustup + ~/.gradle + app/app/.cxx + app/app/build + drsandroid/target + key: android-cargo diff --git a/README.md b/README.md index 206b8ee..1b344b2 100644 --- a/README.md +++ b/README.md @@ -5,17 +5,17 @@ in [Rust](https://www.rust-lang.org/). [Join the Discord server](https://discord.gg/fbRsNNB) -![https://ci.appveyor.com/api/projects/status/github/doukutsu-rs/doukutsu-rs](https://ci.appveyor.com/api/projects/status/github/doukutsu-rs/doukutsu-rs) +![CI](https://github.com/doukutsu-rs/doukutsu-rs/actions/workflows/ci.yml/badge.svg) -- [Get nightly builds from AppVeyor](https://ci.appveyor.com/project/alula/doukutsu-rs) (recommended for now, has latest fixes and improvements) +- [Get nightly builds](https://nightly.link/doukutsu-rs/doukutsu-rs/workflows/ci/master?preview) (recommended for now, has latest fixes and improvements) Permalinks to latest builds from `master` branch: - - [Windows (64-bit)](https://ci.appveyor.com/api/projects/alula/doukutsu-rs/artifacts/doukutsu-rs_win64.zip?branch=master&job=windows-x64) - - [Windows (32-bit)](https://ci.appveyor.com/api/projects/alula/doukutsu-rs/artifacts/doukutsu-rs_win32.zip?branch=master&job=windows-x32) - - [macOS (Intel, 64-bit, 10.14+)](https://ci.appveyor.com/api/projects/alula/doukutsu-rs/artifacts/doukutsu-rs_mac-intel.zip?branch=master&job=mac-x64) - - [macOS (Apple M1, 11.0+)](https://ci.appveyor.com/api/projects/alula/doukutsu-rs/artifacts/doukutsu-rs_mac-m1.zip?branch=master&job=mac-arm64) - - [Linux (64-bit)](https://ci.appveyor.com/api/projects/alula/doukutsu-rs/artifacts/doukutsu-rs_linux.zip?branch=master&job=linux-x64) + - [Windows (64-bit)](https://nightly.link/doukutsu-rs/doukutsu-rs/workflows/ci/master/doukutsu-rs_windows-x64.zip) + - [Windows (32-bit)](https://nightly.link/doukutsu-rs/doukutsu-rs/workflows/ci/master/doukutsu-rs_windows-x32.zip) + - [macOS (Intel, 64-bit, 10.14+)](https://nightly.link/doukutsu-rs/doukutsu-rs/workflows/ci/master/doukutsu-rs_mac-x64.zip) + - [macOS (Apple M1, 11.0+)](https://nightly.link/doukutsu-rs/doukutsu-rs/workflows/ci/master/doukutsu-rs_mac-arm64.zip) + - [Linux (64-bit)](https://nightly.link/doukutsu-rs/doukutsu-rs/workflows/ci/master/doukutsu-rs_linux-x64.zip) **macOS note:** If you get a `"doukutsu-rs" can't be opened` message, right-click doukutsu-rs.app and click open.