Skip to content

refactor: optimize serialization (#5) #33

refactor: optimize serialization (#5)

refactor: optimize serialization (#5) #33

Workflow file for this run

name: Build / Release
on:
push:
tags:
- v*.*.*
jobs:
build-release:
name: ${{ matrix.targets.alias }}
runs-on: ${{ matrix.targets.os }}
strategy:
fail-fast: false
matrix:
targets:
# aarch64
- { os: macos-11 , target: aarch64-apple-darwin , alias: aarch64-darwin-macos-11 }
- { os: macos-12 , target: aarch64-apple-darwin , alias: aarch64-darwin-macos-12 }
- { os: macos-13 , target: aarch64-apple-darwin , alias: aarch64-darwin-macos-13 }
# amd64
- { os: macos-12 , target: x86_64-apple-darwin , alias: amd64-darwin-macos-unknown }
- { os: ubuntu-20.04, target: x86_64-unknown-linux-gnu , alias: amd64-gnu-ubuntu-20.04 }
- { os: ubuntu-22.04, target: x86_64-unknown-linux-gnu , alias: amd64-gnu-ubuntu-22.04 }
- { os: ubuntu-22.04, target: x86_64-unknown-linux-musl, alias: amd64-musl-linux-unknown }
- { os: windows-2019, target: x86_64-pc-windows-msvc , alias: amd64-msvc-windows-2019 }
- { os: windows-2022, target: x86_64-pc-windows-msvc , alias: amd64-msvc-windows-2022 }
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Setup Rust toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
override: true
toolchain: nightly-2023-09-06
components: rustfmt, clippy
- name: Setup musl-tools
if: matrix.targets.target == 'x86_64-unknown-linux-musl'
shell: bash
run: sudo apt -y install musl-tools
- name: Add target
uses: ./.github/actions/add-target
with:
target: ${{ matrix.targets.target }}
- name: Setup Rust cache
uses: Swatinem/rust-cache@v2
with:
prefix-key: ${{ matrix.targets.alias }}
- name: Generate version
id: gen-version
shell: bash
run: echo 'VERSION=${{ github.ref_name }}' | sed 's/v//' >> $GITHUB_OUTPUT
- name: Replace version
uses: ./.github/actions/replace-version
with:
version: ${{ steps.gen-version.outputs.VERSION }}
- name: Run build
uses: ./.github/actions/build
with:
target: ${{ matrix.targets.target }}
release: true
- name: Generate artifacts name
id: gen-name
shell: bash
run: echo 'NAME=cnb-${{ steps.gen-version.outputs.VERSION }}-${{ matrix.targets.alias }}' >> $GITHUB_OUTPUT
- name: Generate binary extension
id: gen-ext
if: runner.os == 'Windows'
shell: bash
run: echo 'EXT=.exe' >> $GITHUB_OUTPUT
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: ${{ steps.gen-name.outputs.NAME }}
path: ./target/${{ matrix.targets.target }}/release/cnb${{ steps.gen-ext.outputs.EXT }}
if-no-files-found: error
- name: Archive binary
uses: ./.github/actions/make-archive
with:
files: ./target/${{ matrix.targets.target }}/release/cnb${{ steps.gen-ext.outputs.EXT }}
out: ${{ steps.gen-name.outputs.NAME }}.zip
- name: Create GitHub release
uses: softprops/action-gh-release@v1
with:
files: ${{ steps.gen-name.outputs.NAME }}.zip