ci: cross compiling

This commit is contained in:
iff 2024-11-22 11:30:30 +01:00
parent c97d6440f3
commit 9859b14bec
3 changed files with 74 additions and 25 deletions

View file

@ -4,37 +4,86 @@ on:
push:
tags:
- v*
permissions:
contents: write
jobs:
build:
name: ${{ matrix.target }}
runs-on: ${{ matrix.os }}
permissions:
contents: write
strategy:
fail-fast: true
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
deb: true
- os: macos-latest
target: x86_64-apple-darwin
- os: macos-latest
target: aarch64-apple-darwin
- os: windows-latest
target: x86_64-pc-windows-msvc
- os: windows-latest
target: aarch64-pc-windows-msvc
steps:
- uses: actions/checkout@v4
- name: get version
id: version
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
- name: setup Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
target: ${{ matrix.target }}
# will need to static link openssl
# - name: install cross
# if: ${{ runner.os == 'Linux' }}
# uses: actions-rs/cargo@v1
# with:
# command: install
# args: cross --locked
- name: build
run: |
cargo build --release --all-features
run:
cargo build --release --all-features --locked --target ${{ matrix.target }}
- name: Zipping files (exe)
if: matrix.os == 'windows-latest'
run: |
7z a pay-respects-${{ matrix.os }}.zip ./target/release/pay-respects.exe
- name: install cargo-deb
if: ${{ matrix.deb == true }}
uses: actions-rs/install@v0.1
with:
crate: cargo-deb
- name: Zipping files (unix)
if: matrix.os != 'windows-latest'
run: |
7z a pay-respects-${{ matrix.os }}.zip ./target/release/pay-respects
- name: build deb
if: ${{ matrix.deb == true }}
uses: actions-rs/cargo@v1
with:
command: deb
args: --no-build --no-strip --output=. --target=${{ matrix.target }}
- name: Uploading to release
- name: zipping files (exe)
if: runner.os == 'Windows'
# for some reason Windows doesn't support environment variables?
run: >
7z a pay-respects-${{ matrix.target }}.zip
./target/${{ matrix.target }}/release/pay-respects.exe
- name: zipping files (unix)
if: runner.os != 'Windows'
run: >
tar -czf pay-respects-${{ steps.version.outputs.VERSION }}-${{ matrix.target }}.tar.gz
-C target/${{ matrix.target }}/release pay-respects
- name: uploading to release
uses: ncipollo/release-action@v1
with:
artifacts: pay-respects-${{ matrix.os }}.zip
artifacts: |
*.tar.gz
*.zip
*.deb
allowUpdates: true
makeLatest: true

4
Cargo.lock generated
View file

@ -371,9 +371,9 @@ checksum = "953ec861398dccce10c670dfeaf3ec4911ca479e9c02154b3a215178c5f566f2"
[[package]]
name = "proc-macro2"
version = "1.0.91"
version = "1.0.92"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "307e3004becf10f5a6e0d59d20f3cd28231b0e0827a96cd3e0ce6d14bc1e4bb3"
checksum = "37d3544b3f2748c54e147655edb5025752e2303145b5aefb3c3ea2c78b973bb0"
dependencies = [
"unicode-ident",
]

View file

@ -1,5 +1,6 @@
[package]
name = "pay-respects"
authors = ["iff <iff@ik.me>"]
version = "0.5.12"
edition = "2021"
@ -30,7 +31,6 @@ textwrap = { version = "0.16", features = ["terminal_size"], optional = true}
pay-respects-parser = "0.2.6"
# pay-respects-parser = { path = "../pay-respects-parser" }
[features]
runtime-rules = ["dep:serde", "dep:toml"]
request-ai = ["dep:serde", "dep:serde_json", "dep:curl", "dep:textwrap"]