From 6b13fa3aabb6a9d1f83e426c821aa4d531031eb0 Mon Sep 17 00:00:00 2001 From: M*C*O Date: Wed, 1 Jul 2020 02:51:29 +0200 Subject: [PATCH] Add CD via Github Actions (#351). Closes #93 * Add first action * Install libxcb-composite0-dev, fix job name * Use apt-get instead of apt, more descriptive names for os-specific steps * Also match .exe, thanks windows * use upload-artifact v2 * Specifically pick out the binary for upload * Fix step name * Name binary after target os --- .github/workflows/build.yaml | 61 ++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 .github/workflows/build.yaml diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml new file mode 100644 index 0000000..5323758 --- /dev/null +++ b/.github/workflows/build.yaml @@ -0,0 +1,61 @@ +name: Build +on: + push: + +jobs: + build: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: + - windows-latest + - ubuntu-latest + - macos-latest + fail-fast: true + steps: + - uses: actions/checkout@v2 + - name: Install Rust + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + default: true + - name: (Windows) Enable static CRT linkage # https://stackoverflow.com/a/44387312/7653274 + if: matrix.os == 'windows-latest' + run: | + mkdir .cargo + echo '[target.x86_64-pc-windows-msvc]' >> .cargo/config + echo 'rustflags = ["-Ctarget-feature=+crt-static"]' >> .cargo/config + - name: (Linux) Install libxcb-composite + if: matrix.os == 'ubuntu-latest' + run: | + sudo apt-get update + sudo apt-get install -y libxcb-composite0-dev + - name: Build binary + run: | + cargo build --verbose --release + env: + MACOSX_DEPLOYMENT_TARGET: 10.14 + - name: (Linux/MacOS) Strip binary + if: matrix.os != 'windows-latest' + run: strip target/release/stevenarella + - name: Move binary + run: | + if [[ ${{ matrix.os }} == windows ]]; then + mv target/release/stevenarella.exe stevenarella-${{ matrix.os }}.exe + else + mv target/release/stevenarella stevenarella-${{ matrix.os }} + fi + shell: bash + - name: Upload binary + uses: actions/upload-artifact@v2 + with: + name: stevenarella-${{ matrix.os }} + path: stevenarella* + - name: Release binary + if: startsWith(github.ref, 'refs/tags/') + uses: softprops/action-gh-release@v1 + with: + files: | + stevenarella* + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}