Skip to content

Commit

Permalink
Merge pull request #5 from jupyterkat/main
Browse files Browse the repository at this point in the history
Write the CI scripts lol
  • Loading branch information
jupyterkat authored Nov 18, 2023
2 parents 8430ae1 + e749934 commit abafdc6
Show file tree
Hide file tree
Showing 2 changed files with 109 additions and 0 deletions.
85 changes: 85 additions & 0 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
name: Check and Test
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
check:
name: Run checks
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-latest
target_name: i686-unknown-linux-gnu
- os: windows-latest
target_name: i686-pc-windows-msvc
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Toolchains
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: ${{ matrix.target_name }}

- name: Install g++ multilib (Ubuntu)
run: |
sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install build-essential g++-multilib libc6-i386 libstdc++6:i386
if: matrix.os == 'ubuntu-latest'

- name: Check byondapi
uses: actions-rs/cargo@v1
with:
toolchain: stable
command: check
args: --target ${{ matrix.target_name }}

check_fmt:
name: Check format
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Check fmt
uses: actions-rs/cargo@v1
with:
toolchain: stable
command: fmt
args: --all -- --check
# TODO: write linux tests
run_test:
name: Run test
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Toolchains
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: i686-pc-windows-msvc

- name: Restore BYOND cache
uses: actions/cache@v3
with:
path: ~/BYOND
key: linux-byond

- name: Set up byond
run: bash ./test_byond.sh

- name: Run tests
uses: actions-rs/cargo@v1
with:
toolchain: stable
command: test
args: test_byondapi_with_dreamdaemon --target i686-pc-windows-msvc
24 changes: 24 additions & 0 deletions test_byond.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash
set -euo pipefail

export BYOND_MAJOR=515
export BYOND_MINOR=1620

if [ -d "$HOME/BYOND/byond/bin" ] && grep -Fxq "${BYOND_MAJOR}.${BYOND_MINOR}" $HOME/BYOND/version.txt;
then
echo "Using cached directory."
else
echo "Setting up BYOND."
rm -rf "$HOME/BYOND"
mkdir -p "$HOME/BYOND"
cd "$HOME/BYOND"
curl "http://www.byond.com/download/build/${BYOND_MAJOR}/${BYOND_MAJOR}.${BYOND_MINOR}_byond.zip" -o byond.zip
unzip byond.zip
rm byond.zip
cd byond
echo "$BYOND_MAJOR.$BYOND_MINOR" > "$HOME/BYOND/version.txt"
cd ~/
fi
mkdir -p "$GITHUB_WORKSPACE/crates/byondapi-rs-test/dm_project/byond"
cp -r "$HOME/BYOND/byond/bin" "$GITHUB_WORKSPACE/crates/byondapi-rs-test/dm_project/byond"
echo "Written byond bin to $GITHUB_WORKSPACE/crates/byondapi-rs-test/dm_project/byond"

0 comments on commit abafdc6

Please sign in to comment.