Skip to content

Commit a9b43f8

Browse files
committed
dev: update deployment scripts
1 parent 0c17e9e commit a9b43f8

File tree

6 files changed

+96
-64
lines changed

6 files changed

+96
-64
lines changed

.github/workflows/container.yaml

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,11 @@ name: Container
22

33
on:
44
push:
5-
tags-ignore:
6-
- "!v*"
5+
branches:
6+
- "develop"
7+
- "main"
8+
tags:
9+
- "v*"
710
pull_request:
811
branches:
912
- "develop"
@@ -17,6 +20,10 @@ jobs:
1720
name: Test (Docker)
1821
runs-on: ubuntu-latest
1922

23+
strategy:
24+
matrix:
25+
target: [debug, release]
26+
2027
steps:
2128
- id: setup
2229
name: Setup Toolchain
@@ -29,9 +36,10 @@ jobs:
2936
file: ./Containerfile
3037
push: false
3138
load: true
39+
target: ${{ matrix.target }}
3240
tags: torrust-tracker:local
3341
cache-from: type=gha
34-
cache-to: type=gha,mode=max
42+
cache-to: type=gha
3543

3644
- id: inspect
3745
name: Inspect
@@ -122,4 +130,4 @@ jobs:
122130
tags: ${{ steps.meta.outputs.tags }}
123131
labels: ${{ steps.meta.outputs.labels }}
124132
cache-from: type=gha
125-
cache-to: type=gha,mode=max
133+
cache-to: type=gha

.github/workflows/coverage.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ jobs:
5454
name: Upload Coverage Report
5555
uses: codecov/codecov-action@v3
5656
with:
57-
token: ${{ secrets.CODECOV_TOKEN }}
5857
files: ${{ steps.coverage.outputs.report }}
5958
verbose: true
6059
fail_ci_if_error: true

.github/workflows/deployment.yaml

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
name: Deployment
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
8+
jobs:
9+
secrets:
10+
name: Secrets
11+
needs: context
12+
environment: dockerhub-torrust
13+
if: needs.context.outputs.continue == 'true'
14+
runs-on: ubuntu-latest
15+
16+
outputs:
17+
continue: ${{ steps.check.outputs.continue }}
18+
19+
steps:
20+
- id: check
21+
name: Check
22+
env:
23+
CRATES_TOKEN: "${{ secrets.CRATES_TOKEN }}"
24+
if: "${{ env.CRATES_TOKEN != '' }}"
25+
run: echo "continue=true" >> $GITHUB_OUTPUT
26+
27+
test:
28+
name: Test
29+
needs: secrets
30+
if: needs.secrets.outputs.continue == 'true'
31+
runs-on: ubuntu-latest
32+
33+
strategy:
34+
matrix:
35+
toolchain: [stable, nightly]
36+
37+
steps:
38+
- id: checkout
39+
name: Checkout Repository
40+
uses: actions/checkout@v3
41+
42+
- id: setup
43+
name: Setup Toolchain
44+
uses: dtolnay/rust-toolchain@stable
45+
with:
46+
toolchain: ${{ matrix.toolchain }}
47+
48+
- id: test
49+
name: Run Unit Tests
50+
run: cargo test --tests --benches --examples --workspace --all-targets --all-features
51+
52+
publish:
53+
name: Publish
54+
environment: crates-io-torrust
55+
needs: test
56+
if: needs.secrets.outputs.continue == 'true'
57+
runs-on: ubuntu-latest
58+
59+
steps:
60+
- id: checkout
61+
name: Checkout Repository
62+
uses: actions/checkout@v3
63+
64+
- id: setup
65+
name: Setup Toolchain
66+
uses: dtolnay/rust-toolchain@stable
67+
with:
68+
toolchain: stable
69+
70+
env:
71+
CARGO_REGISTRY_TOKEN: ${{ secrets.CRATES_TOKEN }}
72+
73+
- id: publish
74+
name: Publish Crates
75+
run: |
76+
cargo publish -p torrust-tracker-contrib-bencode
77+
cargo publish -p torrust-tracker-located-error
78+
cargo publish -p torrust-tracker-primitives
79+
cargo publish -p torrust-tracker-configuration
80+
cargo publish -p torrust-tracker-test-helpers
81+
cargo publish -p torrust-tracker

.github/workflows/publish_crate.yml

Lines changed: 0 additions & 57 deletions
This file was deleted.

.github/workflows/testing.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ jobs:
5050
name: Setup Toolchain
5151
uses: dtolnay/rust-toolchain@stable
5252
with:
53-
toolchain: nightly
53+
toolchain: ${{ matrix.toolchain }}
5454
components: clippy
5555

5656
- id: cache

cSpell.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
"curr",
3434
"Cyberneering",
3535
"datetime",
36+
"Dijke",
3637
"distroless",
3738
"dockerhub",
3839
"downloadedi",
@@ -133,4 +134,4 @@
133134
"shellscript",
134135
"toml"
135136
]
136-
}
137+
}

0 commit comments

Comments
 (0)