From 8c6f9fb949dd9e116d149a6e680e975a1fc99c24 Mon Sep 17 00:00:00 2001 From: Ryan Pitasky <111201305+rpitasky@users.noreply.github.com> Date: Sat, 4 Jan 2025 22:53:41 -0500 Subject: [PATCH 1/5] first try build script --- .github/workflows/rust.yml | 72 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 .github/workflows/rust.yml diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml new file mode 100644 index 0000000..1709970 --- /dev/null +++ b/.github/workflows/rust.yml @@ -0,0 +1,72 @@ +name: Build +on: [push] +jobs: + build: + # Set the job to run on the platform specified by the matrix below + runs-on: ${{ matrix.runner }} + + # Define the build matrix for cross-compilation + strategy: + matrix: + include: + - name: linux-amd64 + runner: ubuntu-latest + target: x86_64-unknown-linux-gnu + - name: win-amd64 + runner: windows-latest + target: x86_64-pc-windows-msvc + - name: macos-amd64 + runner: macos-latest + target: x86_64-apple-darwin + - name: macos-arm64 + runner: macos-latest + target: aarch64-apple-darwin + + # The steps to run for each matrix item + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Install Rust + uses: dtolnay/rust-toolchain@stable + with: + targets: "${{ matrix.target }}" + + - name: Setup Cache + uses: Swatinem/rust-cache@v2 + + - name: Build Binary + run: cargo build --verbose --locked --release --target ${{ matrix.target }} + + - name: Move Binary + shell: bash + run: | + BIN_SUFFIX="" + if [[ "${{ matrix.runner }}" == "windows-latest" ]]; then + BIN_SUFFIX=".exe" + fi + + # The built binary output location + BIN_OUTPUT="target/${{ matrix.target }}/release/basiclings${BIN_SUFFIX}" + + mkdir "artifact-${{ matrix.name }}" + # Move the built binary where you want it + mv "${BIN_OUTPUT}" "./artifact-${{ matrix.name }}/basiclings${BIN_SUFFIX}" + - name: Build Autotester + shell: bash + run: | + git clone https://github.com/CE-Programming/CEmu.git + cd CEmu/core + make + cd ../tests/autotester + make + cd ../../../ + mv "CEmu/tests/autotester/autotester${BIN_SUFFIX}" "./artifact-${{ matrix.name }}/autotester${BIN_SUFFIX}" + - name: Package + shell: bash + run: | + zip "./artifact-${{ matrix.name }}" + - name: Upload + uses: actions/upload-artifact@v4.5.0 + with: + name: "artifact-${{ matrix.name }}.zip" From 9a631ac6df96c70092081e68e9d2e99031f6acc2 Mon Sep 17 00:00:00 2001 From: Ryan Pitasky <111201305+rpitasky@users.noreply.github.com> Date: Sat, 4 Jan 2025 22:58:21 -0500 Subject: [PATCH 2/5] zip things properly --- .github/workflows/rust.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 1709970..1f2bb3b 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -49,9 +49,9 @@ jobs: # The built binary output location BIN_OUTPUT="target/${{ matrix.target }}/release/basiclings${BIN_SUFFIX}" - mkdir "artifact-${{ matrix.name }}" + mkdir artifact # Move the built binary where you want it - mv "${BIN_OUTPUT}" "./artifact-${{ matrix.name }}/basiclings${BIN_SUFFIX}" + mv "${BIN_OUTPUT}" "./artifact/basiclings${BIN_SUFFIX}" - name: Build Autotester shell: bash run: | @@ -61,11 +61,11 @@ jobs: cd ../tests/autotester make cd ../../../ - mv "CEmu/tests/autotester/autotester${BIN_SUFFIX}" "./artifact-${{ matrix.name }}/autotester${BIN_SUFFIX}" + mv "CEmu/tests/autotester/autotester${BIN_SUFFIX}" "./artifact/autotester${BIN_SUFFIX}" - name: Package shell: bash run: | - zip "./artifact-${{ matrix.name }}" + zip "artifact-${{ matrix.name }}.zip" ./artifact/* - name: Upload uses: actions/upload-artifact@v4.5.0 with: From 388f755ac45fdd0eb1949287b2d7ff505ddb726a Mon Sep 17 00:00:00 2001 From: Ryan Pitasky <111201305+rpitasky@users.noreply.github.com> Date: Sat, 4 Jan 2025 23:00:39 -0500 Subject: [PATCH 3/5] Upload artifacts properly --- .github/workflows/rust.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 1f2bb3b..ea7dbcd 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -70,3 +70,4 @@ jobs: uses: actions/upload-artifact@v4.5.0 with: name: "artifact-${{ matrix.name }}.zip" + path: "artifact-${{ matrix.name }}.zip" From 22739b3bb9f1fbad94bea4a2358b2496f19fea2a Mon Sep 17 00:00:00 2001 From: Ryan Pitasky <111201305+rpitasky@users.noreply.github.com> Date: Sat, 4 Jan 2025 23:10:35 -0500 Subject: [PATCH 4/5] don't zip artifacts --- .github/workflows/rust.yml | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index ea7dbcd..8fbabe3 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -62,12 +62,8 @@ jobs: make cd ../../../ mv "CEmu/tests/autotester/autotester${BIN_SUFFIX}" "./artifact/autotester${BIN_SUFFIX}" - - name: Package - shell: bash - run: | - zip "artifact-${{ matrix.name }}.zip" ./artifact/* - name: Upload uses: actions/upload-artifact@v4.5.0 with: - name: "artifact-${{ matrix.name }}.zip" - path: "artifact-${{ matrix.name }}.zip" + name: "build-${{ matrix.name }}" + path: "artifact/" From 6dfef108dc07b57a61643acd37a193d49a68fd98 Mon Sep 17 00:00:00 2001 From: Ryan Pitasky <111201305+rpitasky@users.noreply.github.com> Date: Sat, 4 Jan 2025 23:19:39 -0500 Subject: [PATCH 5/5] make artifact name more useful --- .github/workflows/rust.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 8fbabe3..3efdc05 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -65,5 +65,5 @@ jobs: - name: Upload uses: actions/upload-artifact@v4.5.0 with: - name: "build-${{ matrix.name }}" + name: "basiclings-${{ matrix.name }}" path: "artifact/"