ci: better github actions

This commit is contained in:
2026-06-02 21:44:56 +03:00
parent e91465365d
commit ec2fa2a478
3 changed files with 52 additions and 56 deletions
+26 -11
View File
@@ -33,13 +33,22 @@ jobs:
fetch-depth: 0 fetch-depth: 0
- name: Setup Rust toolchain - name: Setup Rust toolchain
uses: actions-rs/toolchain@v1 uses: actions-rust-lang/setup-rust-toolchain@v1
with: with:
toolchain: 1.94.1 toolchain: 1.96.0
- name: Run tests - name: Run tests
run: cargo test --locked run: cargo test --locked
- name: Build all binaries (debug-speed compilation into target/release)
env:
CARGO_PROFILE_RELEASE_OPT_LEVEL: 0
CARGO_PROFILE_RELEASE_DEBUG: "true"
CARGO_PROFILE_RELEASE_STRIP: "false"
CARGO_PROFILE_RELEASE_LTO: "false"
CARGO_PROFILE_RELEASE_CODEGEN_UNITS: 256
run: cargo build --release --locked
- name: Extract all binary names - name: Extract all binary names
id: cargo-meta id: cargo-meta
run: | run: |
@@ -50,9 +59,6 @@ jobs:
echo "$BIN_NAMES" >> $GITHUB_OUTPUT echo "$BIN_NAMES" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT echo "EOF" >> $GITHUB_OUTPUT
- name: Build all binaries
run: cargo build --locked
- name: Package all binaries into one archive - name: Package all binaries into one archive
shell: bash shell: bash
run: | run: |
@@ -64,7 +70,7 @@ jobs:
FILES=() FILES=()
while IFS= read -r BIN; do while IFS= read -r BIN; do
[ -z "$BIN" ] && continue [ -z "$BIN" ] && continue
FILES+=("target/debug/$BIN") FILES+=("target/release/$BIN")
done <<< "${{ steps.cargo-meta.outputs.bin_names }}" done <<< "${{ steps.cargo-meta.outputs.bin_names }}"
if [ "${#FILES[@]}" -eq 0 ]; then if [ "${#FILES[@]}" -eq 0 ]; then
@@ -89,15 +95,23 @@ jobs:
path: pwsp-*.zip path: pwsp-*.zip
retention-days: 7 retention-days: 7
- name: Install cargo-deb and create .deb - name: Cache cargo-deb
id: cache-cargo-deb
uses: actions/cache@v4
with:
path: ~/.cargo/bin/cargo-deb
key: ${{ runner.os }}-cargo-deb-v1
- name: Install cargo-deb
if: steps.cache-cargo-deb.outputs.cache-hit != 'true'
run: cargo install --locked cargo-deb
- name: Create .deb package (debug binaries from target/release)
shell: bash shell: bash
run: | run: |
set -euo pipefail set -euo pipefail
cargo install --locked cargo-deb
export PATH="$HOME/.cargo/bin:$PATH" export PATH="$HOME/.cargo/bin:$PATH"
cargo-deb -p pwsp-gui --no-build --no-strip
cargo build --release --locked
cargo-deb -p pwsp-gui
- name: Upload .deb(s) as artifacts - name: Upload .deb(s) as artifacts
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
@@ -107,6 +121,7 @@ jobs:
retention-days: 7 retention-days: 7
flatpak-build: flatpak-build:
if: github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest runs-on: ubuntu-latest
container: container:
image: ghcr.io/flathub-infra/flatpak-github-actions:freedesktop-25.08 image: ghcr.io/flathub-infra/flatpak-github-actions:freedesktop-25.08
+4 -3
View File
@@ -2,9 +2,9 @@ name: Flatter
on: on:
push: push:
branches: [ main, master ] branches: [main, master]
release: release:
types: [ published ] types: [published]
workflow_dispatch: workflow_dispatch:
inputs: inputs:
tag_name: tag_name:
@@ -60,7 +60,8 @@ jobs:
echo "default-branch: ${{ steps.set_branch.outputs.branch }}" >> packages/flatpak/ru.arabianq.pwsp.yaml echo "default-branch: ${{ steps.set_branch.outputs.branch }}" >> packages/flatpak/ru.arabianq.pwsp.yaml
- name: Install SDK Extensions - name: Install SDK Extensions
run: flatpak install -y flathub org.freedesktop.Sdk.Extension.rust-stable//25.08 run:
flatpak install -y flathub org.freedesktop.Sdk.Extension.rust-stable//25.08
org.freedesktop.Sdk.Extension.llvm20//25.08 org.freedesktop.Sdk.Extension.llvm20//25.08
- name: Build Flatpak - name: Build Flatpak
+21 -41
View File
@@ -85,9 +85,9 @@ jobs:
fetch-depth: 0 fetch-depth: 0
- name: Setup Rust toolchain - name: Setup Rust toolchain
uses: actions-rs/toolchain@v1 uses: actions-rust-lang/setup-rust-toolchain@v1
with: with:
toolchain: 1.94.1 toolchain: 1.96.0
- name: Extract all binary names - name: Extract all binary names
id: cargo-meta id: cargo-meta
@@ -131,49 +131,29 @@ jobs:
zip -j "$ARCHIVE_NAME" "${FILES[@]}" zip -j "$ARCHIVE_NAME" "${FILES[@]}"
- name: Upload release archive - name: Cache cargo-deb
id: cache-cargo-deb
uses: actions/cache@v4
with:
path: ~/.cargo/bin/cargo-deb
key: ${{ runner.os }}-cargo-deb-v1
- name: Install cargo-deb
if: steps.cache-cargo-deb.outputs.cache-hit != 'true'
run: cargo install --locked cargo-deb
- name: Create .deb package (release binaries)
shell: bash
run: |
set -euo pipefail
export PATH="$HOME/.cargo/bin:$PATH"
cargo-deb -p pwsp-gui --no-build
- name: Upload artifacts to Release
uses: softprops/action-gh-release@v2 uses: softprops/action-gh-release@v2
with: with:
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
tag_name: ${{ needs.prepare.outputs.tag }} tag_name: ${{ needs.prepare.outputs.tag }}
files: | files: |
pwsp-*.zip pwsp-*.zip
- name: Install cargo-deb and create .deb
shell: bash
run: |
set -euo pipefail
cargo install --locked cargo-deb
export PATH="$HOME/.cargo/bin:$PATH"
cargo build --release --locked
cargo-deb -p pwsp-gui
- name: Upload .deb(s) to release
uses: softprops/action-gh-release@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
tag_name: ${{ needs.prepare.outputs.tag }}
files: |
target/debian/*.deb target/debian/*.deb
flatpak-release:
needs: prepare
runs-on: ubuntu-latest
container:
image: ghcr.io/flathub-infra/flatpak-github-actions:freedesktop-25.08
options: --privileged
steps:
- uses: actions/checkout@v4
with:
ref: ${{ needs.prepare.outputs.tag }}
- name: Build Flatpak
uses: flatpak/flatpak-github-actions/flatpak-builder@v6
with:
bundle: ru.arabianq.pwsp.flatpak
manifest-path: packages/flatpak/ru.arabianq.pwsp.yaml
cache: true
branch: master
build-bundle: true