style: cargo fmt #24
Workflow file for this run
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: release | |
| on: | |
| push: | |
| tags: | |
| - "cli/v*" | |
| env: | |
| CARGO_TERM_COLOR: always | |
| jobs: | |
| check: | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: src/cli | |
| outputs: | |
| version: ${{ steps.version.outputs.value }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Extract version from tag | |
| id: version | |
| run: echo "value=${GITHUB_REF_NAME#cli/}" >> $GITHUB_OUTPUT | |
| - uses: actions-rust-lang/setup-rust-toolchain@v1 | |
| with: | |
| components: rustfmt, clippy | |
| - name: Clone dependency repos | |
| run: | | |
| mkdir -p /home/runner/work/packages | |
| git clone --depth 1 https://github.com/quanttide/quanttide-agent-toolkit.git /home/runner/work/packages/quanttide-agent-toolkit | |
| git clone --depth 1 https://github.com/quanttide/quanttide-data-toolkit.git /home/runner/work/packages/quanttide-data-toolkit | |
| - name: Build | |
| run: cargo build --release | |
| - name: Test | |
| run: cargo test | |
| - name: Clippy | |
| run: cargo clippy -- -A warnings | |
| - name: Format | |
| run: cargo fmt --check | |
| publish-crate: | |
| needs: check | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: src/cli | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ github.ref }} | |
| - uses: actions-rust-lang/setup-rust-toolchain@v1 | |
| - name: Switch deps to crates.io versions | |
| run: | | |
| sed -i 's|quanttide-agent = { path = ".*" }|quanttide-agent = "0.1"|' Cargo.toml | |
| sed -i 's|quanttide-data = { path = ".*" }|quanttide-data = "0.1"|' Cargo.toml | |
| - name: Publish qtcloud-data-cli | |
| run: cargo publish --allow-dirty --token ${{ secrets.CRATES_API_TOKEN }} | |
| build-binary: | |
| needs: check | |
| strategy: | |
| matrix: | |
| include: | |
| - os: ubuntu-latest | |
| target: x86_64-unknown-linux-gnu | |
| ext: "" | |
| archive: tar.gz | |
| - os: windows-latest | |
| target: x86_64-pc-windows-msvc | |
| ext: ".exe" | |
| archive: zip | |
| runs-on: ${{ matrix.os }} | |
| defaults: | |
| run: | |
| working-directory: src/cli | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ github.ref }} | |
| - uses: actions-rust-lang/setup-rust-toolchain@v1 | |
| with: | |
| target: ${{ matrix.target }} | |
| - name: Clone dependency repos | |
| run: | | |
| mkdir -p ../../../packages | |
| cd ../../../packages | |
| git clone --depth 1 https://github.com/quanttide/quanttide-agent-toolkit.git | |
| git clone --depth 1 https://github.com/quanttide/quanttide-data-toolkit.git | |
| - name: Build binary | |
| run: cargo build --release --target ${{ matrix.target }} | |
| - name: Package (tar.gz) | |
| if: matrix.archive == 'tar.gz' | |
| run: | | |
| cd target/${{ matrix.target }}/release | |
| tar czf ../../../qtcloud-data-${{ matrix.target }}.tar.gz qtcloud-data | |
| - name: Package (zip) | |
| if: matrix.archive == 'zip' | |
| run: | | |
| cd target/${{ matrix.target }}/release | |
| 7z a ../../../qtcloud-data-${{ matrix.target }}.zip qtcloud-data.exe | |
| - name: Upload to Release | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| files: | | |
| qtcloud-data-*.tar.gz | |
| qtcloud-data-*.zip |