From e0203c660df8c6acb4b4650d3b34d168804a5684 Mon Sep 17 00:00:00 2001 From: Aravinth Manivannan Date: Mon, 16 Oct 2023 20:04:19 +0530 Subject: [PATCH 1/3] fix: get rid of caching --- .dockerignore | 1 + Dockerfile | 20 +------------------- 2 files changed, 2 insertions(+), 19 deletions(-) diff --git a/.dockerignore b/.dockerignore index b4f431c8..a0d88f54 100644 --- a/.dockerignore +++ b/.dockerignore @@ -12,3 +12,4 @@ src/cache_buster_data.json browser/target browser/cobertura.xml browser/docs +**/target diff --git a/Dockerfile b/Dockerfile index 12441fcf..5b1b7402 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,6 @@ # SPDX-FileCopyrightText: 2023 Aravinth Manivannan # # SPDX-License-Identifier: AGPL-3.0-or-later - FROM node:18.0.0 as frontend RUN set -ex; \ apt-get update; \ @@ -21,33 +20,16 @@ COPY Makefile /src/ COPY scripts /src/scripts 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 WORKDIR /src 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/docs/openapi/dist/ /src/docs/openapi/dist/ RUN cargo --version RUN make cache-bust RUN cargo build --release -FROM debian:bullseye as mCaptcha +FROM debian:bookworm as mCaptcha LABEL org.opencontainers.image.source https://github.com/mCaptcha/mCaptcha RUN useradd -ms /bin/bash -u 1001 mcaptcha WORKDIR /home/mcaptcha From 765be413c4f1c85ec20136d4bc28fea53761594a Mon Sep 17 00:00:00 2001 From: Aravinth Manivannan Date: Mon, 16 Oct 2023 20:11:32 +0530 Subject: [PATCH 2/3] debug: rm GH actions caching --- .github/workflows/clippy-fmt.yml | 24 ------------------------ .github/workflows/coverage.yml | 11 ----------- .github/workflows/linux.yml | 27 ++++++++++++++------------- 3 files changed, 14 insertions(+), 48 deletions(-) diff --git a/.github/workflows/clippy-fmt.yml b/.github/workflows/clippy-fmt.yml index 16212b0e..a3a521ff 100644 --- a/.github/workflows/clippy-fmt.yml +++ b/.github/workflows/clippy-fmt.yml @@ -13,18 +13,6 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - 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') }} - - - uses: actions/checkout@v2 - name: Install Rust uses: actions-rs/toolchain@v1 @@ -41,18 +29,6 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - 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') }} - - - uses: actions/checkout@v2 - name: Install Rust uses: actions-rs/toolchain@v1 diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 3ac1d7d5..f3e72bbd 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -69,17 +69,6 @@ jobs: steps: - uses: actions/checkout@v2 - - 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 run: | diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 1bc88f99..1ff0a3d6 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -9,7 +9,7 @@ on: branches: - master - "*" - - '!gh-pages' + - "!gh-pages" jobs: build_and_test: @@ -55,7 +55,7 @@ jobs: maria: image: mariadb:10 - env: + env: MARIADB_USER: "maria" MARIADB_PASSWORD: "password" MARIADB_ROOT_PASSWORD: "password" @@ -70,16 +70,16 @@ jobs: steps: - uses: actions/checkout@v2 - - 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: ⚡ 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: configure GPG key if: (github.ref == 'refs/heads/master' || github.event_name == 'push') && github.repository == 'mCaptcha/mCaptcha' @@ -117,7 +117,8 @@ jobs: run: make env: POSTGRES_DATABASE_URL: "${{ env.POSTGRES_DATABASE_URL }}" - MARIA_DATABASE_URL: "${{ env.MARIA_DATABASE_URL }}" + MARIA_DATABASE_URL: + "${{ env.MARIA_DATABASE_URL }}" # - name: build frontend # run: make frontend From 342d03b58b1b025018ac3bbe75566b9bdc062f36 Mon Sep 17 00:00:00 2001 From: Aravinth Manivannan Date: Mon, 16 Oct 2023 20:30:41 +0530 Subject: [PATCH 3/3] fix: CI: port actions actionx-rust-lang and checkout@v4 --- .github/workflows/clippy-fmt.yml | 30 +++++++++--------------------- .github/workflows/coverage.yml | 9 ++------- .github/workflows/linux.yml | 11 ++--------- 3 files changed, 13 insertions(+), 37 deletions(-) diff --git a/.github/workflows/clippy-fmt.yml b/.github/workflows/clippy-fmt.yml index a3a521ff..638bebf4 100644 --- a/.github/workflows/clippy-fmt.yml +++ b/.github/workflows/clippy-fmt.yml @@ -12,30 +12,21 @@ jobs: fmt: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - - name: Install Rust - uses: actions-rs/toolchain@v1 + - uses: actions/checkout@v4 + # Ensure rustfmt is installed and setup problem matcher + - uses: actions-rust-lang/setup-rust-toolchain@v1 with: - toolchain: stable components: rustfmt - - name: Check with rustfmt - uses: actions-rs/cargo@v1 - with: - command: fmt - args: --all -- --check + - name: Rustfmt Check + uses: actions-rust-lang/rustfmt@v1 clippy: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - - name: Install Rust - uses: actions-rs/toolchain@v1 + - uses: actions/checkout@v4 + - uses: actions-rust-lang/setup-rust-toolchain@v1 with: - toolchain: stable components: clippy - override: true - uses: actions/setup-node@v2 with: @@ -44,8 +35,5 @@ jobs: - name: Build frontend run: make frontend - - name: Check with Clippy - uses: actions-rs/clippy-check@v1 - with: - token: ${{ secrets.GITHUB_TOKEN }} - args: --workspace --tests --all-features + - name: clippy Check + run: cargo clippy --workspace --tests --all-features diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index f3e72bbd..343e626c 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -68,7 +68,7 @@ jobs: steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: load env run: | @@ -81,12 +81,7 @@ jobs: with: node-version: "18.0.0" - - name: Install ${{ matrix.version }} - uses: actions-rs/toolchain@v1 - with: - toolchain: ${{ matrix.version }}-x86_64-unknown-linux-gnu - profile: minimal - override: true + - uses: actions-rust-lang/setup-rust-toolchain@v1 - name: Build frontend run: make frontend diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 1ff0a3d6..3e33086a 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -17,9 +17,7 @@ jobs: fail-fast: false matrix: version: - #- 1.51.0 - stable - # - nightly name: ${{ matrix.version }} - x86_64-unknown-linux-gnu runs-on: ubuntu-latest @@ -69,7 +67,7 @@ jobs: - 3306:3306 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 #- name: ⚡ Cache # uses: actions/cache@v2 # with: @@ -97,12 +95,7 @@ jobs: with: node-version: "18.0.0" - - name: Install ${{ matrix.version }} - uses: actions-rs/toolchain@v1 - with: - toolchain: ${{ matrix.version }}-x86_64-unknown-linux-gnu - profile: minimal - override: true + - uses: actions-rust-lang/setup-rust-toolchain@v1 - name: install nightwatch dep run: sudo apt-get install xvfb