Skip to content

Commit 8c6f9fb

Browse files
authored
first try build script
1 parent 6aac306 commit 8c6f9fb

File tree

1 file changed

+72
-0
lines changed

1 file changed

+72
-0
lines changed

.github/workflows/rust.yml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: Build
2+
on: [push]
3+
jobs:
4+
build:
5+
# Set the job to run on the platform specified by the matrix below
6+
runs-on: ${{ matrix.runner }}
7+
8+
# Define the build matrix for cross-compilation
9+
strategy:
10+
matrix:
11+
include:
12+
- name: linux-amd64
13+
runner: ubuntu-latest
14+
target: x86_64-unknown-linux-gnu
15+
- name: win-amd64
16+
runner: windows-latest
17+
target: x86_64-pc-windows-msvc
18+
- name: macos-amd64
19+
runner: macos-latest
20+
target: x86_64-apple-darwin
21+
- name: macos-arm64
22+
runner: macos-latest
23+
target: aarch64-apple-darwin
24+
25+
# The steps to run for each matrix item
26+
steps:
27+
- name: Checkout
28+
uses: actions/checkout@v3
29+
30+
- name: Install Rust
31+
uses: dtolnay/rust-toolchain@stable
32+
with:
33+
targets: "${{ matrix.target }}"
34+
35+
- name: Setup Cache
36+
uses: Swatinem/rust-cache@v2
37+
38+
- name: Build Binary
39+
run: cargo build --verbose --locked --release --target ${{ matrix.target }}
40+
41+
- name: Move Binary
42+
shell: bash
43+
run: |
44+
BIN_SUFFIX=""
45+
if [[ "${{ matrix.runner }}" == "windows-latest" ]]; then
46+
BIN_SUFFIX=".exe"
47+
fi
48+
49+
# The built binary output location
50+
BIN_OUTPUT="target/${{ matrix.target }}/release/basiclings${BIN_SUFFIX}"
51+
52+
mkdir "artifact-${{ matrix.name }}"
53+
# Move the built binary where you want it
54+
mv "${BIN_OUTPUT}" "./artifact-${{ matrix.name }}/basiclings${BIN_SUFFIX}"
55+
- name: Build Autotester
56+
shell: bash
57+
run: |
58+
git clone https://github.com/CE-Programming/CEmu.git
59+
cd CEmu/core
60+
make
61+
cd ../tests/autotester
62+
make
63+
cd ../../../
64+
mv "CEmu/tests/autotester/autotester${BIN_SUFFIX}" "./artifact-${{ matrix.name }}/autotester${BIN_SUFFIX}"
65+
- name: Package
66+
shell: bash
67+
run: |
68+
zip "./artifact-${{ matrix.name }}"
69+
- name: Upload
70+
uses: actions/upload-artifact@v4.5.0
71+
with:
72+
name: "artifact-${{ matrix.name }}.zip"

0 commit comments

Comments
 (0)