Skip to content

Commit

Permalink
Merge pull request #4 from rodneylab/build__update_dependencies
Browse files Browse the repository at this point in the history
build(dependencies): 🧱 update crates
  • Loading branch information
rodneylab authored Dec 23, 2024
2 parents 10b57c3 + a57b2e6 commit b4ab462
Show file tree
Hide file tree
Showing 7 changed files with 622 additions and 233 deletions.
29 changes: 15 additions & 14 deletions .github/workflows/pages.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
name: Github Pages

# By default, runs if you push to master. keeps your deployed app in sync with master branch.
# By default, runs if you push to main. keeps your deployed app in sync with main branch.
on:
push:
branches:
- master
- main
# to only run when you do a new github release, comment out above part and uncomment the below trigger.
# on:
# release:
Expand All @@ -13,29 +12,31 @@ on:

permissions:
contents: write # for committing to gh-pages branch.

jobs:
build-github-pages:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2 # repo checkout
- uses: actions-rs/toolchain@v1 # get rust toolchain for wasm
with:
profile: minimal
toolchain: stable
target: wasm32-unknown-unknown
override: true
- uses: actions/checkout@v4 # repo checkout
- name: Setup toolchain for wasm
run: |
rustup update stable
rustup default stable
rustup set profile minimal
rustup target add wasm32-unknown-unknown
- name: Rust Cache # cache the rust build artefacts
uses: Swatinem/rust-cache@v1
uses: Swatinem/rust-cache@v2
- name: Download and install Trunk binary
run: wget -qO- https://github.com/thedodd/trunk/releases/latest/download/trunk-x86_64-unknown-linux-gnu.tar.gz | tar -xzf-
- name: Build # build
# "${GITHUB_REPOSITORY#*/}" evaluates into the name of the repository
# Environment $public_url resolves to the github project page.
# If using a user/organization page, remove the `${{ github.event.repository.name }}` part.
# using --public-url something will allow trunk to modify all the href paths like from favicon.ico to repo_name/favicon.ico .
# this is necessary for github pages where the site is deployed to username.github.io/repo_name and all files must be requested
# relatively as eframe_template/favicon.ico. if we skip public-url option, the href paths will instead request username.github.io/favicon.ico which
# will obviously return error 404 not found.
run: ./trunk build --release --public-url "${GITHUB_REPOSITORY#*/}"
run: ./trunk build --release --public-url $public_url
env:
public_url: "https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}"
- name: Deploy
uses: JamesIves/github-pages-deploy-action@v4
with:
Expand Down
81 changes: 64 additions & 17 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
on: [push, pull_request]

on: [push, pull_request, workflow_dispatch]
name: CI

env:
# This is required to enable the web_sys clipboard API which egui_web uses
# https://rustwasm.github.io/wasm-bindgen/api/web_sys/struct.Clipboard.html
# https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html
RUSTFLAGS: --cfg=web_sys_unstable_apis

RUSTFLAGS: -D warnings
RUSTDOCFLAGS: -D warnings
jobs:
check:
name: Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- uses: actions-rs/toolchain@v1
with:
profile: minimal
Expand All @@ -23,12 +21,11 @@ jobs:
with:
command: check
args: --all-features

check_wasm:
name: Check wasm32
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- uses: actions-rs/toolchain@v1
with:
profile: minimal
Expand All @@ -39,12 +36,11 @@ jobs:
with:
command: check
args: --all-features --lib --target wasm32-unknown-unknown

test:
name: Test Suite
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- uses: actions-rs/toolchain@v1
with:
profile: minimal
Expand All @@ -55,12 +51,11 @@ jobs:
with:
command: test
args: --lib

fmt:
name: Rustfmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- uses: actions-rs/toolchain@v1
with:
profile: minimal
Expand All @@ -71,12 +66,11 @@ jobs:
with:
command: fmt
args: --all -- --check

