diff --git a/.github/workflows/clippy-fmt.yml b/.github/workflows/clippy-fmt.yml deleted file mode 100644 index f2e19bdb..00000000 --- a/.github/workflows/clippy-fmt.yml +++ /dev/null @@ -1,39 +0,0 @@ -name: Lint - -on: - pull_request: - types: [opened, synchronize, reopened] - push: - branches: - - master - - db-abstract - -jobs: - fmt: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - # Ensure rustfmt is installed and setup problem matcher - - uses: actions-rust-lang/setup-rust-toolchain@v1 - with: - components: rustfmt - - name: Rustfmt Check - uses: actions-rust-lang/rustfmt@v1 - - clippy: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: actions-rust-lang/setup-rust-toolchain@v1 - with: - components: clippy - - - uses: actions/setup-node@v4 - with: - node-version: "20.19.0" - - - name: Build frontend - run: make frontend - - - name: clippy Check - run: cargo clippy --workspace --tests --all-features diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml deleted file mode 100644 index 5ebf339c..00000000 --- a/.github/workflows/coverage.yml +++ /dev/null @@ -1,119 +0,0 @@ -#name: Coverage -# -#on: -# pull_request: -# types: [opened, synchronize, reopened] -# push: -# branches: -# - master -# - db-abstract -# -#jobs: -# build_and_test: -# strategy: -# fail-fast: false -# matrix: -# version: -# - stable -# #- 1.51.0 -# -# name: ${{ matrix.version }} - x86_64-unknown-linux-gnu -# runs-on: ubuntu-latest -# -# services: -# postgres: -# image: postgres -# env: -# POSTGRES_PASSWORD: password -# POSTGRES_USER: postgres -# POSTGRES_DB: postgres -# options: >- -# --health-cmd pg_isready -# --health-interval 10s -# --health-timeout 5s -# --health-retries 5 -# ports: -# - 5432:5432 -# -# mcaptcha-redis: -# image: mcaptcha/cache -# ports: -# - 6379:6379 -# -# mcaptcha-smtp: -# image: maildev/maildev -# env: -# MAILDEV_WEB_PORT: "1080" -# MAILDEV_INCOMING_USER: "admin" -# MAILDEV_INCOMING_PASS: "password" -# ports: -# - 1080:1080 -# - 10025:1025 -# -# -# maria: -# image: mariadb:10 -# env: -# MARIADB_USER: "maria" -# MARIADB_PASSWORD: "password" -# MARIADB_ROOT_PASSWORD: "password" -# MARIADB_DATABASE: "maria" -# options: >- -# --health-cmd="mysqladmin ping" -# --health-interval=10s -# --health-timeout=5s -# --health-retries=10 -# ports: -# - 3306:3306 -# -# -# steps: -# - uses: actions/checkout@v4 -# -# - name: load env -# run: | -# source .env_sample \ -# && echo "POSTGRES_DATABASE_URL=$POSTGRES_DATABASE_URL" >> $GITHUB_ENV \ -# && echo "MARIA_DATABASE_URL=$MARIA_DATABASE_URL" >> $GITHUB_ENV -# -# -# - uses: actions/setup-node@v2 -# with: -# node-version: "18.0.0" -# -# - uses: actions-rust-lang/setup-rust-toolchain@v1 -# -# - name: Build frontend -# run: make frontend -# -# - name: Run the frontend tests -# run: make test.frontend -# -# - name: Run migrations -# run: make migrate -# env: -# POSTGRES_DATABASE_URL: "${{ env.POSTGRES_DATABASE_URL }}" -# MARIA_DATABASE_URL: "${{ env.MARIA_DATABASE_URL }}" -# -# - name: build frontend -# run: make frontend -# -# - name: Generate coverage file -# if: github.event_name == 'pull_request' -# #if: (github.ref == 'refs/heads/master' || github.event_name == 'pull_request') -# uses: actions-rs/tarpaulin@v0.1 -# with: -# args: "-t 1200" -# env: -# POSTGRES_DATABASE_URL: "${{ env.POSTGRES_DATABASE_URL }}" -# MARIA_DATABASE_URL: "${{ env.MARIA_DATABASE_URL }}" -# # GIT_HASH is dummy value. I guess build.rs is skipped in tarpaulin -# # execution so this value is required for preventing meta tests from -# # panicking -# GIT_HASH: 8e77345f1597e40c2e266cb4e6dee74888918a61 -# CACHE_BUSTER_FILE_MAP: '{"map":{"./static/bundle/main.js":"./prod/bundle/main.1417115E59909BE0A01040A45A398ADB09D928DF89CCF038FA44B14850442096.js"},"base_dir":"./prod"}' -# COMPILED_DATE: "2021-07-21" -# -# - name: Upload to Codecov -# if: github.event_name == 'pull_request' -# uses: codecov/codecov-action@v2 diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml deleted file mode 100644 index f425785b..00000000 --- a/.github/workflows/linux.yml +++ /dev/null @@ -1,154 +0,0 @@ -name: Build - -on: - schedule: - - cron: "0 9 * * *" - pull_request: - types: [opened, synchronize, reopened] - push: - branches: - - master - - "*" - - "!gh-pages" - -jobs: - build_and_test: - strategy: - fail-fast: false - matrix: - version: - - stable - - name: ${{ matrix.version }} - x86_64-unknown-linux-gnu - runs-on: ubuntu-latest - - services: - postgres: - image: postgres - env: - POSTGRES_PASSWORD: password - POSTGRES_USER: postgres - POSTGRES_DB: postgres - options: >- - --health-cmd pg_isready - --health-interval 10s - --health-timeout 5s - --health-retries 5 - ports: - - 5432:5432 - - mcaptcha-redis: - image: mcaptcha/cache - ports: - - 6379:6379 - mcaptcha-smtp: - image: maildev/maildev - env: - MAILDEV_WEB_PORT: "1080" - MAILDEV_INCOMING_USER: "admin" - MAILDEV_INCOMING_PASS: "password" - ports: - - 1080:1080 - - 10025:1025 - - maria: - image: mariadb:10 - env: - MARIADB_USER: "maria" - MARIADB_PASSWORD: "password" - MARIADB_ROOT_PASSWORD: "password" - MARIADB_DATABASE: "maria" - options: >- - --health-cmd="mysqladmin ping" - --health-interval=10s - --health-timeout=5s - --health-retries=10 - ports: - - 3306:3306 - - steps: - - uses: actions/checkout@v4 - - - - name: configure GPG key - if: (github.ref == 'refs/heads/master' || github.event_name == 'push') && github.repository == 'mCaptcha/mCaptcha' - run: echo -n "$RELEASE_BOT_GPG_SIGNING_KEY" | gpg --batch --import --pinentry-mode loopback - env: - RELEASE_BOT_GPG_SIGNING_KEY: ${{ secrets.RELEASE_BOT_GPG_SIGNING_KEY }} - - - name: load env - run: | - source .env_sample \ - && echo "POSTGRES_DATABASE_URL=$POSTGRES_DATABASE_URL" >> $GITHUB_ENV \ - && echo "MARIA_DATABASE_URL=$MARIA_DATABASE_URL" >> $GITHUB_ENV - - - uses: actions/setup-node@v4 - with: - node-version: "20.19.0" - - - uses: actions-rust-lang/setup-rust-toolchain@v1 - - - name: install nightwatch dep - run: sudo apt-get install xvfb - - - name: Run migrations - run: make migrate - env: - POSTGRES_DATABASE_URL: "${{ env.POSTGRES_DATABASE_URL }}" - MARIA_DATABASE_URL: "${{ env.MARIA_DATABASE_URL }}" - - - name: build - run: make - env: - POSTGRES_DATABASE_URL: "${{ env.POSTGRES_DATABASE_URL }}" - MARIA_DATABASE_URL: "${{ env.MARIA_DATABASE_URL }}" - - # - name: build frontend - # run: make frontend - # - - name: lint frontend - run: yarn lint - - - name: run tests - run: make test - env: - POSTGRES_DATABASE_URL: "${{ env.POSTGRES_DATABASE_URL }}" - MARIA_DATABASE_URL: "${{ env.MARIA_DATABASE_URL }}" - - - name: run integration tests - run: make test.integration - - - name: Login to DockerHub - if: github.ref == 'refs/heads/master' && github.event_name == 'push' && github.repository == 'mCaptcha/mCaptcha' - uses: docker/login-action@v1 - with: - username: mcaptcha - password: ${{ secrets.DOCKERHUB_TOKEN }} - - - name: publish docker images - if: (github.ref == 'refs/heads/master' || github.event_name == 'push') && github.repository == 'mCaptcha/mCaptcha' - run: make docker-publish - - - name: publish bins - if: (github.ref == 'refs/heads/master' || github.event_name == 'push') && github.repository == 'mCaptcha/mCaptcha' - run: ./scripts/publish.sh publish master latest $DUMBSERVE_PASSWORD - env: - DUMBSERVE_PASSWORD: ${{ secrets.DUMBSERVE_PASSWORD }} - GPG_PASSWORD: ${{ secrets.GPG_PASSWORD }} - - - name: generate documentation - if: matrix.version == 'stable' && (github.repository == 'mCaptcha/mCaptcha') - run: make doc - env: - POSTGRES_DATABASE_URL: "${{ env.POSTGRES_DATABASE_URL }}" - MARIA_DATABASE_URL: "${{ env.MARIA_DATABASE_URL }}" - GIT_HASH: 8e77345f1597e40c2e266cb4e6dee74888918a61 # dummy value - COMPILED_DATE: "2021-07-21" - - - name: Deploy to GitHub Pages - if: matrix.version == 'stable' && (github.repository == 'mCaptcha/mCaptcha') - uses: JamesIves/github-pages-deploy-action@3.7.1 - with: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - BRANCH: gh-pages - FOLDER: target/doc diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index ae8e987d..00000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,125 +0,0 @@ -name: Publish release - -on: - release: - type: [published] - -jobs: - build_and_test: - strategy: - fail-fast: false - - name: x86_64-unknown-linux-gnu - runs-on: ubuntu-latest - - services: - postgres: - image: postgres - env: - POSTGRES_PASSWORD: password - POSTGRES_USER: postgres - POSTGRES_DB: postgres - options: >- - --health-cmd pg_isready - --health-interval 10s - --health-timeout 5s - --health-retries 5 - ports: - - 5432:5432 - - mcaptcha-redis: - image: mcaptcha/cache - ports: - - 6379:6379 - mcaptcha-smtp: - image: maildev/maildev - env: - MAILDEV_WEB_PORT: "1080" - MAILDEV_INCOMING_USER: "admin" - MAILDEV_INCOMING_PASS: "password" - ports: - - 1080:1080 - - 10025:1025 - - maria: - image: mariadb:10 - env: - MARIADB_USER: "maria" - MARIADB_PASSWORD: "password" - MARIADB_ROOT_PASSWORD: "password" - MARIADB_DATABASE: "maria" - options: >- - --health-cmd="mysqladmin ping" - --health-interval=10s - --health-timeout=5s - --health-retries=10 - ports: - - 3306:3306 - - steps: - - uses: actions/checkout@v4 - - - name: configure GPG key - run: echo -n "$RELEASE_BOT_GPG_SIGNING_KEY" | gpg --batch --import --pinentry-mode loopback - env: - RELEASE_BOT_GPG_SIGNING_KEY: ${{ secrets.RELEASE_BOT_GPG_SIGNING_KEY }} - - - name: Set release version - run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV - - - name: load env - run: | - source .env_sample \ - && echo "POSTGRES_DATABASE_URL=$POSTGRES_DATABASE_URL" >> $GITHUB_ENV \ - && echo "MARIA_DATABASE_URL=$MARIA_DATABASE_URL" >> $GITHUB_ENV - - - uses: actions/setup-node@v4 - with: - node-version: "20.19.0" - - - uses: actions-rust-lang/setup-rust-toolchain@v1 - - - name: install nightwatch dep - run: sudo apt-get install xvfb - - - name: Run migrations - run: make migrate - env: - POSTGRES_DATABASE_URL: "${{ env.POSTGRES_DATABASE_URL }}" - MARIA_DATABASE_URL: "${{ env.MARIA_DATABASE_URL }}" - - - name: build - run: make - env: - POSTGRES_DATABASE_URL: "${{ env.POSTGRES_DATABASE_URL }}" - MARIA_DATABASE_URL: "${{ env.MARIA_DATABASE_URL }}" - - - name: lint frontend - run: yarn lint - - - name: run tests - run: make test - env: - POSTGRES_DATABASE_URL: "${{ env.POSTGRES_DATABASE_URL }}" - MARIA_DATABASE_URL: "${{ env.MARIA_DATABASE_URL }}" - - - name: run integration tests - run: make test.integration - - - name: Login to DockerHub - uses: docker/login-action@v1 - with: - username: mcaptcha - password: ${{ secrets.DOCKERHUB_TOKEN }} - - - name: build docker images - run: docker build -t mcaptcha/mcaptcha:${RELEASE_VERSION} . - - - name: publish docker images - run: docker push mcaptcha/mcaptcha:${RELEASE_VERSION} - - - name: publish bins - run: ./scripts/publish.sh publish $RELEASE_VERSION latest $DUMBSERVE_PASSWORD - env: - DUMBSERVE_PASSWORD: ${{ secrets.DUMBSERVE_PASSWORD }} - GPG_PASSWORD: ${{ secrets.GPG_PASSWORD }} diff --git a/.github/workflows/tagged-release.yml b/.github/workflows/tagged-release.yml deleted file mode 100644 index d133cbf4..00000000 --- a/.github/workflows/tagged-release.yml +++ /dev/null @@ -1,32 +0,0 @@ -#name: Create binary for release -# -## Only on tags that start with a "v" -#on: -# push: -# tags: -# - "v*" -# -#jobs: -# build: -# runs-on: ubuntu-latest -# strategy: -# fail-fast: false -# matrix: -# include: -# - target: x86_64-pc-windows-gnu -# archive: zip -# - target: x86_64-unknown-linux-musl -# archive: tar.gz tar.xz -# - target: x86_64-apple-darwin -# archive: zip -# steps: -# - name: Checkout -# uses: actions/checkout@v3 -# -# - name: Compile and release -# uses: rust-build/rust-build.action@v1.3.2 -# env: -# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} -# with: -# RUSTTARGET: ${{ matrix.target }} -# ARCHIVE_TYPES: ${{ matrix.archive }} diff --git a/.woodpecker.yaml b/.woodpecker.yaml index 5818737c..e22683d6 100644 --- a/.woodpecker.yaml +++ b/.woodpecker.yaml @@ -1,10 +1,24 @@ steps: - build_docker_img: - image: plugins/docker + frontend: + image: node:20 when: - event: [pull_request] - settings: - dry_run: true - repo: mcaptcha/mcaptcha - tags: - latest + - event: [pull_request, push] + - branch: + include: [woodpecker-pipeline] + exclude: ["renovate/*"] + commands: +# - apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends make +# - yarn install && cd docs/openapi && yarn install + - make frontend + + backend: + image: rust:latest + when: + - event: [pull_request, push] + - branch: + include: [woodpecker-pipeline] + exclude: ["renovate/*"] + commands: + - cargo --version + - make cache-bust + - cargo build