Skip to content

Commit b2b8309

Browse files
authored
fix cicd (#36)
* run clippy workflow on dev branch * cicd wip * cicd wip * cicd wip * cicd wip * cicd wip * cicd wip * cicd wip * cicd wip * cicd wip * cicd wip * cicd wip * cicd wip * cicd wip * cicd wip * cicd wip * cicd wip * cicd wip * cicd wip * cicd wip * cicd wip * cicd wip * cicd wip * cicd wip * cicd wip * cicd wip * cicd wip * cicd wip * cicd wip * cicd wip * cicd wip * cicd wip * cicd wip * cicd wip * cicd wip * cicd wip * cicd wip * cicd wip * cicd wip * cicd wip * cicd wip * cicd wip * cicd wip * cicd wip * cicd wip * cicd wip * cicd wip * cicd wip * cicd wip
1 parent f8ea394 commit b2b8309

File tree

5 files changed

+80
-23
lines changed

5 files changed

+80
-23
lines changed

.github/workflows/rtabby.yml renamed to .github/workflows/rust-build.yml

Lines changed: 64 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
name: rTabby
1+
name: rust-build
22

33
on:
44
push:
5-
branches: [ "master" ]
6-
tags: [ 'v*.*.*' ]
5+
branches: [ "master", "dev" ]
76
pull_request:
8-
branches: [ "master" ]
7+
branches: [ "master", "dev" ]
98
release:
109
types: [published]
1110

@@ -19,19 +18,58 @@ env:
1918
jobs:
2019
build:
2120
name: Rust Build
22-
runs-on: ubuntu-latest
21+
strategy:
22+
matrix:
23+
arch: [amd64, arm64]
24+
db: [mysql, sqlite]
25+
login: [local-users, oauth]
26+
include:
27+
#runson
28+
- arch: 'amd64'
29+
runson: 'ubuntu-22.04'
30+
- arch: 'arm64'
31+
runson: 'ubuntu-22.04-arm'
32+
# minimal build
33+
- login: 'local-users'
34+
minimal: true
35+
feature: ''
36+
- login: 'oauth'
37+
minimal: false
38+
feature: '-F all-login'
39+
40+
permissions:
41+
contents: read
42+
43+
runs-on: ${{ matrix.runson }}
2344
steps:
24-
- uses: actions/checkout@v3
45+
- uses: actions/checkout@v4
46+
47+
- name: Install mysql build dependencies
48+
if: ${{ matrix.db == 'mysql' }}
49+
run: sudo apt install libtirpc-dev
50+
2551
- name: Build
26-
run: cargo build --verbose
27-
- name: Run tests
28-
run: cargo test --verbose
52+
run: cargo build --verbose --release --target-dir ci-build --no-default-features -F ${{ matrix.db }}-bundle ${{ matrix.feature }}
53+
54+
- name: Upload build binary
55+
uses: actions/upload-artifact@v4
56+
with:
57+
name: ${{ matrix.arch }}-${{ matrix.db }}-${{ matrix.login }}-rtabby-web-api
58+
path: ci-build/release/rtabby-web-api
2959

3060
docker:
3161
strategy:
3262
matrix:
3363
db: [mysql, sqlite]
34-
minimal: [true, false]
64+
login: [local-users, oauth]
65+
include:
66+
# minimal build
67+
- login: 'local-users'
68+
minimal: true
69+
feature: ''
70+
- login: 'oauth'
71+
minimal: false
72+
feature: '-F all-login'
3573
name: Docker
3674
if: ${{ always() && contains(join(needs.*.result, ','), 'success') }}
3775
needs: [build]
@@ -47,13 +85,23 @@ jobs:
4785
- name: Checkout repository
4886
uses: actions/checkout@v3
4987

88+
- name: Download amd64 binary
89+
uses: actions/download-artifact@v4
90+
with:
91+
name: amd64-${{ matrix.db }}-${{ matrix.login }}-rtabby-web-api
92+
path: binary/linux/amd64/rtabby-web-api
93+
94+
- name: Download arm64 binary
95+
uses: actions/download-artifact@v4
96+
with:
97+
name: arm64-${{ matrix.db }}-${{ matrix.login }}-rtabby-web-api
98+
path: binary/linux/arm64/rtabby-web-api
99+
50100
# Install the cosign tool except on PR
51101
# https://github.com/sigstore/cosign-installer
52102
- name: Install cosign
53103
if: ${{ github.event_name == 'release' }}
54-
uses: sigstore/[email protected]
55-
with:
56-
cosign-release: 'v2.2.4'
104+
uses: sigstore/[email protected]
57105

58106
- name: Set up QEMU
59107
if: ${{ github.event_name == 'release' }}
@@ -113,7 +161,8 @@ jobs:
113161
uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 # v5.0.0
114162
with:
115163
context: .
116-
platforms: linux/amd64${{ github.event_name == 'release' && ',linux/arm64' || '' }}
164+
file: Dockerfile-ci
165+
platforms: linux/amd64,linux/arm64
117166
push: ${{ github.event_name == 'release' }}
118167
tags: ${{ steps.meta.outputs.tags }}
119168
labels: ${{ steps.meta.outputs.labels }}
@@ -136,4 +185,4 @@ jobs:
136185
DIGEST: ${{ steps.build-and-push.outputs.digest }}
137186
# This step uses the identity token to provision an ephemeral certificate
138187
# against the sigstore community Fulcio instance.
139-
run: echo "${TAGS}" | xargs -I {} cosign sign --yes {}@${DIGEST}
188+
run: echo "${TAGS}" | xargs -I {} cosign sign --yes {}@${DIGEST}

.github/workflows/rust-clippy.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ name: rust-clippy analyze
1111

1212
on:
1313
push:
14-
branches: [ "master" ]
14+
branches: [ "master", "dev" ]
1515
pull_request:
1616
# The branches below must be a subset of the branches above
17-
branches: [ "master" ]
17+
branches: [ "master", "dev" ]
1818
schedule:
1919
- cron: '31 7 * * 3'
2020

Dockerfile-ci

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# syntax=docker/dockerfile:1
2+
FROM debian:bookworm-slim
3+
ARG GIT_COMMIT
4+
ARG TARGETPLATFORM
5+
6+
WORKDIR /config
7+
8+
COPY --chmod=100 binary/$TARGETPLATFORM/rtabby-web-api /
9+
COPY users.exemple.yml .
10+
COPY web/ /www/web/
11+
ENV STATIC_FILES_BASE_DIR=/www/web/
12+
ENV GIT_COMMIT=$GIT_COMMIT
13+
14+
CMD ["/rtabby-web-api"]

docker-compose-sqlite.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,6 @@ services:
1818
# If running as root, setup your user/volume owner UID and GID
1919
#user: "1000:1000"
2020

21-
cap_add:
22-
- "CAP_DAC_OVERRIDE"
23-
cap_drop: ['ALL']
2421
read_only: true
2522

2623
ports:

docker-compose.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,6 @@ services:
1717
# If running as root, setup your user/volume owner UID and GID
1818
#user: "1000:1000"
1919

20-
cap_add:
21-
- "CAP_DAC_OVERRIDE"
22-
cap_drop: ['ALL']
2320
read_only: true
2421

2522
ports:

0 commit comments

Comments
 (0)