Skip to content

Commit

Permalink
build test
Browse files Browse the repository at this point in the history
  • Loading branch information
Parth committed Feb 20, 2024
1 parent 40e84a1 commit e5f0089
Show file tree
Hide file tree
Showing 3 changed files with 86 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .cargo/Config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[target.x86_64-unknown-linux-musl]
linker = "rust-lld"
80 changes: 80 additions & 0 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
name: Build and Release

on:
push:
branches:
- master

jobs:
build:
name: Build on ${{ matrix.os }} for ${{ matrix.arch }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
arch: x86_64
target: x86_64-unknown-linux-gnu
asset_name: rush_linux_x86_64
- os: windows-latest
arch: x86_64
target: x86_64-pc-windows-msvc
asset_name: rush_windows_x86_64.exe
- os: macos-latest
arch: x86_64
target: x86_64-apple-darwin
asset_name: rush_macos_x86_64
- os: macos-latest
arch: arm64
target: aarch64-apple-darwin
asset_name: rush_macos_arm64
steps:
- uses: actions/checkout@v2
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
default: true
target: ${{ matrix.target }}
override: true
- name: Build binary
run: cargo build --release --target ${{ matrix.target }}
- name: Rename binary
run: |
mv target/${{ matrix.target }}/release/rush ${{ matrix.asset_name }}
- uses: actions/upload-artifact@v2
with:
name: ${{ matrix.asset_name }}
path: ${{ matrix.asset_name }}

release:
name: Release
needs: build
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master'
steps:
- name: Download all artifacts
uses: actions/download-artifact@v2
with:
path: artifacts
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.sha }}
release_name: Release ${{ github.sha }}
draft: false
prerelease: false
- name: Upload Artifacts to Release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./artifacts/${{ matrix.asset_name }}
asset_name: ${{ matrix.asset_name }}
asset_content_type: application/octet-stream

4 changes: 4 additions & 0 deletions release
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh

cargo install cross
cross

0 comments on commit e5f0089

Please sign in to comment.