Merge pull request #505 from vbrandl/ci-changes
All checks were successful
continuous-integration/drone/push Build is passing

CI changes
This commit is contained in:
Valentin Brandl 2022-10-11 10:45:13 +02:00 committed by GitHub
commit dc8afc0a52
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 63 additions and 52 deletions

View File

@ -8,3 +8,5 @@ updates:
open-pull-requests-limit: 10 open-pull-requests-limit: 10
assignees: assignees:
- vbrandl - vbrandl
labels:
- dependencies

View File

@ -3,26 +3,19 @@ on:
schedule: schedule:
- cron: '0 1 * * *' - cron: '0 1 * * *'
push: push:
branches:
- master
pull_request:
paths: paths:
- '**/Cargo.toml' - '**/Cargo.toml'
- '**/Cargo.lock' - '**/Cargo.lock'
pull_request: - ".cargo/audit.toml"
jobs: jobs:
security_audit: security_audit:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
- name: Cache cargo registry, index and build directory
uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
./target
key: audit-${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- uses: actions-rs/audit-check@v1 - uses: actions-rs/audit-check@v1
with: with:
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}

View File

@ -6,8 +6,12 @@ on:
- 'v[0-9]+.[0-9]+.[0-9]+' - 'v[0-9]+.[0-9]+.[0-9]+'
jobs: jobs:
tests:
uses: vbrandl/hoc/.github/workflows/rust.yml@master
publish: publish:
name: Publishing for ${{ matrix.os }} name: Publishing for ${{ matrix.os }}
needs: [tests]
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
strategy: strategy:
matrix: matrix:
@ -29,7 +33,7 @@ jobs:
steps: steps:
- name: Checkout sources - name: Checkout sources
uses: actions/checkout@v2 uses: actions/checkout@v3
- name: Install stable toolchain - name: Install stable toolchain
uses: actions-rs/toolchain@v1 uses: actions-rs/toolchain@v1
@ -44,10 +48,10 @@ jobs:
~/.cargo/registry ~/.cargo/registry
~/.cargo/git ~/.cargo/git
./target ./target
key: release-${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Cargo build - name: Cargo build
uses: actions-rs/cargo@v1 uses: actions-rs/cargo@v3
with: with:
command: build command: build
toolchain: ${{ matrix.rust }} toolchain: ${{ matrix.rust }}
@ -74,3 +78,14 @@ jobs:
target/${{ matrix.target }}/release/hoc-${{ matrix.artifact_prefix }}.sha256 target/${{ matrix.target }}/release/hoc-${{ matrix.artifact_prefix }}.sha256
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
changelog:
name: Update Changelog
needs: [tests]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: taiki-e/create-gh-release-action@v1
with:
changelog: CHANGELOG.md
token: ${{ secrets.GITHUB_TOKEN }}

View File

@ -1,13 +1,19 @@
on: [push, pull_request] on:
workflow_call:
push:
branches:
- master
pull_request:
schedule:
- cron: "0 0 * * *"
jobs: jobs:
rustfmt: rustfmt:
name: Rustfmt name: Rustfmt
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout sources - name: Checkout sources
uses: actions/checkout@v2 uses: actions/checkout@v3
- name: Install stable toolchain - name: Install stable toolchain
uses: actions-rs/toolchain@v1 uses: actions-rs/toolchain@v1
@ -17,15 +23,6 @@ jobs:
override: true override: true
components: rustfmt components: rustfmt
- name: Cache cargo registry, index and build directory
uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
./target
key: rustfmt-${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Check Formatting - name: Check Formatting
uses: actions-rs/cargo@v1 uses: actions-rs/cargo@v1
with: with:
@ -37,7 +34,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout sources - name: Checkout sources
uses: actions/checkout@v2 uses: actions/checkout@v3
- name: Install stable toolchain - name: Install stable toolchain
uses: actions-rs/toolchain@v1 uses: actions-rs/toolchain@v1
@ -48,13 +45,13 @@ jobs:
components: rustfmt components: rustfmt
- name: Cache cargo registry, index and build directory - name: Cache cargo registry, index and build directory
uses: actions/cache@v2 uses: actions/cache@v3
with: with:
path: | path: |
~/.cargo/registry ~/.cargo/registry
~/.cargo/git ~/.cargo/git
./target ./target
key: clippy-${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Clippy Linting - name: Clippy Linting
uses: actions-rs/cargo@v1 uses: actions-rs/cargo@v1
@ -74,7 +71,7 @@ jobs:
steps: steps:
- name: Checkout sources - name: Checkout sources
uses: actions/checkout@v2 uses: actions/checkout@v3
- name: Install stable toolchain - name: Install stable toolchain
uses: actions-rs/toolchain@v1 uses: actions-rs/toolchain@v1
@ -84,13 +81,13 @@ jobs:
override: true override: true
- name: Cache cargo registry, index and build directory - name: Cache cargo registry, index and build directory
uses: actions/cache@v2 uses: actions/cache@v3
with: with:
path: | path: |
~/.cargo/registry ~/.cargo/registry
~/.cargo/git ~/.cargo/git
./target ./target
key: test-${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Run Tests - name: Run Tests
uses: actions-rs/cargo@v1 uses: actions-rs/cargo@v1

View File

@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed ### Changed
* Updated [`tracing-subscriber`](https://github.com/tokio-rs/tracing) from 0.3.15 to 0.3.16 ([#501])
* Updated [`tracing`](https://github.com/tokio-rs/tracing) from 0.1.36 to 0.1.37 ([#502])
* Updated [`serde_json`](https://github.com/serde-rs/json) from 1.0.85 to 1.0.86 ([#503])
* Updated [`tracing-bunyan-formatter`](https://github.com/LukeMathWalker/tracing-bunyan-formatter) from 0.3.3 to 0.3.4 ([#504]) * Updated [`tracing-bunyan-formatter`](https://github.com/LukeMathWalker/tracing-bunyan-formatter) from 0.3.3 to 0.3.4 ([#504])
[#501]: https://github.com/vbrandl/hoc/pull/501
[#502]: https://github.com/vbrandl/hoc/pull/502
[#503]: https://github.com/vbrandl/hoc/pull/503
[#504]: https://github.com/vbrandl/hoc/pull/504 [#504]: https://github.com/vbrandl/hoc/pull/504

View File

@ -14,8 +14,9 @@ lazy_static::lazy_static! {
pub struct TestApp { pub struct TestApp {
pub address: String, pub address: String,
repo_dir: TempDir, // Those are unused but are hold to be dropped and deleted after the TestApp goes out of scope
cache_dir: TempDir, _repo_dir: TempDir,
_cache_dir: TempDir,
} }
pub async fn spawn_app() -> TestApp { pub async fn spawn_app() -> TestApp {
@ -26,15 +27,12 @@ pub async fn spawn_app() -> TestApp {
let port = listener.local_addr().unwrap().port(); let port = listener.local_addr().unwrap().port();
let address = format!("http://127.0.0.1:{}", port); let address = format!("http://127.0.0.1:{}", port);
let repo_dir = tempdir().expect("Cannot create repo_dir"); let _repo_dir = tempdir().expect("Cannot create repo_dir");
let cache_dir = tempdir().expect("Cannot create cache_dir"); let _cache_dir = tempdir().expect("Cannot create cache_dir");
let mut settings = Settings::load().expect("Failed to read configuration."); let mut settings = Settings::load().expect("Failed to read configuration.");
settings.repodir = repo_dir.path().to_path_buf(); settings.repodir = _repo_dir.path().to_path_buf();
settings.cachedir = cache_dir.path().to_path_buf(); settings.cachedir = _cache_dir.path().to_path_buf();
// configuration.database.database_name = Uuid::new_v4().to_string();
// let connection_pool = configure_database(&configuration.database).await;
let server = hoc::run(listener, settings) let server = hoc::run(listener, settings)
.await .await
@ -44,7 +42,7 @@ pub async fn spawn_app() -> TestApp {
TestApp { TestApp {
address, address,
repo_dir, _repo_dir,
cache_dir, _cache_dir,
} }
} }