on:
push:
branches: [main]
pull_request:
branches: [main]
name: CI
jobs:
check:
name: Golden
runs-on: ubuntu-latest
strategy:
matrix:
rust:
- stable
- 1.60.0
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.rust }}
override: true
- uses: Swatinem/rust-cache@v2
- uses: actions/cache@v3
with:
key: downloads
path: |
downloads/factorio
downloads/runtime-api.json
- name: Download Factorio
run: |
mkdir -p downloads
test -e downloads/factorio \
|| wget --no-verbose -O - https://www.factorio.com/get-download/latest/headless/linux64 \
| tar --extract --xz --directory=downloads
test -e downloads/runtime-api.json \
|| wget --no-verbose -O downloads/runtime-api.json https://lua-api.factorio.com/latest/runtime-api.json
- name: Run factorio-exporter
uses: actions-rs/cargo@v1
with:
command: run
args: |
-q
--features=clap,tracing-subscriber
-- -i
--factorio-binary downloads/factorio/bin/x64/factorio
--factorio-api-spec downloads/runtime-api.json
-d new-vanilla.json
- name: Validate output
run: diff -u data/vanilla.json new-vanilla.json
test:
name: Test Suite
runs-on: ubuntu-latest
strategy:
matrix:
rust:
- stable
- 1.60.0
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.rust }}
override: true
- uses: Swatinem/rust-cache@v2
- uses: actions-rs/cargo@v1
with:
command: test
fmt:
name: Rustfmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- run: rustup component add rustfmt
- uses: Swatinem/rust-cache@v2
- uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
clippy:
name: Clippy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- run: rustup component add clippy
- uses: Swatinem/rust-cache@v2
- uses: actions-rs/cargo@v1
with:
command: clippy
args: -- -D warnings