Skip to content

Commit

Permalink
Add CI workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
sgasse committed Feb 17, 2024
1 parent 838a06c commit 1a46660
Showing 1 changed file with 60 additions and 0 deletions.
60 changes: 60 additions & 0 deletions .github/workflows/github-actions.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: CI Workflow

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

env:
CARGO_TERM_COLOR: always

jobs:
build:
runs-on: ${{ matrix.runner }}
strategy:
matrix:
include:
# Linux
- name: linux-amd64
runner: ubuntu-latest
target: x86_64-unknown-linux-gnu
command: cargo
# Android
- name: android-arm
runner: ubuntu-latest
target: aarch64-linux-android
command: cross

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install rust
uses: dtolnay/rust-toolchain@stable

- name: Install cross
if: matrix.command == 'cross'
shell: bash
run: |
cargo install cross --git https://github.com/cross-rs/cross
- name: Build binary
run: ${{ matrix.command }} build --release --target ${{ matrix.target }}

- name: Create archive
if: startsWith(github.ref, 'refs/tags/')
id: archive
shell: bash
run: |
DIRECTORY="loadtimer-${{ github.ref_name }}-${{ matrix.build }}"
mkdir "${DIRECTORY}"
cp target/${{ matrix.target }}/release/loadtimer "${DIRECTORY}/"
7z a "${DIRECTORY}.zip" "${DIRECTORY}"
echo "path=${DIRECTORY}.zip" >> ${GITHUB_OUTPUT}
- name: Release
if: startsWith(github.ref, 'refs/tags/')
env:
GH_TOKEN: ${{ github.token }}
run: gh release upload ${{ github.ref_name }} ${{ steps.archive.outputs.path }}

0 comments on commit 1a46660

Please sign in to comment.