-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from jupyterkat/main
Write the CI scripts lol
- Loading branch information
Showing
2 changed files
with
109 additions
and
0 deletions.
There are no files selected for viewing
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
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 |
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
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" |