From 4177e90225b0132089601619fd2e755b0dee1903 Mon Sep 17 00:00:00 2001 From: Fanda Vacek Date: Fri, 20 Dec 2024 15:36:51 +0100 Subject: [PATCH 1/3] Add windows build --- .github/workflows/rust.yml | 65 ++++++++++++++++++++++---------------- 1 file changed, 37 insertions(+), 28 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index e2e5502..79a8140 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -1,39 +1,48 @@ -name: Rust +name: Rust Build and Artifact Creation on: push: - branches: [ "master" ] + branches: + - main + - win-build pull_request: - branches: [ "master" ] - -env: - CARGO_TERM_COLOR: always - RUSTFLAGS: "-Dwarnings" + branches: + - main + - win-build jobs: build: strategy: matrix: - toolchain: - - channel: stable - cargo_args: --verbose --all-targets - clippy_args: "" - - channel: nightly - cargo_args: --verbose --all-targets --all-features - clippy_args: --allow clippy::needless_lifetimes - - runs-on: ubuntu-latest + os: [ubuntu-latest, windows-latest] + toolchain: [stable, nightly] + include: + - os: ubuntu-latest + target: x86_64-unknown-linux-gnu + - os: windows-latest + target: x86_64-pc-windows-msvc + runs-on: ${{ matrix.os }} steps: - - uses: actions/checkout@v3 - - name: Setup toolchain - run: > - rustup update ${{ matrix.toolchain.channel }} && - rustup default ${{ matrix.toolchain.channel }} && - rustup component add clippy - - name: Clippy - run: cargo clippy ${{ matrix.toolchain.cargo_args }} -- ${{matrix.toolchain.clippy_args}} - - name: Build - run: cargo build ${{ matrix.toolchain.cargo_args }} - - name: Run tests - run: cargo test ${{ matrix.toolchain.cargo_args }} -- --test-threads=1 + - name: Checkout code + uses: actions/checkout@v3 + + - name: Set up Rust + uses: actions-rust-lang/setup-rust-toolchain@v1 + with: + target: ${{ matrix.target }} + toolchain: ${{ matrix.toolchain }} + override: true + + - name: Build and Install Binary + run: | + mkdir -p install_dir + cargo install --path . --root install_dir --target ${{ matrix.target }} + ls -l install_dir/bin + shell: bash + + - name: Upload Artifact + uses: actions/upload-artifact@v4 + with: + name: ${{ matrix.os }}-${{ matrix.toolchain }}-binary + path: install_dir/bin From e6e7e923f3935eb98cf2089bffcc6c9aa198b524 Mon Sep 17 00:00:00 2001 From: Fanda Vacek Date: Sat, 21 Dec 2024 21:48:07 +0100 Subject: [PATCH 2/3] CI: Replace relative project path with absolute one MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Václav Kubernát --- .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 79a8140..9f4f80b 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -37,7 +37,7 @@ jobs: - name: Build and Install Binary run: | mkdir -p install_dir - cargo install --path . --root install_dir --target ${{ matrix.target }} + cargo install --path ${{github.workspace}} --root install_dir --target ${{ matrix.target }} ls -l install_dir/bin shell: bash From ef5e411d95ce5cd0da2f0e94fd95380283865db9 Mon Sep 17 00:00:00 2001 From: Fanda Vacek Date: Sun, 22 Dec 2024 19:43:00 +0100 Subject: [PATCH 3/3] Make install dir absolute --- .github/workflows/rust.yml | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 9f4f80b..b1bbc4d 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -3,12 +3,10 @@ name: Rust Build and Artifact Creation on: push: branches: - - main - - win-build + - master pull_request: branches: - - main - - win-build + - master jobs: build: @@ -36,13 +34,12 @@ jobs: - name: Build and Install Binary run: | - mkdir -p install_dir - cargo install --path ${{github.workspace}} --root install_dir --target ${{ matrix.target }} - ls -l install_dir/bin + mkdir -p ${{github.workspace}}/install + cargo install --path '${{github.workspace}}' --root '${{github.workspace}}/install' --target ${{ matrix.target }} shell: bash - name: Upload Artifact uses: actions/upload-artifact@v4 with: name: ${{ matrix.os }}-${{ matrix.toolchain }}-binary - path: install_dir/bin + path: ${{github.workspace}}/install/bin