Skip to content

Commit

Permalink
Merge pull request #1 from patrickelectric/add-first-test
Browse files Browse the repository at this point in the history
ci: Add first version
  • Loading branch information
joaoantoniocardoso authored Aug 21, 2024
2 parents d2ec868 + 3706238 commit d49c34d
Showing 1 changed file with 76 additions and 0 deletions.
76 changes: 76 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: Test and Build

on: [push, pull_request]

env:
CARGO_TERM_COLOR: always

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: dtolnay/rust-toolchain@stable
- name: Check code style
run: cargo fmt -- --check
- name: Build
run: cargo build --verbose

build:
needs: test
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: macos-latest
TARGET: aarch64-apple-darwin

- os: macos-latest
TARGET: x86_64-apple-darwin

- os: ubuntu-latest
TARGET: arm-unknown-linux-musleabihf

- os: ubuntu-latest
TARGET: aarch64-unknown-linux-musl

- os: ubuntu-latest
TARGET: armv7-unknown-linux-musleabihf

- os: ubuntu-latest
TARGET: x86_64-unknown-linux-musl

- os: windows-latest
TARGET: x86_64-pc-windows-msvc
EXTENSION: .exe

steps:
- name: Building ${{ matrix.TARGET }}
run: echo "${{ matrix.TARGET }}"

- uses: actions/checkout@master
- name: Build
uses: houseabsolute/actions-rust-cross@v0
with:
target: ${{ matrix.TARGET }}
args: "--locked --release"

- name: Rename
run: cp target/${{ matrix.TARGET }}/release/${{ github.event.repository.name }}${{ matrix.EXTENSION }} ${{ github.event.repository.name }}-${{ matrix.TARGET }}${{ matrix.EXTENSION }}

- uses: actions/upload-artifact@master
with:
name: ${{ github.event.repository.name }}-${{ matrix.TARGET }}${{ matrix.EXTENSION }}
path: ${{ github.event.repository.name }}-${{ matrix.TARGET }}${{ matrix.EXTENSION }}

- uses: svenstaro/upload-release-action@v2
name: Upload binaries to release
if: ${{ github.event_name == 'push' }}
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ github.event.repository.name }}-${{ matrix.TARGET }}${{ matrix.EXTENSION }}
asset_name: ${{ github.event.repository.name }}-${{ matrix.TARGET }}${{ matrix.EXTENSION }}
tag: ${{ github.ref }}
prerelease: ${{ !startsWith(github.ref, 'refs/tags/') }}
overwrite: true

0 comments on commit d49c34d

Please sign in to comment.