Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add CI #1

Merged
merged 2 commits into from
Feb 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 }}
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ codegen-units = 1
lto = true
opt-level = 3
panic = 'abort'
strip = true