Skip to content

Commit

Permalink
Fix workflow (#26)
Browse files Browse the repository at this point in the history
* Use checkout@v4

* Don't use cargo@v1

* Update docker actions
  • Loading branch information
OlivierHecart authored Dec 18, 2023
1 parent 5f962f0 commit 636a033
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 66 deletions.
27 changes: 6 additions & 21 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,39 +32,24 @@ jobs:
os: [ubuntu-latest, macOS-latest] # Note: windows not supported because of cyclocut not ported

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Install Rust toolchain
run: |
rustup show
rustup component add rustfmt clippy
- name: Code format check
uses: actions-rs/cargo@v1
with:
command: fmt
args: -- --check
run: cargo fmt --check

- name: Clippy
uses: actions-rs/cargo@v1
with:
command: clippy
args: --all --examples -- -D warnings
run: cargo clippy --all --examples -- -D warnings

- name: Build zenoh-plugin-mqtt
uses: actions-rs/cargo@v1
with:
command: build
args: -p zenoh-plugin-mqtt --verbose --all-targets
run: cargo build -p zenoh-plugin-mqtt --verbose --all-targets

- name: Build zenoh-bridge-mqtt
uses: actions-rs/cargo@v1
with:
command: build
args: -p zenoh-bridge-mqtt --verbose --all-targets
run: cargo build -p zenoh-bridge-mqtt --verbose --all-targets

- name: Run tests
uses: actions-rs/cargo@v1
with:
command: test
args: --verbose
run: cargo test --verbose
92 changes: 47 additions & 45 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,21 +27,15 @@ jobs:
name: Code checks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Install Rust toolchain
run: |
rustup show
rustup component add rustfmt clippy
- name: Code format check
uses: actions-rs/cargo@v1
with:
command: fmt
args: -- --check
run: cargo fmt --check
- name: Clippy check
uses: actions-rs/cargo@v1
with:
command: clippy
args: --all -- -D warnings
run: cargo clippy --all -- -D warnings
- name: Environment setup
id: env
shell: bash
Expand Down Expand Up @@ -93,49 +87,69 @@ jobs:
fail-fast: false
matrix:
job:
- { target: x86_64-unknown-linux-gnu, arch: amd64, os: ubuntu-20.04 }
- { target: x86_64-apple-darwin, arch: darwin, os: macos-latest }
- {
target: x86_64-unknown-linux-gnu,
arch: amd64,
os: ubuntu-20.04,
build-cmd: "cargo",
}
- {
target: x86_64-apple-darwin,
arch: darwin,
os: macos-latest,
build-cmd: "cargo",
}
- {
target: x86_64-unknown-linux-musl,
arch: amd64,
os: ubuntu-20.04,
use-cross: true,
build-cmd: "cross",
}
- {
target: arm-unknown-linux-gnueabi,
arch: armel,
os: ubuntu-20.04,
use-cross: true,
build-cmd: "cross",
}
- {
target: arm-unknown-linux-gnueabihf,
arch: armhf,
os: ubuntu-20.04,
use-cross: true,
build-cmd: "cross",
}
- {
target: armv7-unknown-linux-gnueabihf,
arch: armhf,
os: ubuntu-20.04,
use-cross: true,
build-cmd: "cross",
}
- {
target: aarch64-unknown-linux-gnu,
arch: arm64,
os: ubuntu-20.04,
use-cross: true,
build-cmd: "cross",
}
- {
target: aarch64-unknown-linux-musl,
arch: arm64,
os: ubuntu-20.04,
use-cross: true,
build-cmd: "cross",
}
- {
target: x86_64-pc-windows-msvc,
arch: win64,
os: windows-2019,
build-cmd: "cargo",
}
- {
target: x86_64-pc-windows-gnu,
arch: win64,
os: windows-2019,
build-cmd: "cargo",
}
- { target: x86_64-pc-windows-msvc, arch: win64, os: windows-2019 }
- { target: x86_64-pc-windows-gnu , arch: win64 , os: windows-2019 }
steps:
- name: Checkout source code
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
fetch-depth: 500 # NOTE: get long history for git-version crate to correctly compute a version
- name: Fetch Git tags # NOTE: workaround for https://github.com/actions/checkout/issues/290
Expand Down Expand Up @@ -163,39 +177,27 @@ jobs:
;;
esac
cargo install cross --git https://github.com/cross-rs/cross
- name: Install Rust toolchain
run: |
rustup show
rustup target add ${{ matrix.job.target }}
- name: zenoh-plugin-mqtt > Build
uses: actions-rs/cargo@v1
with:
use-cross: ${{ matrix.job.use-cross }}
command: build
args: --release --target=${{ matrix.job.target }} -p zenoh-plugin-mqtt
run: ${{ matrix.job.build-cmd }} build --release --target=${{ matrix.job.target }} -p zenoh-plugin-mqtt

- name: zenoh-bridge-mqtt > Build
uses: actions-rs/cargo@v1
with:
use-cross: ${{ matrix.job.use-cross }}
command: build
args: --release --target=${{ matrix.job.target }} -p zenoh-bridge-mqtt
run: ${{ matrix.job.build-cmd }} build --release --target=${{ matrix.job.target }} -p zenoh-bridge-mqtt

- name: zenoh-plugin-mqtt > Debian package
if: contains(matrix.job.target, '-linux-gnu')
uses: actions-rs/cargo@v1
with:
command: deb
args: --no-build --target=${{ matrix.job.target }} -p zenoh-plugin-mqtt
run: cargo deb --no-build --target=${{ matrix.job.target }} -p zenoh-plugin-mqtt

- name: zenoh-bridge-mqtt > Debian package
if: contains(matrix.job.target, '-linux-gnu')
uses: actions-rs/cargo@v1
with:
command: deb
args: --no-build --target=${{ matrix.job.target }} -p zenoh-bridge-mqtt

run: cargo deb --no-build --target=${{ matrix.job.target }} -p zenoh-bridge-mqtt

- name: Packaging
id: package
shell: bash
Expand Down Expand Up @@ -261,7 +263,7 @@ jobs:
needs: [checks, builds]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
fetch-depth: 500 # NOTE: get long history for git-version crate to correctly compute a version
- name: Fetch Git tags # NOTE: workaround for https://github.com/actions/checkout/issues/290
Expand All @@ -280,19 +282,19 @@ jobs:
unzip PACKAGES/aarch64-unknown-linux-musl/zenoh-bridge-mqtt-${{ needs.checks.outputs.PKG_VERSION }}-aarch64-unknown-linux-musl.zip -d docker/linux/arm64/
tree docker
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
uses: docker/setup-buildx-action@v3
- name: Docker meta - set tags and labels
id: meta
uses: docker/metadata-action@v3
uses: docker/metadata-action@v5
with:
images: eclipse/zenoh-bridge-mqtt
- name: Login to DockerHub
uses: docker/login-action@v1
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_COM_USERNAME }}
password: ${{ secrets.DOCKER_COM_PASSWORD }}
- name: Build and push
uses: docker/build-push-action@v2
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64,linux/arm64
Expand Down Expand Up @@ -338,7 +340,7 @@ jobs:
scp -o "StrictHostKeyChecking=no" -r * ${SSH_TARGET}:${DOWNLOAD_DIR}/
echo "---- cleanup identity"
ssh-add -D
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Install Rust toolchain
run: rustup show
- name: Publish to crates.io
Expand Down

0 comments on commit 636a033

Please sign in to comment.