on: push: tags: - "v*" name: Release env: RELEASE_SDB: skyd RELEASE_SKYSH: skysh RELEASE_BENCH: sky-bench RELEASE_DIR: artifacts GITHUB_REF: "${{ github.ref }}" jobs: build_64bit: name: Build artifacts (64-bit) runs-on: ${{ matrix.os }} strategy: matrix: os: [ubuntu-latest, macos-latest, windows-latest] include: - os: ubuntu-latest artifact: x86_64-linux-gnu rust: x86_64-unknown-linux-gnu - os: macos-latest artifact: x86_64-macos rust: x86_64-apple-darwin - os: windows-latest artifact: x86_64-windows rust: x86_64-pc-windows-msvc steps: - uses: actions/checkout@v2 - name: Cache Cargo registry uses: actions/cache@v2 with: path: ~/.cargo/registry key: ${{ matrix.rust }}-cargo-registry-${{ hashFiles('Cargo.lock') }} restore-keys: | ${{ matrix.rust }}-cargo-registry- - name: Cache Cargo index uses: actions/cache@v2 with: path: ~/.cargo/git key: ${{ matrix.rust }}-cargo-index-${{ hashFiles('Cargo.lock') }} restore-keys: | ${{ matrix.rust }}-cargo-index- - name: Cache Cargo build uses: actions/cache@v2 with: path: target key: ${{ matrix.rust }}-target-${{ hashFiles('Cargo.lock') }} restore-keys: | ${{ matrix.rust }}-target- - name: Query version number id: get_version shell: bash run: | echo "using version tag ${GITHUB_REF:10}" echo ::set-output name=version::"${GITHUB_REF:10}" - name: Install Rust run: | rustup default stable rustup target add ${{ matrix.rust }} - name: Build if: runner.os != 'Windows' run: cargo build --release --target ${{ matrix.rust }} - name: Build (Windows) shell: cmd # Use cmd as the default shell to avoid perl path errors if: runner.os == 'Windows' run: cargo build --release --target ${{ matrix.rust }} env: RUSTFLAGS: -Ctarget-feature=+crt-static - name: Upload binaries uses: actions/upload-artifact@v2 with: name: ${{ matrix.artifact }} path: | target/${{ matrix.rust }}/release/skyd target/${{ matrix.rust }}/release/skysh target/${{ matrix.rust }}/release/sky-bench if: runner.os != 'Windows' - name: Upload binaries (Windows) uses: actions/upload-artifact@v2 with: name: ${{ matrix.artifact }} path: | target/${{ matrix.rust }}/release/skyd.exe target/${{ matrix.rust }}/release/skysh.exe target/${{ matrix.rust }}/release/sky-bench.exe if: runner.os == 'Windows' build_32bit: name: Build artifacts (32-bit) runs-on: ${{ matrix.os }} strategy: matrix: build: [linux, windows] include: - build: linux os: ubuntu-latest rust: i686-unknown-linux-gnu artifact: i686-linux-gnu - build: windows os: windows-latest artifact: i686-windows rust: i686-pc-windows-msvc steps: - uses: actions/checkout@v2 - name: Cache Cargo registry uses: actions/cache@v2 with: path: ~/.cargo/registry key: ${{ matrix.rust }}-cargo-registry-${{ hashFiles('Cargo.lock') }} restore-keys: | ${{ matrix.rust }}-cargo-registry- - name: Cache Cargo index uses: actions/cache@v2 with: path: ~/.cargo/git key: ${{ matrix.rust }}-cargo-index-${{ hashFiles('Cargo.lock') }} restore-keys: | ${{ matrix.rust }}-cargo-index- - name: Cache Cargo build uses: actions/cache@v2 with: path: target key: ${{ matrix.rust }}-target-${{ hashFiles('Cargo.lock') }} restore-keys: | ${{ matrix.rust }}-target- - name: Query version number id: get_version shell: bash run: | echo "using version tag ${GITHUB_REF:10}" echo ::set-output name=version::"${GITHUB_REF:10}" - name: Install 32-bit tools (Linux) run: | sudo apt update && sudo apt install gcc-multilib -y if: runner.os == 'Linux' - name: Install Rust run: | rustup target add ${{ matrix.rust }} - name: Build if: runner.os != 'Windows' run: cargo build --release --target ${{ matrix.rust }} - name: Build (Windows) shell: cmd # Use cmd as the default shell to avoid perl path errors if: runner.os == 'Windows' run: cargo build --release --target ${{ matrix.rust }} env: RUSTFLAGS: -Ctarget-feature=+crt-static - name: Upload binaries uses: actions/upload-artifact@v2 with: name: ${{ matrix.artifact }} path: | target/${{ matrix.rust }}/release/skyd target/${{ matrix.rust }}/release/skysh target/${{ matrix.rust }}/release/sky-bench if: runner.os != 'Windows' - name: Upload binaries (Windows) uses: actions/upload-artifact@v2 with: name: ${{ matrix.artifact }} path: | target/${{ matrix.rust }}/release/skyd.exe target/${{ matrix.rust }}/release/skysh.exe target/${{ matrix.rust }}/release/sky-bench.exe if: runner.os == 'Windows' build_musl: name: Build Linux x86_64-musl (Tier 2) runs-on: ${{ matrix.os }} strategy: matrix: build: [linux] include: - build: linux os: ubuntu-latest artifact: x86_64-linux-musl rust: x86_64-unknown-linux-musl steps: - uses: actions/checkout@v2 - name: Cache Cargo registry uses: actions/cache@v2 with: path: ~/.cargo/registry key: ${{ matrix.rust }}-cargo-registry-${{ hashFiles('Cargo.lock') }} restore-keys: | ${{ matrix.rust }}-cargo-registry- - name: Cache Cargo index uses: actions/cache@v2 with: path: ~/.cargo/git key: ${{ matrix.rust }}-cargo-index-${{ hashFiles('Cargo.lock') }} restore-keys: | ${{ matrix.rust }}-cargo-index- - name: Cache Cargo build uses: actions/cache@v2 with: path: target key: ${{ matrix.rust }}-target-${{ hashFiles('Cargo.lock') }} restore-keys: | ${{ matrix.rust }}-target- - name: Query version number id: get_version shell: bash run: | echo "using version tag ${GITHUB_REF:10}" echo ::set-output name=version::"${GITHUB_REF:10}" - name: Install MUSL tools run: | sudo apt update && sudo apt install musl-tools -y - name: Install Rust run: | rustup target add ${{ matrix.rust }} - name: Build run: cargo build --release --target ${{ matrix.rust }} - name: Upload binaries uses: actions/upload-artifact@v2 with: name: ${{ matrix.artifact }} path: | target/${{ matrix.rust }}/release/skyd target/${{ matrix.rust }}/release/skysh target/${{ matrix.rust }}/release/sky-bench release: name: Release needs: - build_64bit - build_32bit - build_musl runs-on: ubuntu-latest steps: - name: Query version number id: get_version shell: bash run: | echo "using version tag ${GITHUB_REF:10}" echo ::set-output name=version::"${GITHUB_REF:10}" - name: Create Release id: create_release uses: actions/create-release@v1 env: GITHUB_TOKEN: ${{ secrets.TDBB }} with: tag_name: ${{ steps.get_version.outputs.VERSION }} release_name: ${{ steps.get_version.outputs.VERSION }} - name: Download all artifacts uses: actions/download-artifact@v2 with: path: artifacts - name: Archive artifacts run: | wget https://raw.githubusercontent.com/skytable/skytable/next/ci/artifact.sh chmod +x artifact.sh bash artifact.sh - name: Release Linux bundle (x86_64) uses: actions/upload-release-asset@v1 env: GITHUB_TOKEN: ${{ secrets.TDBB }} with: upload_url: ${{ steps.create_release.outputs.upload_url }} asset_path: artifacts/x86_64-linux-gnu.zip asset_content_type: application/octet-stream asset_name: sky-bundle-${{ steps.get_version.outputs.VERSION }}-x86_64-linux-gnu.zip - name: Release Windows bundle (x86_64) uses: actions/upload-release-asset@v1 env: GITHUB_TOKEN: ${{ secrets.TDBB }} with: upload_url: ${{ steps.create_release.outputs.upload_url }} asset_path: artifacts/x86_64-windows.zip asset_content_type: application/octet-stream asset_name: sky-bundle-${{ steps.get_version.outputs.VERSION }}-x86_64-windows.zip - name: Release MacOS bundle (x86_64) uses: actions/upload-release-asset@v1 env: GITHUB_TOKEN: ${{ secrets.TDBB }} with: upload_url: ${{ steps.create_release.outputs.upload_url }} asset_path: artifacts/x86_64-macos.zip asset_content_type: application/octet-stream asset_name: sky-bundle-${{ steps.get_version.outputs.VERSION }}-x86_64-macos.zip - name: Release Linux bundle (i686) uses: actions/upload-release-asset@v1 env: GITHUB_TOKEN: ${{ secrets.TDBB }} with: upload_url: ${{ steps.create_release.outputs.upload_url }} asset_path: artifacts/i686-linux-gnu.zip asset_content_type: application/octet-stream asset_name: sky-bundle-${{ steps.get_version.outputs.VERSION }}-i686-linux-gnu.zip - name: Release Windows bundle (i686) uses: actions/upload-release-asset@v1 env: GITHUB_TOKEN: ${{ secrets.TDBB }} with: upload_url: ${{ steps.create_release.outputs.upload_url }} asset_path: artifacts/i686-windows.zip asset_content_type: application/octet-stream asset_name: sky-bundle-${{ steps.get_version.outputs.VERSION }}-i686-windows.zip - name: Release Linux bundle (x86_64 MUSL) uses: actions/upload-release-asset@v1 env: GITHUB_TOKEN: ${{ secrets.TDBB }} with: upload_url: ${{ steps.create_release.outputs.upload_url }} asset_path: artifacts/x86_64-linux-musl.zip asset_content_type: application/octet-stream asset_name: sky-bundle-${{ steps.get_version.outputs.VERSION }}-x86_64-linux-musl.zip