update ci #50
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
# See https://help.github.com/en/actions/reference/events-that-trigger-workflows | |
on: [push, pull_request] | |
jobs: | |
clippy_check: | |
name: Run clippy check | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: nightly | |
components: clippy | |
override: true | |
- name: Install gui library packages | |
run: sudo apt-get update && sudo apt-get install -y libwebkit2gtk-4.0-dev build-essential libayatana-appindicator3-dev librsvg2-dev libgtk-3-dev libsoup2.4-dev libjavascriptcoregtk-4.0-dev | |
- name: Install trunk | |
uses: actions-rs/cargo@v1 | |
with: | |
command: install | |
args: --locked --debug trunk | |
- name: Install webassembly rust target | |
run: rustup target add wasm32-unknown-unknown | |
# Required for tailwindcss | |
- name: Install node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 16 | |
- name: Install node packages | |
working-directory: ./web_frontend | |
run: npm i | |
# We need to build the web frontend otherwise, we will not be able to compile | |
# the server and checks will fail. | |
- name: Build web frontend | |
run: trunk build | |
working-directory: ./web_frontend | |
- name: Build backend | |
run: cargo build | |
working-directory: . | |
rustfmt: | |
name: Check style | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v1 | |
- name: Install rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
components: rustfmt | |
profile: minimal | |
override: true | |
- name: Run cargo fmt | |
uses: actions-rs/cargo@v1 | |
with: | |
command: fmt | |
args: --all -- --check | |
ci: | |
name: Build | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
include: | |
- build: linux | |
os: ubuntu-latest | |
rust: stable | |
target: x86_64-unknown-linux-gnu | |
- build: linux | |
os: ubuntu-latest | |
rust: stable | |
target: aarch64-unknown-linux-gnu | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Cache build artifacts | |
uses: actions/cache@v3 | |
with: | |
key: ${{ matrix.os }}-${{ matrix.target }}-artifacts | |
path: | | |
./target | |
~/.cargo | |
- name: Install rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: ${{ matrix.rust }} | |
profile: minimal | |
override: true | |
- name: Install rust target | |
run: rustup target add ${{ matrix.target }} | |
- name: Install cross build dependencies | |
if: matrix.target == 'aarch64-unknown-linux-gnu' | |
run: sudo apt-get update && sudo apt-get install -y gcc-aarch64-linux-gnu libc6-dev-arm64-cross | |
- name: Install node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 16 | |
- name: Install node packages | |
working-directory: ./web_frontend | |
run: npm i | |
- name: Install trunk | |
uses: actions-rs/cargo@v1 | |
with: | |
command: install | |
args: --locked --debug trunk | |
- name: Build web frontend | |
run: trunk build --release | |
working-directory: ./web_frontend | |
- name: Build server | |
uses: actions-rs/cargo@v1 | |
with: | |
command: build | |
working-directory: . | |
args: --release --target ${{ matrix.target }} --bin privaxy --target-dir target | |
- uses: actions/upload-artifact@v3 | |
if: matrix.os != 'windows-latest' | |
with: | |
name: privaxy-${{ matrix.target }} | |
path: | | |
target/${{ matrix.target }}/release/privaxy |