Skip to content

Commit

Permalink
dev: update deployment scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
da2ce7 committed Sep 6, 2023
1 parent 39fd63d commit 5160632
Show file tree
Hide file tree
Showing 6 changed files with 96 additions and 65 deletions.
16 changes: 12 additions & 4 deletions .github/workflows/container.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@ name: Container

on:
push:
tags-ignore:
- "!v*"
branches:
- "develop"
- "main"
tags:
- "v*"
pull_request:
branches:
- "develop"
Expand All @@ -17,6 +20,10 @@ jobs:
name: Test (Docker)
runs-on: ubuntu-latest

strategy:
matrix:
target: [debug, release]

steps:
- id: setup
name: Setup Toolchain
Expand All @@ -29,9 +36,10 @@ jobs:
file: ./Containerfile
push: false
load: true
target: ${{ matrix.target }}
tags: torrust-tracker:local
cache-from: type=gha
cache-to: type=gha,mode=max
cache-to: type=gha

- id: inspect
name: Inspect
Expand Down Expand Up @@ -122,4 +130,4 @@ jobs:
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
cache-to: type=gha
81 changes: 81 additions & 0 deletions .github/workflows/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name: Deployment

on:
push:
tags:
- "v*"

jobs:
secrets:
name: Secrets
needs: context
environment: dockerhub-torrust
if: needs.context.outputs.continue == 'true'
runs-on: ubuntu-latest

outputs:
continue: ${{ steps.check.outputs.continue }}

steps:
- id: check
name: Check
env:
CRATES_TOKEN: "${{ secrets.CRATES_TOKEN }}"
if: "${{ env.CRATES_TOKEN != '' }}"
run: echo "continue=true" >> $GITHUB_OUTPUT

test:
name: Test
needs: secrets
if: needs.secrets.outputs.continue == 'true'
runs-on: ubuntu-latest

strategy:
matrix:
toolchain: [stable, nightly]

steps:
- id: checkout
name: Checkout Repository
uses: actions/checkout@v3

- id: setup
name: Setup Toolchain
uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ matrix.toolchain }}

- id: test
name: Run Unit Tests
run: cargo test --tests --benches --examples --workspace --all-targets --all-features

publish:
name: Publish
environment: crates-io-torrust
needs: test
if: needs.secrets.outputs.continue == 'true'
runs-on: ubuntu-latest

steps:
- id: checkout
name: Checkout Repository
uses: actions/checkout@v3

- id: setup
name: Setup Toolchain
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable

env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CRATES_TOKEN }}

- id: publish
name: Publish Crates
run: |
cargo publish -p torrust-tracker-contrib-bencode
cargo publish -p torrust-tracker-located-error
cargo publish -p torrust-tracker-primitives
cargo publish -p torrust-tracker-configuration
cargo publish -p torrust-tracker-test-helpers
cargo publish -p torrust-tracker
57 changes: 0 additions & 57 deletions .github/workflows/publish_crate.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/testing.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:
name: Setup Toolchain
uses: dtolnay/rust-toolchain@stable
with:
toolchain: nightly
toolchain: ${{ matrix.toolchain }}
components: clippy

- id: cache
Expand Down
3 changes: 2 additions & 1 deletion cSpell.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"curr",
"Cyberneering",
"datetime",
"Dijke",
"distroless",
"dockerhub",
"downloadedi",
Expand Down Expand Up @@ -133,4 +134,4 @@
"shellscript",
"toml"
]
}
}
2 changes: 0 additions & 2 deletions contrib/bencode/src/reference/decode.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#![allow(clippy::should_panic_without_expect)]

use std::collections::btree_map::Entry;
use std::collections::BTreeMap;
use std::str::{self};
Expand Down

0 comments on commit 5160632

Please sign in to comment.