Merge pull request #99 from ovh/README #31
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: Unstable Build | |
| on: | |
| push: | |
| branches: [main] | |
| jobs: | |
| build: | |
| name: Build Unstable for ${{ matrix.os }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| include: | |
| - os: ubuntu-latest | |
| target: x86_64-unknown-linux-musl | |
| binary_name: shai | |
| asset_name: shai-unstable-linux-x86_64 | |
| #- os: windows-latest | |
| # target: x86_64-pc-windows-msvc | |
| # binary_name: shai.exe | |
| # asset_name: shai-unstable-windows-x86_64.exe | |
| - os: macos-latest | |
| target: x86_64-apple-darwin | |
| binary_name: shai | |
| asset_name: shai-unstable-macos-x86_64 | |
| - os: macos-latest | |
| target: aarch64-apple-darwin | |
| binary_name: shai | |
| asset_name: shai-unstable-macos-aarch64 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: ${{ matrix.target }} | |
| - name: Install dependencies (Linux) | |
| if: matrix.os == 'ubuntu-latest' | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y build-essential musl-tools | |
| - name: Add musl target (Linux) | |
| if: matrix.target == 'x86_64-unknown-linux-musl' | |
| run: rustup target add x86_64-unknown-linux-musl | |
| - name: Cache cargo registry | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.cargo/registry | |
| key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-cargo-registry- | |
| - name: Cache cargo index | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.cargo/git | |
| key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-cargo-index- | |
| - name: Cache target directory | |
| uses: actions/cache@v4 | |
| with: | |
| path: target | |
| key: ${{ runner.os }}-${{ matrix.target }}-target-${{ hashFiles('**/Cargo.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-${{ matrix.target }}-target- | |
| - name: Build binary | |
| run: cargo build --release --target ${{ matrix.target }} | |
| - name: Prepare binary (Unix) | |
| if: matrix.os != 'windows-latest' | |
| run: | | |
| cp target/${{ matrix.target }}/release/${{ matrix.binary_name }} ${{ matrix.asset_name }} | |
| strip ${{ matrix.asset_name }} | |
| - name: Prepare binary (Windows) | |
| if: matrix.os == 'windows-latest' | |
| run: | | |
| cp target/${{ matrix.target }}/release/${{ matrix.binary_name }} ${{ matrix.asset_name }} | |
| - name: Upload unstable artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ matrix.asset_name }} | |
| path: ${{ matrix.asset_name }} | |
| retention-days: 30 | |
| create-unstable-release: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Get current date | |
| id: date | |
| run: echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| - name: Delete existing unstable release | |
| continue-on-error: true | |
| run: | | |
| gh release delete unstable --yes | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Create unstable release | |
| run: | | |
| gh release create unstable \ | |
| --title "Unstable Build (${{ steps.date.outputs.date }})" \ | |
| --notes "Automated unstable build from commit ${{ github.sha }}" \ | |
| --prerelease \ | |
| shai-unstable-linux-x86_64/shai-unstable-linux-x86_64 \ | |
| shai-unstable-macos-x86_64/shai-unstable-macos-x86_64 \ | |
| shai-unstable-macos-aarch64/shai-unstable-macos-aarch64 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |