fixed web_sys_unstable_apis #328
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: | |
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@v3 | |
- name: Install stable toolchain | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
toolchain: stable | |
- name: Rust Cache | |
uses: Swatinem/rust-cache@v2.5.0 | |
- name: Run cargo test | |
run: cargo test --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@v3 | |
- name: Install stable toolchain | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
toolchain: stable | |
target: wasm32-unknown-unknown | |
- name: Rust Cache | |
uses: Swatinem/rust-cache@v2.5.0 | |
- 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@v3 | |
- name: Install stable toolchain | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
toolchain: stable | |
components: rustfmt | |
- name: Rust Cache | |
uses: Swatinem/rust-cache@v2.5.0 | |
- 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@v3 | |
- name: Install stable toolchain | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
toolchain: stable | |
components: clippy | |
- name: Rust Cache | |
uses: Swatinem/rust-cache@v2.5.0 | |
- name: Run cargo clippy | |
run: cargo clippy --all-targets -- -D warnings | |
lint-wasm: | |
name: Clippy wasm | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v3 | |
- 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.5.0 | |
- name: Run cargo clippy | |
run: 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@v3 | |
- 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@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Docker Metadata | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: ${{ env.IMAGE_REPOSITORY }} | |
tags: | | |
type=ref,event=tag | |
type=raw,value=latest | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Build Image | |
uses: docker/build-push-action@v4 | |
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 |