Skip to content
Closed
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
169 changes: 165 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,31 +15,192 @@ concurrency:

jobs:
build:
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
platform: [macos-latest, ubuntu-22.04, windows-latest]

runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: setup node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 16
node-version: 18
- name: install pnpm
uses: pnpm/action-setup@v2
with:
version: 8
- name: Cache pnpm dependencies
uses: actions/cache@v3
with:
path: |
~/.pnpm-store
node_modules
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-
- name: install Rust stable
uses: dtolnay/rust-toolchain@stable
- name: Cache Rust dependencies
uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-
- name: install dependencies (ubuntu only)
if: matrix.platform == 'ubuntu-22.04'
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev libappindicator3-dev librsvg2-dev patchelf
sudo apt-get install -y \
pkg-config \
build-essential \
libgtk-3-dev \
libwebkit2gtk-4.1-dev \
libayatana-appindicator3-dev \
librsvg2-dev \
libglib2.0-dev \
libgobject-2.0-dev \
libcairo2-dev \
libpango1.0-dev \
libatk1.0-dev \
libgdk-pixbuf2.0-dev \
patchelf
- name: Debug pkg-config
if: matrix.platform == 'ubuntu-22.04'
run: |
pkg-config --version
find /usr -name "glib-2.0.pc" 2>/dev/null || echo "glib-2.0.pc not found"
pkg-config --libs --cflags glib-2.0 || echo "pkg-config glib-2.0 failed"
- name: install frontend dependencies
run: pnpm install
- uses: tauri-apps/tauri-action@v0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
projectPath: src-tauri
- name: Upload build artifacts
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
uses: actions/upload-artifact@v4
with:
name: collie-${{ matrix.platform }}
path: src-tauri/target/release/
if-no-files-found: warn

fmt:
runs-on: ubuntu-latest
name: stable / fmt
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Install stable
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- name: cargo fmt --check
run: cargo fmt --check
working-directory: src-tauri

clippy:
runs-on: ubuntu-latest
name: ${{ matrix.toolchain }} / clippy
permissions:
contents: read
checks: write
strategy:
fail-fast: false
matrix:
# Get early warning of new lints
toolchain: [stable, beta]
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Install ${{ matrix.toolchain }}
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.toolchain }}
components: clippy
- name: cargo clippy
uses: giraffate/clippy-action@v1
with:
reporter: 'github-pr-check'
github_token: ${{ secrets.GITHUB_TOKEN }}
args: --manifest-path src-tauri/Cargo.toml

hack:
# cargo-hack checks combinations of feature flags to ensure that features are all additive
# which is required for feature unification
runs-on: ubuntu-latest
name: ubuntu / stable / features
steps:
- uses: actions/checkout@v4
with:
submodules: true

- name: Install stable
uses: dtolnay/rust-toolchain@stable

- name: cargo install cargo-hack
uses: taiki-e/install-action@cargo-hack

- name: Install system dependencies (Ubuntu)
run: |
sudo apt-get update
sudo apt-get install -y \
libgtk-3-dev \
libgdk-3-dev \
libappindicator3-dev \
librsvg2-dev \
libglib2.0-dev \
patchelf

- name: Ensure distDir exists
run: mkdir -p dist
working-directory: src-tauri

# --feature-powerset runs for every combination of features; no target specifier
- name: cargo hack
run: cargo hack --feature-powerset check
working-directory: src-tauri

msrv:
# check that we can build using the minimal rust version that is specified by this crate
runs-on: ubuntu-latest
strategy:
matrix:
# Updated to match the actual minimum version required by dependencies
msrv: ["1.82.0"] # Some dependencies require 1.82
name: ubuntu / ${{ matrix.msrv }}
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Install ${{ matrix.msrv }}
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.msrv }}
- name: Generate lockfile with Rust ${{ matrix.msrv }}
run: cargo +${{ matrix.msrv }} generate-lockfile
working-directory: src-tauri
- name: cargo +${{ matrix.msrv }} check
run: cargo check --locked
working-directory: src-tauri

security-scan:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run Trivy vulnerability scanner
uses: aquasecurity/trivy-action@master
with:
scan-type: 'fs'
scan-ref: '.'
format: 'sarif'
output: 'trivy-results.sarif'
3 changes: 2 additions & 1 deletion src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ authors = ["parksb <[email protected]>"]
license = "GPL-3.0"
repository = "https://github.com/parksb/collie"
edition = "2021"
rust-version = "1.82"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

Expand All @@ -25,7 +26,7 @@ atom_syndication = "0.12"
reqwest = { version = "0.11", features = ["blocking"] }
sha1_smol = { version = "1", features = ["std"] }
thiserror = "1.0"
regex = "1.9"
regex = "1.8"
scraper = "0.18.1"

[dev-dependencies]
Expand Down
5 changes: 4 additions & 1 deletion src-tauri/src/syndication.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,10 @@ pub fn fetch_feed_items(link: &str, proxy: Option<&str>) -> Result<Vec<RawItem>>
.map(atom_syndication::Content::value)
.filter(std::option::Option::is_some)
.map(|x| x.unwrap().to_string()),
published_at: x.published().or(Some(x.updated())).map(|x| x.with_timezone(&Utc).fixed_offset()),
published_at: x
.published()
.or(Some(x.updated()))
.map(|x| x.with_timezone(&Utc).fixed_offset()),
})
.collect()),
Feed::RSS(rss) => Ok(rss
Expand Down
Loading