Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI: Use binstall, Always run tests/linux #282

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 14 additions & 5 deletions .github/workflows/release-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@ name: Release binaries for Linux and Docker

on:
push:
branches:
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't like this building / wasting CPU / resources on every single push to random branches

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem with limiting it to branches is now it wont run when others are developing. When you work off a fork you aren't supposed to do any work in main branch so you are supposed to create a feature branch that all your work is in that you then send the PR for. If we limit it to main branch then the new developer wouldn't know that something they changed is affecting the build process until they submit the PR. Ideally they would catch all the locally but then again that would defeat the purpose of the CI to begin with.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry I thought I commented on the test.yaml change. I'll expand in another comment

- main
tags:
- "v*.*.*"

jobs:
build-docker-cross:
Expand All @@ -16,6 +12,7 @@ jobs:
platform: [linux/arm/v7, linux/amd64, linux/arm64]
steps:
- uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
id: builder1
Expand Down Expand Up @@ -94,7 +91,7 @@ jobs:
uses: docker/metadata-action@v5
with:
images: |
ikatson/rqbit
${{ vars.DOCKERHUB_USERNAME }}/rqbit, enable=${{ vars.DOCKERHUB_USERNAME != '' }}
tags: |
type=ref,event=branch
type=semver,pattern={{version}}
Expand All @@ -119,12 +116,24 @@ jobs:
uses: docker/setup-buildx-action@v3

- name: Login to Docker Hub
if: "${{ vars.DOCKERHUB_USERNAME != '' }}"
uses: docker/login-action@v3
with:
username: ${{ vars.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why split this up?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Its only split up since i cant think of an easy way to keep them combined that accomplishes the end goal. I'll play around with this and see if we can keep this as a single piece.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Converting to draft until i can figure out a good way to merge them.

if: "${{ vars.DOCKERHUB_USERNAME == '' }}"
uses: docker/build-push-action@v6
with:
push: false
tags: rqbit:action
platforms: linux/amd64,linux/arm64,linux/arm/v7
context: target/cross/
file: docker/Dockerfile

- name: Build and push
if: "${{ vars.DOCKERHUB_USERNAME != '' }}"
uses: docker/build-push-action@v6
with:
push: true
Expand Down
9 changes: 8 additions & 1 deletion .github/workflows/release-osx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,16 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Install Binstall
uses: cargo-bins/cargo-binstall@main

- name: install Tauri
run: cargo install tauri-cli --profile dev
run: cargo binstall tauri-cli --no-confirm

- name: npm install (desktop)
working-directory: desktop
run: npm install

- name: npm install (librqbit/webui)
working-directory: crates/librqbit/webui
run: npm install
Expand All @@ -28,6 +33,7 @@ jobs:
run:
rustup target add aarch64-apple-darwin && rustup target add x86_64-apple-darwin &&
cargo tauri build --target universal-apple-darwin --ci

- uses: softprops/action-gh-release@v1
with:
generate_release_notes: true
Expand All @@ -42,6 +48,7 @@ jobs:
cargo build --profile release-github --target x86_64-apple-darwin &&
cargo build --profile release-github --target aarch64-apple-darwin &&
lipo ./target/x86_64-apple-darwin/release-github/rqbit ./target/aarch64-apple-darwin/release-github/rqbit -create -output ./target/artifacts/rqbit-osx-universal

- uses: softprops/action-gh-release@v1
with:
generate_release_notes: true
Expand Down
10 changes: 9 additions & 1 deletion .github/workflows/release-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,25 @@ jobs:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4

- name: Install Binstall
uses: cargo-bins/cargo-binstall@main

- name: install Tauri
run: cargo install tauri-cli --profile dev
run: cargo binstall tauri-cli --no-confirm

- name: npm install (desktop)
working-directory: desktop
run: npm install

- name: npm install (librqbit/webui)
working-directory: crates/librqbit/webui
run: npm install

- name: cargo tauri build
working-directory: desktop
run: cargo tauri build --ci

- uses: softprops/action-gh-release@v1
with:
generate_release_notes: true
Expand All @@ -33,6 +40,7 @@ jobs:

- name: Build release
run: cargo build --profile release-github

- uses: softprops/action-gh-release@v1
with:
generate_release_notes: true
Expand Down
12 changes: 10 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@ name: Run tests

on:
push:
branches: [main, dev]
pull_request:
branches: [main]

env:
CARGO_TERM_COLOR: always
Expand All @@ -19,27 +17,37 @@ jobs:
- name: rustup toolchain install ${{ matrix.rust_version }}
run: |
rustup toolchain install ${{ matrix.rust_version }}

- uses: actions/checkout@v4

- run: rustup override set ${{ matrix.rust_version }}

- run: rustup component add rustfmt

- name: cargo check
run: cargo check

- name: cargo fmt --check
run: cargo fmt --check

test:
strategy:
matrix:
os: [windows-latest, macos-latest, ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4

- run: rustup toolchain install stable --profile minimal

- uses: Swatinem/rust-cache@v2
with:
prefix-key: v1

- name: Run tests (whole workspace, including desktop)
if: ${{ matrix.os != 'ubuntu-latest' }}
run: cargo test --workspace

- name: Run tests
if: ${{ matrix.os == 'ubuntu-latest' }}
run: cargo test