Skip to content

Commit

Permalink
idk what im doing
Browse files Browse the repository at this point in the history
  • Loading branch information
i0x0 committed Sep 19, 2023
1 parent c0a04ca commit 333e9a8
Show file tree
Hide file tree
Showing 4 changed files with 320 additions and 946 deletions.
290 changes: 230 additions & 60 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,25 @@
on: [push, pull_request]

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

'on':
push:
branches:
- '*'
pull_request: null
jobs:
check:
name: Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v1
with:
path: ~/.cargo/registry
key: '${{ runner.os }}-cargo-registry-${{ hashFiles(''**/Cargo.lock'') }}'
- uses: actions/cache@v1
with:
path: ~/.cargo/git
key: '${{ runner.os }}-cargo-index-${{ hashFiles(''**/Cargo.lock'') }}'
- uses: actions/cache@v1
with:
path: target
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
- uses: actions-rs/toolchain@v1
with:
profile: minimal
Expand All @@ -22,84 +28,248 @@ jobs:
- uses: actions-rs/cargo@v1
with:
command: check
args: --all-features

check_wasm:
name: Check wasm32
#test:
# runs-on: '${{ matrix.os }}'
# strategy:
# matrix:
# include:
# - os: macos-latest
# - os: ubuntu-latest
# - os: windows-latest
# steps:
# - uses: actions/checkout@v2
# - uses: actions/cache@v1
# with:
# path: ~/.cargo/registry
# key: '${{ runner.os }}-cargo-registry-${{ hashFiles(''**/Cargo.lock'') }}'
# - uses: actions/cache@v1
# with:
# path: ~/.cargo/git
# key: '${{ runner.os }}-cargo-index-${{ hashFiles(''**/Cargo.lock'') }}'
# - uses: actions/cache@v1
# with:
# path: target
# key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
# - uses: actions-rs/toolchain@v1
# with:
# profile: minimal
# toolchain: stable
# override: true
# - uses: actions-rs/cargo@v1
# with:
# command: test
# - uses: actions-rs/cargo@v1
# with:
# command: run
# args: '-- -h'
lints:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v1
with:
path: ~/.cargo/registry
key: '${{ runner.os }}-cargo-registry-${{ hashFiles(''**/Cargo.lock'') }}'
- uses: actions/cache@v1
with:
path: ~/.cargo/git
key: '${{ runner.os }}-cargo-index-${{ hashFiles(''**/Cargo.lock'') }}'
- uses: actions/cache@v1
with:
path: target
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
target: wasm32-unknown-unknown
override: true
components: 'rustfmt, clippy'
- uses: actions-rs/cargo@v1
with:
command: check
args: --all-features --lib --target wasm32-unknown-unknown

test:
name: Test Suite
command: fmt
args: '--all -- --check'
- uses: actions-rs/cargo@v1
with:
command: clippy
args: '-- -D warnings'
version:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
- uses: actions/checkout@master
with:
profile: minimal
toolchain: stable
override: true
- run: sudo apt-get install libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev libxkbcommon-dev libssl-dev
- uses: actions-rs/cargo@v1
lfs: true
- run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
- id: get_previous_version
run: echo ::set-output name=PREVIOUS_VERSION::$(git describe --tags "$(git rev-list --tags --max-count=1)")
shell: bash
- id: semvers
uses: WyriHaximus/github-action-next-semvers@master
with:
command: test
args: --lib

fmt:
name: Rustfmt
runs-on: ubuntu-latest
version: '${{ steps.get_previous_version.outputs.PREVIOUS_VERSION }}'
- run: mkdir -p ./version
- if: "!contains(github.event.head_commit.message, 'BC BREAK') && !contains(github.event.head_commit.message, 'Signed-off-by: dependabot-preview[bot] <[email protected]>')"
run: echo "$VERSION" >./version/version
env:
VERSION: ${{ steps.semvers.outputs.v_minor }}
- if: "contains(github.event.head_commit.message, 'Signed-off-by: dependabot-preview[bot] <[email protected]>')"
run: echo "$VERSION" >./version/version
env:
VERSION: ${{ steps.semvers.outputs.v_patch }}
- run: echo "$VERSION" > ./version/version
env:
VERSION: ${{ steps.semvers.outputs.v_major }}
if: "contains(github.event.head_commit.message, 'BC BREAK')"
- uses: actions/upload-artifact@master
with:
name: version
path: ./version/version
build:
needs:
- version
- check
runs-on: '${{ matrix.os }}'
strategy:
matrix:
include:
- os: macos-latest
target: x86_64-apple-darwin
suffix: ''
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
suffix: ''
- os: windows-latest
target: x86_64-pc-windows-msvc
suffix: .exe
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@master
with:
lfs: true
- id: get_repository_name
run: echo ::set-output name=REPOSITORY_NAME::$(echo "$GITHUB_REPOSITORY" | awk -F / '{print $2}' | sed -e "s/:refs//")
shell: bash
- uses: actions/download-artifact@master
with:
name: version
- id: get_version
run: 'echo ::set-output "name=VERSION::$(cat ./version/version)"'
shell: bash
- uses: actions/cache@v1
with:
path: ~/.cargo/registry
key: '${{ runner.os }}-cargo-registry-${{ hashFiles(''**/Cargo.lock'') }}'
- uses: actions/cache@v1
with:
path: ~/.cargo/git
key: '${{ runner.os }}-cargo-index-${{ hashFiles(''**/Cargo.lock'') }}'
- uses: actions/cache@v1
with:
path: target
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
components: rustfmt
- uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check

