From 2c63660e8da590ea2e3934bb4bd2940baa676e66 Mon Sep 17 00:00:00 2001 From: MCOfficer Date: Mon, 29 Jun 2020 10:11:50 +0200 Subject: [PATCH 1/8] Add first action --- .github/workflows/build.yaml | 48 ++++++++++++++++++++++++++++++++++++ 1 file changed, 48 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 00000000..41349f2f --- /dev/null +++ b/.github/workflows/build.yaml @@ -0,0 +1,48 @@ +name: Build +on: + push: + +jobs: + linux: + 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: 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: Build binary + run: | + cargo build --verbose --release + env: + MACOSX_DEPLOYMENT_TARGET: 10.14 + - name: Strip binary + if: matrix.os != 'windows-latest' + run: strip target/release/stevenarella + - name: Upload binary + uses: actions/upload-artifact@v1 + with: + name: stevenarella-${{ matrix.os }} + path: target/release/stevenarella + - name: Release binary + if: startsWith(github.ref, 'refs/tags/') + uses: softprops/action-gh-release@v1 + with: + files: | + target/release/stevenarella + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 0da8f6e3ba8cb124f216bebd1f3a083ccd0a1153 Mon Sep 17 00:00:00 2001 From: MCOfficer Date: Mon, 29 Jun 2020 10:24:09 +0200 Subject: [PATCH 2/8] Install libxcb-composite0-dev, fix job name --- .github/workflows/build.yaml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 41349f2f..5116f509 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -3,7 +3,7 @@ on: push: jobs: - linux: + build: runs-on: ${{ matrix.os }} strategy: matrix: @@ -25,6 +25,11 @@ jobs: mkdir .cargo echo '[target.x86_64-pc-windows-msvc]' >> .cargo/config echo 'rustflags = ["-Ctarget-feature=+crt-static"]' >> .cargo/config + - name: Install libxcb-composite + if: matrix.os == 'ubuntu-latest' + run: | + sudo apt update + sudo apt install -y libxcb-composite0-dev - name: Build binary run: | cargo build --verbose --release From 0d2ca8e4c0b44f4e8a9ff0696deb4320ce512827 Mon Sep 17 00:00:00 2001 From: MCOfficer Date: Mon, 29 Jun 2020 10:27:16 +0200 Subject: [PATCH 3/8] Use apt-get instead of apt, more descriptive names for os-specific steps --- .github/workflows/build.yaml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 5116f509..cd9984be 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -19,23 +19,23 @@ jobs: with: toolchain: stable default: true - - name: Enable static CRT linkage # https://stackoverflow.com/a/44387312/7653274 + - 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: Install libxcb-composite + - name: (Linux) Install libxcb-composite if: matrix.os == 'ubuntu-latest' run: | - sudo apt update - sudo apt install -y libxcb-composite0-dev + 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: Strip binary + - name: (Linux/MacOS) Strip binary if: matrix.os != 'windows-latest' run: strip target/release/stevenarella - name: Upload binary From 2767e12906ea10f2e69735c4f45a6148edfc5686 Mon Sep 17 00:00:00 2001 From: MCOfficer Date: Mon, 29 Jun 2020 10:46:03 +0200 Subject: [PATCH 4/8] Also match .exe, thanks windows --- .github/workflows/build.yaml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index cd9984be..54ccc721 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -38,16 +38,19 @@ jobs: - name: (Linux/MacOS) Strip binary if: matrix.os != 'windows-latest' run: strip target/release/stevenarella + - name: Remove .d file for globbing + run: rm target/release/stevenarella.d + shell: bash - name: Upload binary uses: actions/upload-artifact@v1 with: name: stevenarella-${{ matrix.os }} - path: target/release/stevenarella + path: target/release/stevenarella* - name: Release binary if: startsWith(github.ref, 'refs/tags/') uses: softprops/action-gh-release@v1 with: files: | - target/release/stevenarella + target/release/stevenarella* env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From f48213e16fa306434199163594068d86aeca4a81 Mon Sep 17 00:00:00 2001 From: MCOfficer Date: Mon, 29 Jun 2020 11:02:33 +0200 Subject: [PATCH 5/8] use upload-artifact v2 --- .github/workflows/build.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 54ccc721..394b17c4 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -42,7 +42,7 @@ jobs: run: rm target/release/stevenarella.d shell: bash - name: Upload binary - uses: actions/upload-artifact@v1 + uses: actions/upload-artifact@v2 with: name: stevenarella-${{ matrix.os }} path: target/release/stevenarella* From 0afdfde514baacd37d2fda8f64bd0cc235ee94ce Mon Sep 17 00:00:00 2001 From: MCOfficer Date: Mon, 29 Jun 2020 16:46:54 +0200 Subject: [PATCH 6/8] Specifically pick out the binary for upload --- .github/workflows/build.yaml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 394b17c4..034f0cae 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -39,18 +39,23 @@ jobs: if: matrix.os != 'windows-latest' run: strip target/release/stevenarella - name: Remove .d file for globbing - run: rm target/release/stevenarella.d + run: | + if [[ ${{ matrix.os }} == windows ]]; then + mv target/release/stevenarella.exe . + else + mv target/release/stevenarella . + fi shell: bash - name: Upload binary uses: actions/upload-artifact@v2 with: name: stevenarella-${{ matrix.os }} - path: target/release/stevenarella* + path: stevenarella* - name: Release binary if: startsWith(github.ref, 'refs/tags/') uses: softprops/action-gh-release@v1 with: files: | - target/release/stevenarella* + stevenarella* env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 704fd2e229dd72002a03984fc7f4636ca07acd2b Mon Sep 17 00:00:00 2001 From: MCOfficer Date: Mon, 29 Jun 2020 17:01:52 +0200 Subject: [PATCH 7/8] Fix step name --- .github/workflows/build.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 034f0cae..38ca3223 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -38,7 +38,7 @@ jobs: - name: (Linux/MacOS) Strip binary if: matrix.os != 'windows-latest' run: strip target/release/stevenarella - - name: Remove .d file for globbing + - name: Move binary run: | if [[ ${{ matrix.os }} == windows ]]; then mv target/release/stevenarella.exe . From 4740bc4631154c7337dc8986cea814e0755c504b Mon Sep 17 00:00:00 2001 From: MCOfficer Date: Tue, 30 Jun 2020 09:31:24 +0200 Subject: [PATCH 8/8] Name binary after target os --- .github/workflows/build.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 38ca3223..53237585 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -41,9 +41,9 @@ jobs: - name: Move binary run: | if [[ ${{ matrix.os }} == windows ]]; then - mv target/release/stevenarella.exe . + mv target/release/stevenarella.exe stevenarella-${{ matrix.os }}.exe else - mv target/release/stevenarella . + mv target/release/stevenarella stevenarella-${{ matrix.os }} fi shell: bash - name: Upload binary