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: push:
tags: tags:
- v* - v*
permissions:
contents: write
jobs: jobs:
build: build:
name: ${{ matrix.target }}
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
permissions:
contents: write
strategy: strategy:
fail-fast: true fail-fast: true
matrix: 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: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: build - name: get version
run: | id: version
cargo build --release --all-features run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
- name: Zipping files (exe) - name: setup Rust
if: matrix.os == 'windows-latest' uses: actions-rs/toolchain@v1
run: | with:
7z a pay-respects-${{ matrix.os }}.zip ./target/release/pay-respects.exe toolchain: stable
override: true
target: ${{ matrix.target }}
- name: Zipping files (unix) # will need to static link openssl
if: matrix.os != 'windows-latest' # - name: install cross
run: | # if: ${{ runner.os == 'Linux' }}
7z a pay-respects-${{ matrix.os }}.zip ./target/release/pay-respects # uses: actions-rs/cargo@v1
# with:
# command: install
# args: cross --locked
- name: Uploading to release - name: build
uses: ncipollo/release-action@v1 run:
with: cargo build --release --all-features --locked --target ${{ matrix.target }}
artifacts: pay-respects-${{ matrix.os }}.zip
allowUpdates: true - name: install cargo-deb
makeLatest: true if: ${{ matrix.deb == true }}
uses: actions-rs/install@v0.1
with:
crate: cargo-deb
- 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: 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: |
*.tar.gz
*.zip
*.deb
allowUpdates: true
makeLatest: true

4
Cargo.lock generated
View file

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

View file

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