Add gitea CI workflows
Tests / Test on ${{ matrix.build }} (linux-amd64, ubuntu-latest, stable, x86_64-unknown-linux-gnu) (push) Failing after 29s Details

pull/260/head
Manos Pitsidianakis 2023-07-19 17:12:15 +03:00
parent 29b43e2c88
commit bb7e119ade
Signed by: Manos Pitsidianakis
GPG Key ID: 7729C7707F7E09D0
4 changed files with 183 additions and 2 deletions

View File

@ -0,0 +1,82 @@
name: Build release binary
env:
RUST_BACKTRACE: 1
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
on:
workflow_dispatch:
push:
tags:
- v*
jobs:
build:
name: Build on ${{ matrix.build }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
build: [linux-amd64, ]
include:
- build: linux-amd64
os: ubuntu-latest
rust: stable
artifact_name: 'meli-linux-amd64'
target: x86_64-unknown-linux-gnu
steps:
- uses: https://github.com/actions/checkout@v2
- id: os-deps
name: install OS dependencies
run: |
apt-get update
apt-get install -y libdbus-1-dev pkg-config mandoc libssl-dev
- id: cache-rustup
name: Cache Rust toolchain
uses: https://github.com/actions/cache@v3
with:
path: ~/.rustup
key: toolchain-${{ matrix.os }}-${{ matrix.rust }}
- if: ${{ steps.cache-rustup.outputs.cache-hit != 'true' }}
name: Install Rust ${{ matrix.rust }}
uses: https://github.com/actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.rust }}
target: ${{ matrix.target }}
override: true
- name: Configure cargo data directory
# After this point, all cargo registry and crate data is stored in
# $GITHUB_WORKSPACE/.cargo_home. This allows us to cache only the files
# that are needed during the build process. Additionally, this works
# around a bug in the 'cache' action that causes directories outside of
# the workspace dir to be saved/restored incorrectly.
run: echo "CARGO_HOME=$(pwd)/.cargo_home" >> $GITHUB_ENV
- id: cache-cargo
name: Cache cargo configuration and installations
uses: https://github.com/actions/cache@v3
with:
path: ${{ env.CARGO_HOME }}
key: cargo-${{ matrix.os }}-${{ matrix.rust }}
- if: ${{ steps.cache-cargo.outputs.cache-hit != 'true' }} && matrix.target
name: Setup Rust target
run: |
mkdir -p "${{ env.CARGO_HOME }}"
cat << EOF > "${{ env.CARGO_HOME }}"/config.toml
[build]
target = "${{ matrix.target }}"
EOF
- name: Build binary
run: |
make
mkdir artifacts
mv target/*/release/* target/ || true
mv target/release/* target/ || true
mv target/meli artifacts/
- name: Upload Artifacts
uses: https://github.com/actions/upload-artifact@v2
with:
name: ${{ matrix.artifact_name }}
path: artifacts
if-no-files-found: error
retention-days: 1

View File

@ -0,0 +1,98 @@
name: Tests
env:
RUST_BACKTRACE: 1
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
on:
workflow_dispatch:
push:
branches:
- '**'
paths:
- '.gitea/**'
- 'melib/src/**'
- 'melib/Cargo.toml'
- 'meli/src/**'
- 'Cargo.toml'
- 'Cargo.lock'
jobs:
test:
name: Test on ${{ matrix.build }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
build: [linux-amd64, ]
include:
- build: linux-amd64
os: ubuntu-latest
rust: stable
target: x86_64-unknown-linux-gnu
steps:
- uses: https://github.com/actions/checkout@v2
- id: os-deps
name: install OS dependencies
run: |
apt-get update
apt-get install -y libdbus-1-dev pkg-config mandoc libssl-dev
- id: cache-rustup
name: Cache Rust toolchain
uses: https://github.com/actions/cache@v3
with:
path: ~/.rustup
key: toolchain-${{ matrix.os }}-${{ matrix.rust }}
- if: ${{ steps.cache-rustup.outputs.cache-hit != 'true' }}
name: Install Rust ${{ matrix.rust }}
uses: https://github.com/actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.rust }}
components: clippy, rustfmt
target: ${{ matrix.target }}
override: true
- name: Configure cargo data directory
# After this point, all cargo registry and crate data is stored in
# $GITHUB_WORKSPACE/.cargo_home. This allows us to cache only the files
# that are needed during the build process. Additionally, this works
# around a bug in the 'cache' action that causes directories outside of
# the workspace dir to be saved/restored incorrectly.
run: echo "CARGO_HOME=$(pwd)/.cargo_home" >> $GITHUB_ENV
- id: cache-cargo
name: Cache cargo configuration and installations
uses: https://github.com/actions/cache@v3
with:
path: ${{ env.CARGO_HOME }}
key: cargo-${{ matrix.os }}-${{ matrix.rust }}
- if: ${{ steps.cache-cargo.outputs.cache-hit != 'true' }} && matrix.target
name: Setup Rust target
run: |
mkdir -p "${{ env.CARGO_HOME }}"
cat << EOF > "${{ env.CARGO_HOME }}"/config.toml
[build]
target = "${{ matrix.target }}"
EOF
- if: ${{ steps.cache-cargo.outputs.cache-hit != 'true' }} && matrix.target
name: Add lint dependencies
run: |
cargo install --target "${{ matrix.target }}" cargo-sort
- name: cargo-check
run: |
cargo check --all-features --all --tests --examples --benches --bins
- name: cargo test
if: success() || failure() # always run even if other steps fail, except when cancelled <https://stackoverflow.com/questions/58858429/how-to-run-a-github-actions-step-even-if-the-previous-step-fails-while-still-f>
run: |
cargo test --all --no-fail-fast --all-features
- name: cargo-sort
if: success() || failure()
run: |
cargo sort --check
- name: rustfmt
if: success() || failure()
run: |
cargo fmt --check --all
- name: clippy
if: success() || failure()
run: |
cargo clippy --no-deps --all-features --all --tests --examples --benches --bins

View File

@ -157,7 +157,8 @@ pub async fn get_mailboxes(conn: &JmapConnection) -> Result<HashMap<MailboxHash,
)
})
.collect();
for key in ret.keys().cloned().collect::<SmallVec<[MailboxHash; 24]>>() {
let cloned_keys = ret.keys().cloned().collect::<SmallVec<[MailboxHash; 24]>>();
for key in cloned_keys {
if let Some(parent_hash) = ret[&key].parent_hash {
ret.entry(parent_hash).and_modify(|e| e.children.push(key));
}

View File

@ -989,7 +989,7 @@ impl Threads {
)
.unwrap_or_else(|| ThreadNodeHash::from(message_id));
{
let mut node = self.thread_nodes.entry(new_id).or_default();
let node = self.thread_nodes.entry(new_id).or_default();
node.message = Some(env_hash);
if node.parent.is_none() {
node.parent = reply_to_id;