clippy:
name: Clippy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- uses: actions-rs/toolchain@v1
with:
profile: minimal
Expand All @@ -87,19 +81,72 @@ jobs:
with:
command: clippy
args: -- -D warnings

trunk:
name: trunk
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: 1.76.0
toolchain: 1.81.0
target: wasm32-unknown-unknown
override: true
- name: Download and install Trunk binary
run: wget -qO- https://github.com/thedodd/trunk/releases/latest/download/trunk-x86_64-unknown-linux-gnu.tar.gz | tar -xzf-
- name: Build
run: ./trunk build
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: macos-latest
TARGET: aarch64-apple-darwin
- os: ubuntu-latest
TARGET: aarch64-unknown-linux-gnu
- os: ubuntu-latest
TARGET: armv7-unknown-linux-gnueabihf
- os: ubuntu-latest
TARGET: x86_64-unknown-linux-gnu
- os: windows-latest
TARGET: x86_64-pc-windows-msvc
EXTENSION: .exe
steps:
- name: Building ${{ matrix.TARGET }}
run: echo "${{ matrix.TARGET }}"
- uses: actions/checkout@master
- name: Install build dependencies - Rustup
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --default-toolchain stable --profile default --target ${{ matrix.TARGET }} -y
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
# For linux, it's necessary to use cross from the git repository to avoid glibc problems
# Ref: https://github.com/cross-rs/cross/issues/1510
- name: Install cross for linux
if: contains(matrix.TARGET, 'linux')
run: |
cargo install cross --git https://github.com/cross-rs/cross --rev 1b8cf50d20180c1a394099e608141480f934b7f7
- name: Install cross for mac and windows
if: ${{ !contains(matrix.TARGET, 'linux') }}
run: |
cargo install cross
- name: Build
run: |
cross build --verbose --release --target=${{ matrix.TARGET }}
- name: Rename
run: cp target/${{ matrix.TARGET }}/release/eframe_template${{ matrix.EXTENSION }} eframe_template-${{ matrix.TARGET }}${{ matrix.EXTENSION }}
- uses: actions/upload-artifact@master
with:
name: eframe_template-${{ matrix.TARGET }}${{ matrix.EXTENSION }}
path: eframe_template-${{ matrix.TARGET }}${{ matrix.EXTENSION }}
- uses: svenstaro/upload-release-action@v2
name: Upload binaries to release
if: ${{ github.event_name == 'push' }}
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: eframe_template-${{ matrix.TARGET }}${{ matrix.EXTENSION }}
asset_name: eframe_template-${{ matrix.TARGET }}${{ matrix.EXTENSION }}
tag: ${{ github.ref }}
prerelease: ${{ !startsWith(github.ref, 'refs/tags/') }}
overwrite: true
46 changes: 23 additions & 23 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
repos:
- hooks:
- id: commitizen
stages:
- commit-msg
repo: https://github.com/commitizen-tools/commitizen
rev: v3.30.1
- hooks:
- id: fmt
- id: cargo-check
- id: clippy
repo: https://github.com/doublify/pre-commit-rust
rev: v1.0
- hooks:
- id: gitleaks
repo: https://github.com/gitleaks/gitleaks
rev: v8.21.2
- hooks:
- id: end-of-file-fixer
- args:
- --markdown-linebreak-ext=md
id: trailing-whitespace
repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
- hooks:
- id: commitizen
stages:
- commit-msg
repo: https://github.com/commitizen-tools/commitizen
rev: v4.1.0
- hooks:
- id: fmt
- id: cargo-check
- id: clippy
repo: https://github.com/doublify/pre-commit-rust
rev: v1.0
- hooks:
- id: gitleaks
repo: https://github.com/gitleaks/gitleaks
rev: v8.22.0
- hooks:
- id: end-of-file-fixer
- args:
- --markdown-linebreak-ext=md
id: trailing-whitespace
repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
Loading

0 comments on commit b4ab462

Please sign in to comment.