clippy:
name: Clippy
command: install
args: 'toml-cli'
- shell: bash
env:
VERSION: '${{ steps.get_version.outputs.VERSION }}'
run: |
TEMP_FILE="$(mktemp)"
toml set Cargo.toml package.version "${VERSION:1}" > "$TEMP_FILE"
mv "$TEMP_FILE" Cargo.toml
- uses: actions-rs/cargo@v1
env:
VERSION: '${{ steps.get_version.outputs.VERSION }}'
REPOSITORY_NAME: '${{ steps.get_repository_name.outputs.REPOSITORY_NAME }}'
with:
command: build
args: '--release'
- uses: actions/upload-artifact@master
with:
name: ${{ steps.get_repository_name.outputs.REPOSITORY_NAME }}-${{ matrix.target }}
path: ./target/release/${{ steps.get_repository_name.outputs.REPOSITORY_NAME }}${{ matrix.suffix }}
release:
if: github.ref == 'refs/heads/master'
needs:
- build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@master
with:
lfs: true
- id: get_repository_name
run: echo ::set-output name=REPOSITORY_NAME::$(echo "$GITHUB_REPOSITORY" | awk -F / '{print $2}' | sed -e "s/:refs//")
shell: bash
- uses: actions/download-artifact@master
with:
name: version
- id: get_version
run: 'echo ::set-output name=VERSION::$(cat ./version/version)'
shell: bash
- uses: actions/download-artifact@master
with:
name: ${{ steps.get_repository_name.outputs.REPOSITORY_NAME }}-x86_64-unknown-linux-gnu
- uses: actions/download-artifact@master
with:
name: ${{ steps.get_repository_name.outputs.REPOSITORY_NAME }}-x86_64-apple-darwin
- uses: actions/download-artifact@master
with:
name: ${{ steps.get_repository_name.outputs.REPOSITORY_NAME }}-x86_64-pc-windows-msvc
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
components: clippy
- uses: actions-rs/cargo@v1
with:
command: clippy
args: -- -D warnings

trunk:
name: trunk
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
command: install
args: 'toml-cli'
- run: |
TEMP_FILE="$(mktemp)"
toml set Cargo.toml package.version "${VERSION:1}" > "$TEMP_FILE"
mv "$TEMP_FILE" Cargo.toml
shell: bash
env:
VERSION: '${{ steps.get_version.outputs.VERSION }}'
- uses: stefanzweifel/[email protected]
with:
profile: minimal
toolchain: 1.65.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
commit_message: Bump cargo version
branch: ${{ github.head_ref }}
file_pattern: Cargo.toml
- id: create_release
uses: actions/[email protected]
env:
GITHUB_TOKEN: '${{ secrets.COMMITTER_TOKEN }}'
with:
tag_name: '${{ steps.get_version.outputs.VERSION }}'
release_name: 'Release ${{ steps.get_version.outputs.VERSION }}'
draft: false
prerelease: false
- uses: actions/[email protected]
env:
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
with:
upload_url: '${{ steps.create_release.outputs.upload_url }}'
asset_path: ./${{ steps.get_repository_name.outputs.REPOSITORY_NAME }}-x86_64-unknown-linux-gnu/${{ steps.get_repository_name.outputs.REPOSITORY_NAME }}
asset_name: ${{ steps.get_repository_name.outputs.REPOSITORY_NAME }}-x86_64-unknown-linux-gnu
asset_content_type: application/octet-stream
- uses: actions/[email protected]
env:
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
with:
upload_url: '${{ steps.create_release.outputs.upload_url }}'
asset_path: ./${{ steps.get_repository_name.outputs.REPOSITORY_NAME }}-x86_64-apple-darwin/${{ steps.get_repository_name.outputs.REPOSITORY_NAME }}
asset_name: ${{ steps.get_repository_name.outputs.REPOSITORY_NAME }}-x86_64-apple-darwin
asset_content_type: application/octet-stream
- uses: actions/[email protected]
env:
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
with:
upload_url: '${{ steps.create_release.outputs.upload_url }}'
asset_path: ./${{ steps.get_repository_name.outputs.REPOSITORY_NAME }}-x86_64-pc-windows-msvc/${{ steps.get_repository_name.outputs.REPOSITORY_NAME }}.exe
asset_name: ${{ steps.get_repository_name.outputs.REPOSITORY_NAME }}-x86_64-pc-windows-msvc.exe
asset_content_type: application/octet-stream
Loading

0 comments on commit 333e9a8

Please sign in to comment.