Compare commits

...

3 Commits

Author SHA1 Message Date
Aravinth Manivannan
342d03b58b fix: CI: port actions actionx-rust-lang and checkout@v4 2023-10-16 20:30:41 +05:30
Aravinth Manivannan
765be413c4 debug: rm GH actions caching 2023-10-16 20:17:00 +05:30
Aravinth Manivannan
e0203c660d fix: get rid of caching 2023-10-16 20:04:19 +05:30
5 changed files with 29 additions and 104 deletions

View File

@@ -12,3 +12,4 @@ src/cache_buster_data.json
browser/target browser/target
browser/cobertura.xml browser/cobertura.xml
browser/docs browser/docs
**/target

View File

@@ -12,54 +12,21 @@ jobs:
fmt: fmt:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v4
- name: ⚡ Cache # Ensure rustfmt is installed and setup problem matcher
uses: actions/cache@v2 - uses: actions-rust-lang/setup-rust-toolchain@v1
with: with:
path: |
~/.cargo/registry
~/.cargo/git
node_modules
./docs/openapi/node_modules
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- uses: actions/checkout@v2
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
components: rustfmt components: rustfmt
- name: Check with rustfmt - name: Rustfmt Check
uses: actions-rs/cargo@v1 uses: actions-rust-lang/rustfmt@v1
with:
command: fmt
args: --all -- --check
clippy: clippy:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v4
- name: ⚡ Cache - uses: actions-rust-lang/setup-rust-toolchain@v1
uses: actions/cache@v2
with: with:
path: |
~/.cargo/registry
~/.cargo/git
node_modules
./docs/openapi/node_modules
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- uses: actions/checkout@v2
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
components: clippy components: clippy
override: true
- uses: actions/setup-node@v2 - uses: actions/setup-node@v2
with: with:
@@ -68,8 +35,5 @@ jobs:
- name: Build frontend - name: Build frontend
run: make frontend run: make frontend
- name: Check with Clippy - name: clippy Check
uses: actions-rs/clippy-check@v1 run: cargo clippy --workspace --tests --all-features
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --workspace --tests --all-features

View File

@@ -68,18 +68,7 @@ jobs:
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v4
- name: ⚡ Cache
uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
node_modules
./docs/openapi/node_modules
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: load env - name: load env
run: | run: |
@@ -92,12 +81,7 @@ jobs:
with: with:
node-version: "18.0.0" node-version: "18.0.0"
- name: Install ${{ matrix.version }} - uses: actions-rust-lang/setup-rust-toolchain@v1
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.version }}-x86_64-unknown-linux-gnu
profile: minimal
override: true
- name: Build frontend - name: Build frontend
run: make frontend run: make frontend

View File

