.github/workflows/release.yml
99 lines · 3713 bytes
1on: [push, pull_request]
2
3name: build-test-release
4
5jobs:
6 publish:
7 name: Publish for ${{ matrix.os }}
8 runs-on: ${{ matrix.os }}
9 strategy:
10 matrix:
11 os: [ubuntu-22.04, ubuntu-latest]
12 include:
13 - os: ubuntu-22.04
14 artifact_name: libmatrix.so
15 asset_name: libmatrix.so-ubuntu-22.04
16 - os: ubuntu-24.04
17 artifact_name: libmatrix.so
18 asset_name: libmatrix.so-ubuntu-24.04
19 - os: ubuntu-latest # currently 24.04
20 artifact_name: libmatrix.so
21 asset_name: libmatrix.so-ubuntu-latest
22 rust:
23 - stable
24 fail-fast: false
25
26 steps:
27 - name: Install latest-stable weechat for Ubuntu
28 id: build_env
29 run: |
30 sudo apt update
31 sudo apt install dirmngr gpg-agent apt-transport-https
32 sudo apt-key adv --keyserver hkps://keys.openpgp.org --recv-keys 11E9DE8848F2B65222AA75B8D1820DB22A11534E
33 echo "deb https://weechat.org/ubuntu $(lsb_release -c | awk '{ print $NF }') main" | sudo tee /etc/apt/sources.list.d/weechat.list
34 echo "deb-src https://weechat.org/ubuntu $(lsb_release -c | awk '{ print $NF }') main" | sudo tee -a /etc/apt/sources.list.d/weechat.list
35 sudo apt update
36 sudo apt install weechat-curses weechat-plugins weechat-python weechat-perl weechat-dev
37 echo "version of weechat-plugin.h that weechat-sys uses by default:"
38 grep -m 1 -n -H "WEECHAT_PLUGIN_API_VERSION" "/usr/include/weechat/weechat-plugin.h"
39 v="$(grep -m 1 -o 'WEECHAT_PLUGIN_API_VERSION.*' '/usr/include/weechat/weechat-plugin.h')"
40 echo "W_API_V=$v" >> $GITHUB_OUTPUT
41
42 - name: Install sqlite3 libraries
43 run: |
44 sudo apt install libsqlite3-dev
45
46 - name: Checkout sources
47 uses: actions/checkout@v4
48
49 - name: Install toolchain
50 run: |
51 rustup update --no-self-update
52 rustup default stable
53
54 - name: Run cargo build
55 run: cargo build --release
56
57 - name: Run cargo test
58 run: cargo test --release
59
60 - name: Upload binary
61 uses: actions/upload-artifact@v4
62 with:
63 name: 'libmatrix.so-${{ matrix.os }}'
64 path: target/release/libmatrix.so
65
66 publish-deb:
67 name: Publish .deb for Debian 13 (trixie)
68 runs-on: ubuntu-latest
69 container:
70 image: debian:trixie
71 steps:
72 - name: Install system dependencies
73 run: |
74 apt-get update
75 apt-get install -y ca-certificates curl gnupg apt-transport-https build-essential pkg-config libssl-dev libsqlite3-dev libclang-dev git
76 apt-get install -y weechat-curses weechat-plugins weechat-python weechat-perl weechat-dev
77 - name: Install Rust toolchain
78 run: |
79 curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
80 echo "$HOME/.cargo/bin" >> $GITHUB_PATH
81 # rustup isn't on PATH yet in this step, use full path
82 "$HOME/.cargo/bin/rustup" default stable
83 - name: Checkout sources
84 uses: actions/checkout@v4
85 - name: Install cargo-deb
86 run: cargo install cargo-deb
87 - name: Build .deb package
88 run: make deb
89 - name: Find .deb artifact
90 id: deb_artifact
91 run: |
92 deb_file=$(ls target/debian/weechat-matrix-rs_*.deb)
93 echo "path=$deb_file" >> "$GITHUB_OUTPUT"
94 echo "name=$(basename "$deb_file" .deb)" >> "$GITHUB_OUTPUT"
95 - name: Upload .deb artifact
96 uses: actions/upload-artifact@v4
97 with:
98 name: ${{ steps.deb_artifact.outputs.name }}
99 path: ${{ steps.deb_artifact.outputs.path }}