diff options
author | BlackDex <[email protected]> | 2021-05-08 16:48:48 +0200 |
---|---|---|
committer | BlackDex <[email protected]> | 2021-05-08 16:48:48 +0200 |
commit | 565439a91414f3fc775364d46c8f848cecd096bc (patch) | |
tree | 273d34521fcd6be8502a96a6a8ba28a7291697de /.github/workflows | |
parent | b8010be26b4e2d489f55ba01622f9b6e1685b3b1 (diff) | |
download | vaultwarden-565439a91414f3fc775364d46c8f848cecd096bc.tar.gz vaultwarden-565439a91414f3fc775364d46c8f848cecd096bc.zip |
Updated Pipelines and fixed new Hadolints
- Removed azure-pipelines
- Updated gh-actions to run `cargo test` per db feature
- Fail on warnings by adding `RUSTFLAGS` env
- Updated Dockerfile to fix some new hadolint warnings
Diffstat (limited to '.github/workflows')
-rw-r--r-- | .github/workflows/build.yml | 59 | ||||
-rw-r--r-- | .github/workflows/hadolint.yml | 2 |
2 files changed, 38 insertions, 23 deletions
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index bcb16381..151b0d54 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -5,8 +5,8 @@ on: pull_request: # Ignore when there are only changes done too one of these paths paths-ignore: - - "**.md" - - "**.txt" + - "*.md" + - "*.txt" - ".dockerignore" - ".env.template" - ".gitattributes" @@ -20,6 +20,10 @@ on: jobs: build: + # Make warnings errors, this is to prevent warnings slipping through. + # This is done globally to prevent rebuilds when the RUSTFLAGS env variable changes. + env: + RUSTFLAGS: "-D warnings" strategy: fail-fast: false matrix: @@ -32,7 +36,7 @@ jobs: include: - target-triple: x86_64-unknown-linux-gnu host-triple: x86_64-unknown-linux-gnu - features: "sqlite,mysql,postgresql" + features: [sqlite,mysql,postgresql] # Remember to update the `cargo test` to match the amount of features channel: nightly os: ubuntu-18.04 ext: @@ -42,18 +46,6 @@ jobs: # channel: stable # os: ubuntu-18.04 # ext: - # - target-triple: x86_64-unknown-linux-musl - # host-triple: x86_64-unknown-linux-gnu - # features: "sqlite,postgresql" - # channel: nightly - # os: ubuntu-18.04 - # ext: - # - target-triple: x86_64-unknown-linux-musl - # host-triple: x86_64-unknown-linux-gnu - # features: "sqlite,postgresql" - # channel: stable - # os: ubuntu-18.04 - # ext: name: Building ${{ matrix.channel }}-${{ matrix.target-triple }} runs-on: ${{ matrix.os }} @@ -94,20 +86,43 @@ jobs: # Run cargo tests (In release mode to speed up future builds) - - name: '`cargo test --release --features ${{ matrix.features }} --target ${{ matrix.target-triple }}`' + # First test all features together, afterwards test them separately. + - name: "`cargo test --release --features ${{ join(matrix.features, ',') }} --target ${{ matrix.target-triple }}`" + uses: actions-rs/cargo@v1 + with: + command: test + args: --release --features ${{ join(matrix.features, ',') }} --target ${{ matrix.target-triple }} + # Test single features + # 0: sqlite + - name: "`cargo test --release --features ${{ matrix.features[0] }} --target ${{ matrix.target-triple }}`" + uses: actions-rs/cargo@v1 + with: + command: test + args: --release --features ${{ matrix.features[0] }} --target ${{ matrix.target-triple }} + if: ${{ matrix.features[0] != '' }} + # 1: mysql + - name: "`cargo test --release --features ${{ matrix.features[1] }} --target ${{ matrix.target-triple }}`" + uses: actions-rs/cargo@v1 + with: + command: test + args: --release --features ${{ matrix.features[1] }} --target ${{ matrix.target-triple }} + if: ${{ matrix.features[1] != '' }} + # 2: postgresql + - name: "`cargo test --release --features ${{ matrix.features[2] }} --target ${{ matrix.target-triple }}`" uses: actions-rs/cargo@v1 with: command: test - args: --release --features ${{ matrix.features }} --target ${{ matrix.target-triple }} + args: --release --features ${{ matrix.features[2] }} --target ${{ matrix.target-triple }} + if: ${{ matrix.features[2] != '' }} # End Run cargo tests - # Run cargo clippy (In release mode to speed up future builds) - - name: '`cargo clippy --release --features ${{ matrix.features }} --target ${{ matrix.target-triple }}`' + # Run cargo clippy, and fail on warnings (In release mode to speed up future builds) + - name: "`cargo clippy --release --features ${{ join(matrix.features, ',') }} --target ${{ matrix.target-triple }}`" uses: actions-rs/cargo@v1 with: command: clippy - args: --release --features ${{ matrix.features }} --target ${{ matrix.target-triple }} + args: --release --features ${{ join(matrix.features, ',') }} --target ${{ matrix.target-triple }} -- -D warnings # End Run cargo clippy @@ -121,11 +136,11 @@ jobs: # Build the binary - - name: '`cargo build --release --features ${{ matrix.features }} --target ${{ matrix.target-triple }}`' + - name: "`cargo build --release --features ${{ join(matrix.features, ',') }} --target ${{ matrix.target-triple }}`" uses: actions-rs/cargo@v1 with: command: build - args: --release --features ${{ matrix.features }} --target ${{ matrix.target-triple }} + args: --release --features ${{ join(matrix.features, ',') }} --target ${{ matrix.target-triple }} # End Build the binary diff --git a/.github/workflows/hadolint.yml b/.github/workflows/hadolint.yml index f2cd9732..76ab9454 100644 --- a/.github/workflows/hadolint.yml +++ b/.github/workflows/hadolint.yml @@ -25,7 +25,7 @@ jobs: sudo curl -L https://github.com/hadolint/hadolint/releases/download/v$HADOLINT_VERSION/hadolint-$(uname -s)-$(uname -m) -o /usr/local/bin/hadolint && \ sudo chmod +x /usr/local/bin/hadolint env: - HADOLINT_VERSION: 2.0.0 + HADOLINT_VERSION: 2.3.0 # End Download hadolint # Test Dockerfiles |