From c35d374fe81f2359e01363657b82e993ba363c56 Mon Sep 17 00:00:00 2001 From: cold-brewed <47337035+cold-brewed@users.noreply.github.com> Date: Mon, 19 Feb 2024 12:28:10 -0500 Subject: [PATCH 1/2] Add workflow files to enable GitHub Actions --- .github/workflows/linux.yml | 49 ++++++++++++++++++++++ .github/workflows/macos.yml | 77 +++++++++++++++++++++++++++++++++++ .github/workflows/windows.yml | 52 +++++++++++++++++++++++ 3 files changed, 178 insertions(+) create mode 100644 .github/workflows/linux.yml create mode 100644 .github/workflows/macos.yml create mode 100644 .github/workflows/windows.yml diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml new file mode 100644 index 00000000..7bfa4e53 --- /dev/null +++ b/.github/workflows/linux.yml @@ -0,0 +1,49 @@ +name: Linux + +on: + push: + pull_request: + +env: + CARGO_TERM_COLOR: always + +jobs: + build_and_test: + name: martypc + runs-on: ubuntu-22.04 + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Install dependencies + run: >- + sudo apt update && sudo apt install + libasound2-dev + libudev-dev + + - name: Cargo build + run: cargo build -r --features ega + + - name: Copy files into install dir + run: cp README.md target/release/martypc install + + - name: Rename install directory + run: mv install martypc + + - name: Create artifact directory + run: mkdir artifacts + + # GitHub zips all artifacts, losing file permissions. + # We'll need to tar the directory in order to + # preserve the file permissions + - name: Create artifact from install directory + run: tar cvf artifacts/martypc.tar martypc + + - name: Upload artifact + uses: actions/upload-artifact@v4 + with: + name: 'martypc-linux-gha${{ github.run_number }}' + path: artifacts/martypc.tar diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml new file mode 100644 index 00000000..774c65e9 --- /dev/null +++ b/.github/workflows/macos.yml @@ -0,0 +1,77 @@ +name: macOS + +on: + push: + pull_request: + +env: + CARGO_TERM_COLOR: always + +jobs: + macos-arm: + name: martypc (arm) + runs-on: macos-14 + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Cargo build + run: cargo build -r --features ega + + - name: Copy files into install dir + run: cp README.md target/release/martypc install + + - name: Rename install directory + run: mv install martypc + + - name: Create artifact directory + run: mkdir artifacts + + # GitHub zips all artifacts, losing file permissions. + # We'll need to tar the directory in order to + # preserve the file permissions + - name: Create artifact from install directory + run: tar cvf artifacts/martypc.tar martypc + + - name: Upload artifact + uses: actions/upload-artifact@v4 + with: + name: 'martypc-${{ github.job }}-gha${{ github.run_number }}' + path: artifacts/martypc.tar + + macos-x86: + name: martypc (x86) + runs-on: macos-13 + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Cargo build + run: cargo build -r --features ega + + - name: Copy files into install dir + run: cp README.md target/release/martypc install + + - name: Rename install directory + run: mv install martypc + + - name: Create artifact directory + run: mkdir artifacts + + # GitHub zips all artifacts, losing file permissions. + # We'll need to tar the directory in order to + # preserve the file permissions + - name: Create artifact from install directory + run: tar cvf artifacts/martypc.tar martypc + + - name: Upload artifact + uses: actions/upload-artifact@v4 + with: + name: 'martypc-${{ github.job }}-gha${{ github.run_number }}' + path: artifacts/martypc.tar diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml new file mode 100644 index 00000000..d4d47fae --- /dev/null +++ b/.github/workflows/windows.yml @@ -0,0 +1,52 @@ +name: Windows + +on: + push: + pull_request: + +env: + CARGO_TERM_COLOR: always + +jobs: + msys2: + name: martypc + runs-on: windows-2022 + + defaults: + run: + shell: msys2 {0} + + strategy: + matrix: + environment: + - msystem: MINGW64 + prefix: mingw-w64-x86_64 + steps: + - name: Prepare MSYS2 environment + uses: msys2/setup-msys2@v2 + with: + release: false + update: true + msystem: ${{ matrix.environment.msystem }} + pacboy: >- + rust:p + + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Cargo build + run: cargo build -r --features ega + + - name: Copy files into install dir + run: cp README.md target/release/martypc install + + - name: Rename install directory + run: mv install martypc + + - name: Upload artifact + uses: actions/upload-artifact@v4 + with: + name: 'martypc-windows-gha${{ github.run_number }}' + path: martypc \ No newline at end of file From 705f0b33c947282d9387e0494e0054eb3056c74b Mon Sep 17 00:00:00 2001 From: cold-brewed <47337035+cold-brewed@users.noreply.github.com> Date: Tue, 20 Feb 2024 13:27:41 -0500 Subject: [PATCH 2/2] Limit GHA builds to specified branches --- .github/workflows/linux.yml | 2 ++ .github/workflows/macos.yml | 2 ++ .github/workflows/windows.yml | 2 ++ 3 files changed, 6 insertions(+) diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 7bfa4e53..b243563e 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -2,6 +2,8 @@ name: Linux on: push: + branches: + - version_0_2_0 pull_request: env: diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index 774c65e9..23247538 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -2,6 +2,8 @@ name: macOS on: push: + branches: + - version_0_2_0 pull_request: env: diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index d4d47fae..48ceeaa3 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -2,6 +2,8 @@ name: Windows on: push: + branches: + - version_0_2_0 pull_request: env: