Skip to content

Commit

Permalink
GHA
Browse files Browse the repository at this point in the history
  • Loading branch information
kitplummer committed Apr 14, 2024
1 parent ab2afd0 commit 17cdc50
Show file tree
Hide file tree
Showing 2 changed files with 86 additions and 0 deletions.
67 changes: 67 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# .github/workflows/release.yml

on:
release:
types: [created]

env:
CRATE_NAME: cot_sender
GITHUB_TOKEN: ${{ github.token }}
RUST_BACKTRACE: 1
jobs:
test:
name: ${{ matrix.platform.os_name }} with rust ${{ matrix.toolchain }}
runs-on: ${{ matrix.platform.os }}
strategy:
fail-fast: false
matrix:
platform:
- os_name: Linux-x86_64
os: ubuntu-22.04
target: x86_64-unknown-linux-gnu
bin: cot_sender
name: cot_sender-Linux-x86_64-gnu.tar.gz
- os_name: Linux-aarch64
os: ubuntu-22.04
target: aarch64-unknown-linux-gnu
bin: cot_sender
name: cot_sender-Linux-aarch64-gnu.tar.gz
toolchain:
- stable
steps:
- uses: actions/checkout@v4
- name: Cache cargo & target directories
uses: Swatinem/rust-cache@v2
with:
key: "v2"
- name: Build binary
uses: houseabsolute/actions-rust-cross@v0
with:
command: "build"
target: ${{ matrix.platform.target }}
toolchain: ${{ matrix.toolchain }}
args: "--locked --release"
strip: true
- name: Package as archive
shell: bash
run: |
cd target/${{ matrix.platform.target }}/release
tar czvf ../../../${{ matrix.platform.name }} ${{ matrix.platform.bin }}
cd -
if: |
matrix.toolchain == 'stable' &&
( startsWith( github.ref, 'refs/tags/v' ) ||
github.ref == 'refs/tags/test-release' )
- name: Publish release artifacts
uses: actions/upload-artifact@v3
with:
name: dto-${{ matrix.platform.os_name }}
path: "dto-*"
if: matrix.toolchain == 'stable' && github.ref == 'refs/tags/test-release'
- name: Publish GitHub release
uses: softprops/action-gh-release@v1
with:
draft: true
files: "cot_sender*"
body_path: Changes.md
if: matrix.toolchain == 'stable' && startsWith( github.ref, 'refs/tags/v' )
19 changes: 19 additions & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Rust

on:
push:
branches: ["main"]
pull_request:
branches: ["main"]

env:
CARGO_TERM_COLOR: always

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Build and test
run: cargo test

0 comments on commit 17cdc50

Please sign in to comment.