@@ -9,7 +9,7 @@ on:
branches: branches:
- master - master
- "*" - "*"
- '!gh-pages' - "!gh-pages"
jobs: jobs:
build_and_test: build_and_test:
@@ -17,9 +17,7 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
version: version:
#- 1.51.0
- stable - stable
# - nightly
name: ${{ matrix.version }} - x86_64-unknown-linux-gnu name: ${{ matrix.version }} - x86_64-unknown-linux-gnu
runs-on: ubuntu-latest runs-on: ubuntu-latest
@@ -55,7 +53,7 @@ jobs:
maria: maria:
image: mariadb:10 image: mariadb:10
env: env:
MARIADB_USER: "maria" MARIADB_USER: "maria"
MARIADB_PASSWORD: "password" MARIADB_PASSWORD: "password"
MARIADB_ROOT_PASSWORD: "password" MARIADB_ROOT_PASSWORD: "password"
@@ -69,17 +67,17 @@ jobs:
- 3306:3306 - 3306:3306
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v4
- name: ⚡ Cache #- name: ⚡ Cache
uses: actions/cache@v2 # uses: actions/cache@v2
with: # with:
path: | # path: |
~/.cargo/registry # ~/.cargo/registry
~/.cargo/git # ~/.cargo/git
node_modules # node_modules
./docs/openapi/node_modules # ./docs/openapi/node_modules
target # target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} # key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: configure GPG key - name: configure GPG key
if: (github.ref == 'refs/heads/master' || github.event_name == 'push') && github.repository == 'mCaptcha/mCaptcha' if: (github.ref == 'refs/heads/master' || github.event_name == 'push') && github.repository == 'mCaptcha/mCaptcha'
@@ -97,12 +95,7 @@ jobs:
with: with:
node-version: "18.0.0" node-version: "18.0.0"
- name: Install ${{ matrix.version }} - uses: actions-rust-lang/setup-rust-toolchain@v1
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.version }}-x86_64-unknown-linux-gnu
profile: minimal
override: true
- name: install nightwatch dep - name: install nightwatch dep
run: sudo apt-get install xvfb run: sudo apt-get install xvfb
@@ -117,7 +110,8 @@ jobs:
run: make run: make
env: env:
POSTGRES_DATABASE_URL: "${{ env.POSTGRES_DATABASE_URL }}" POSTGRES_DATABASE_URL: "${{ env.POSTGRES_DATABASE_URL }}"
MARIA_DATABASE_URL: "${{ env.MARIA_DATABASE_URL }}" MARIA_DATABASE_URL:
"${{ env.MARIA_DATABASE_URL }}"
# - name: build frontend # - name: build frontend
# run: make frontend # run: make frontend

View File

@@ -1,7 +1,6 @@
# SPDX-FileCopyrightText: 2023 Aravinth Manivannan <realaravinth@batsense.net> # SPDX-FileCopyrightText: 2023 Aravinth Manivannan <realaravinth@batsense.net>
# #
# SPDX-License-Identifier: AGPL-3.0-or-later # SPDX-License-Identifier: AGPL-3.0-or-later
FROM node:18.0.0 as frontend FROM node:18.0.0 as frontend
RUN set -ex; \ RUN set -ex; \
apt-get update; \ apt-get update; \
@@ -21,33 +20,16 @@ COPY Makefile /src/
COPY scripts /src/scripts COPY scripts /src/scripts
RUN make frontend RUN make frontend
FROM rust:latest as planner
RUN cargo install cargo-chef
WORKDIR /src
COPY . /src/
RUN cargo chef prepare --recipe-path recipe.json
FROM rust:latest as cacher
WORKDIR /src/
RUN cargo install cargo-chef
COPY --from=planner /src/recipe.json recipe.json
RUN cargo chef cook --release --recipe-path recipe.json
FROM rust:latest as rust FROM rust:latest as rust
WORKDIR /src WORKDIR /src
COPY . . COPY . .
COPY --from=cacher /src/target target
#COPY --from=cacher /src/db/db-core/target /src/db/db-core/target
#COPY --from=cacher /src/db/db-sqlx-postgres/target /src/db/db-sqlx-postgres/target
#COPY --from=cacher /src/db/db-migrations/target /src/db/db-migrations/target
#COPY --from=cacher /src/utils/cache-bust/target /src/utils/cache-bust/target
COPY --from=frontend /src/static/cache/bundle/ /src/static/cache/bundle/ COPY --from=frontend /src/static/cache/bundle/ /src/static/cache/bundle/
COPY --from=frontend /src/docs/openapi/dist/ /src/docs/openapi/dist/ COPY --from=frontend /src/docs/openapi/dist/ /src/docs/openapi/dist/
RUN cargo --version RUN cargo --version
RUN make cache-bust RUN make cache-bust
RUN cargo build --release RUN cargo build --release
FROM debian:bullseye as mCaptcha FROM debian:bookworm as mCaptcha
LABEL org.opencontainers.image.source https://github.com/mCaptcha/mCaptcha LABEL org.opencontainers.image.source https://github.com/mCaptcha/mCaptcha
RUN useradd -ms /bin/bash -u 1001 mcaptcha RUN useradd -ms /bin/bash -u 1001 mcaptcha
WORKDIR /home/mcaptcha WORKDIR /home/mcaptcha