Skip to content
Open
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
38 changes: 38 additions & 0 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# GitHub Copilot Instructions

## Code Writing Standards
- Follow established code-writing standards for your language (spacing, comments, naming).
- Consider internal coding rules for folder and function naming.
- Follow the "boy scout rule": Always leave the codebase cleaner than you found it.

## Comment Usage
- Use comments sparingly and make them meaningful.
- Avoid commenting on obvious things; use comments to explain "why" or unusual behavior.

## Conditional Encapsulation
- Encapsulate nested if/else statements into functions with descriptive names for clarity.

## DRY Principle
- Avoid code duplication; reuse code via functions, classes, modules, or libraries.
- Modify code in one place if updates are needed.

## Function Length & Responsibility
- Write short, focused functions (single responsibility principle).
- Break up long or complex functions into smaller ones.

## General Code Style & Readability
- Write readable, understandable, and maintainable code.
- Prioritize clarity and adhere to coding standards.
- Regularly review and refactor code for structure and maintainability.
- Use version control (e.g., Git) for collaboration.

## Naming Conventions
- Use meaningful, descriptive names for variables, functions, and classes.
- Names should reflect purpose and behavior; avoid names that require comments to explain intent.

## Making your changes pass CI
- Before submitting any changes, make sure to run the following commands to check and fix formatting and linting:
- `cargo fmt` to format all code according to the style guidelines.
- `RUSTFLAGS="-D dead-code -D nonstandard-style -D unused-imports -D unused-mut -D unused-variables -D unused-unsafe -D unreachable-patterns -D bad-style -D improper-ctypes -D unused-allocation -D unused-comparisons -D while-true -D unconditional-recursion -D bare-trait-objects -D function_item_references -D clippy::uninlined_format_args " cargo clippy --all --exclude wasmer-swift --locked --fix --allow-dirty -- -D clippy::all` to check for common mistakes and improve code quality.
- If these commands don't pass, CI will reject your changes.
- Run the tests for the code you changed and everything that depends on it.
66 changes: 66 additions & 0 deletions .github/workflows/copilot-setup-steps.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: "Copilot Setup Steps"

on:
workflow_dispatch:
push:
paths:
- .github/workflows/copilot-setup-steps.yml
pull_request:
paths:
- .github/workflows/copilot-setup-steps.yml

env:
RUST_BACKTRACE: 1
MSRV: "1.90"

jobs:
# The job MUST be called `copilot-setup-steps`
copilot-setup-steps:
runs-on: ubuntu-22.04

permissions:
contents: read

steps:
- uses: actions/checkout@v6
- name: Set up libstdc++ on Linux
run: |
sudo apt-get update -y
sudo apt-get install -y --allow-downgrades libstdc++6
sudo apt-get install --reinstall g++

- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ env.MSRV }}
target: x86_64-unknown-linux-gnu
components: rustc,cargo,rust-std,rust-src,clippy,rustfmt,rust-analyzer,rust-docs

- name: Install Nextest
uses: taiki-e/install-action@nextest

- name: Install LLVM
shell: bash
run: |
curl -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" --retry 3 --proto '=https' --tlsv1.2 -sSf ${{ env.LLVM_URL }} -L -o llvm.tar.xz
LLVM_DIR=$(pwd)/${{ env.LLVM_DIR }}
mkdir ${LLVM_DIR}
tar xf llvm.tar.xz --strip-components=1 -C ${LLVM_DIR}
echo "${LLVM_DIR}/bin" >> $GITHUB_PATH
echo "${LLVM_DIR}/usr/bin" >> $GITHUB_PATH
echo "LLVM_SYS_211_PREFIX=${LLVM_DIR}" >> $GITHUB_ENV
echo "ENABLE_LLVM=1" >> $GITHUB_ENV
env:
LLVM_DIR: .llvm
LLVM_URL: https://github.com/wasmerio/llvm-custom-builds/releases/download/21.x/llvm-linux-amd64.tar.xz

- name: Install wasixcc
uses: wasix-org/wasixcc@main
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
sysroot-tag: v2025-12-22.1

- name: Ensure the setup works
run: |
cargo fmt --check || true
RUSTFLAGS="-D dead-code -D nonstandard-style -D unused-imports -D unused-mut -D unused-variables -D unused-unsafe -D unreachable-patterns -D bad-style -D improper-ctypes -D unused-allocation -D unused-comparisons -D while-true -D unconditional-recursion -D bare-trait-objects -D function_item_references -D clippy::uninlined_format_args " cargo clippy --all --exclude wasmer-swift --locked --allow-dirty -- -D clippy::all || true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the || true intentional here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, kind of yes, so it does not fail to setup if there are formatting errors. However, considering that, running those commands here is quite useless. I'll remove them tomorrow.

Loading