Refactor: Drop typestate pattern for building sockets #874
Workflow file for this run
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
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
name: Code | |
jobs: | |
test-native: | |
name: Test Native | |
strategy: | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v4 | |
- name: Install stable toolchain | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
toolchain: stable | |
- name: Rust Cache | |
uses: Swatinem/rust-cache@v2 | |
- name: Run cargo test | |
run: cargo test --features signaling --all-targets | |
# Should be upgraded to test when possible | |
check-wasm: | |
name: Check Wasm | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v4 | |
- name: Install stable toolchain | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
toolchain: stable | |
target: wasm32-unknown-unknown | |
- name: Rust Cache | |
uses: Swatinem/rust-cache@v2 | |
- name: Run cargo check | |
run: RUSTFLAGS=--cfg=web_sys_unstable_apis cargo check > | |
--all-targets | |
--target wasm32-unknown-unknown | |
-p matchbox_socket | |
-p bevy_matchbox | |
-p bevy_ggrs_example | |
-p simple_example | |
format: | |
name: Format | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v4 | |
- name: Install stable toolchain | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
toolchain: stable | |
components: rustfmt | |
- name: Rust Cache | |
uses: Swatinem/rust-cache@v2 | |
- name: Run cargo clippy | |
run: cargo fmt --all --check | |
lint-native: | |
name: Lints native | |
strategy: | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v4 | |
- name: Install stable toolchain | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
toolchain: stable | |
components: clippy | |
- name: Rust Cache | |
uses: Swatinem/rust-cache@v2 | |
- name: Run cargo clippy | |
run: cargo clippy --features signaling --all-targets -- -D warnings | |
lint-wasm: | |
name: Clippy wasm | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v4 | |
- name: Install stable toolchain | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
toolchain: stable | |
target: wasm32-unknown-unknown | |
components: clippy | |
- name: Rust Cache | |
uses: Swatinem/rust-cache@v2 | |
- name: Run cargo clippy | |
run: RUSTFLAGS=--cfg=web_sys_unstable_apis cargo clippy > | |
--all-targets | |
--target wasm32-unknown-unknown | |
-p matchbox_socket | |
-p bevy_matchbox | |
-p bevy_ggrs_example | |
-p simple_example | |
-- | |
-D warnings | |
server-container: | |
name: Build & Push Server Container | |
needs: [test-native, check-wasm, lint-native, lint-wasm] | |
runs-on: ubuntu-latest | |
permissions: | |
packages: write | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
- name: Generate Image Name | |
run: echo IMAGE_REPOSITORY=ghcr.io/$(tr '[:upper:]' '[:lower:]' <<< "${{ github.repository }}")/matchbox_server >> $GITHUB_ENV | |
- name: Log in to GitHub Docker Registry | |
if: github.event_name != 'pull_request' | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Docker Metadata | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: ${{ env.IMAGE_REPOSITORY }} | |
tags: | | |
type=ref,event=tag | |
type=raw,value=latest | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Build Image | |
uses: docker/build-push-action@v6 | |
with: | |
context: "." | |
file: "matchbox_server/Dockerfile" | |
push: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags') }} | |
load: ${{ ! (github.event_name == 'push' && startsWith(github.ref, 'refs/tags')) }} | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max |