373 lines
12 KiB
YAML
373 lines
12 KiB
YAML
name: CI
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
pull_request:
|
|
workflow_dispatch:
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
|
|
cancel-in-progress: true
|
|
jobs:
|
|
build:
|
|
strategy:
|
|
matrix:
|
|
include:
|
|
- target: aarch64-apple-darwin
|
|
runner: macos-15
|
|
cross: false
|
|
# - target: aarch64-pc-windows-msvc
|
|
# runner: windows-11-arm
|
|
# cross: false
|
|
# executable: proxy-scraper-checker.exe
|
|
- target: aarch64-unknown-linux-gnu
|
|
runner: ubuntu-24.04-arm
|
|
cross: false
|
|
- target: i686-pc-windows-msvc
|
|
runner: windows-2025
|
|
cross: false
|
|
executable: proxy-scraper-checker.exe
|
|
- target: x86_64-apple-darwin
|
|
runner: macos-15
|
|
cross: false
|
|
- target: x86_64-pc-windows-msvc
|
|
runner: windows-2025
|
|
cross: false
|
|
executable: proxy-scraper-checker.exe
|
|
- target: x86_64-unknown-linux-gnu
|
|
runner: ubuntu-24.04
|
|
cross: false
|
|
- target: aarch64-linux-android
|
|
runner: ubuntu-24.04
|
|
cross: true
|
|
# - target: aarch64-unknown-linux-gnu
|
|
# runner: ubuntu-24.04
|
|
# cross: true
|
|
# - target: aarch64-unknown-linux-gnu:centos
|
|
# runner: ubuntu-24.04
|
|
# cross: true
|
|
- target: aarch64-unknown-linux-musl
|
|
runner: ubuntu-24.04
|
|
cross: true
|
|
- target: arm-linux-androideabi
|
|
runner: ubuntu-24.04
|
|
cross: true
|
|
- target: arm-unknown-linux-gnueabi
|
|
runner: ubuntu-24.04
|
|
cross: true
|
|
- target: arm-unknown-linux-gnueabihf
|
|
runner: ubuntu-24.04
|
|
cross: true
|
|
- target: arm-unknown-linux-musleabi
|
|
runner: ubuntu-24.04
|
|
cross: true
|
|
- target: arm-unknown-linux-musleabihf
|
|
runner: ubuntu-24.04
|
|
cross: true
|
|
- target: armv5te-unknown-linux-gnueabi
|
|
runner: ubuntu-24.04
|
|
cross: true
|
|
- target: armv5te-unknown-linux-musleabi
|
|
runner: ubuntu-24.04
|
|
cross: true
|
|
- target: armv7-linux-androideabi
|
|
runner: ubuntu-24.04
|
|
cross: true
|
|
- target: armv7-unknown-linux-gnueabi
|
|
runner: ubuntu-24.04
|
|
cross: true
|
|
- target: armv7-unknown-linux-gnueabihf
|
|
runner: ubuntu-24.04
|
|
cross: true
|
|
- target: armv7-unknown-linux-musleabi
|
|
runner: ubuntu-24.04
|
|
cross: true
|
|
- target: armv7-unknown-linux-musleabihf
|
|
runner: ubuntu-24.04
|
|
cross: true
|
|
# - target: i586-unknown-linux-gnu
|
|
# runner: ubuntu-24.04
|
|
# cross: true
|
|
# - target: i586-unknown-linux-musl
|
|
# runner: ubuntu-24.04
|
|
# cross: true
|
|
- target: i686-unknown-freebsd
|
|
runner: ubuntu-24.04
|
|
cross: true
|
|
- target: i686-linux-android
|
|
runner: ubuntu-24.04
|
|
cross: true
|
|
# - target: i686-pc-windows-gnu
|
|
# runner: ubuntu-24.04
|
|
# cross: true
|
|
- target: i686-unknown-linux-gnu
|
|
runner: ubuntu-24.04
|
|
cross: true
|
|
- target: loongarch64-unknown-linux-gnu
|
|
runner: ubuntu-24.04
|
|
cross: true
|
|
- target: loongarch64-unknown-linux-musl
|
|
runner: ubuntu-24.04
|
|
cross: true
|
|
# - target: mips-unknown-linux-gnu
|
|
# runner: ubuntu-24.04
|
|
# cross: true
|
|
# - target: mips-unknown-linux-musl
|
|
# runner: ubuntu-24.04
|
|
# cross: true
|
|
# - target: mips64-unknown-linux-gnuabi64
|
|
# runner: ubuntu-24.04
|
|
# cross: true
|
|
# - target: mips64-unknown-linux-muslabi64
|
|
# runner: ubuntu-24.04
|
|
# cross: true
|
|
# - target: mips64el-unknown-linux-gnuabi64
|
|
# runner: ubuntu-24.04
|
|
# cross: true
|
|
# - target: mips64el-unknown-linux-muslabi64
|
|
# runner: ubuntu-24.04
|
|
# cross: true
|
|
# - target: mipsel-unknown-linux-gnu
|
|
# runner: ubuntu-24.04
|
|
# cross: true
|
|
# - target: mipsel-unknown-linux-musl
|
|
# runner: ubuntu-24.04
|
|
# cross: true
|
|
- target: powerpc-unknown-linux-gnu
|
|
runner: ubuntu-24.04
|
|
cross: true
|
|
- target: powerpc64-unknown-linux-gnu
|
|
runner: ubuntu-24.04
|
|
cross: true
|
|
- target: powerpc64le-unknown-linux-gnu
|
|
runner: ubuntu-24.04
|
|
cross: true
|
|
- target: riscv64gc-unknown-linux-gnu
|
|
runner: ubuntu-24.04
|
|
cross: true
|
|
- target: riscv64gc-unknown-linux-musl
|
|
runner: ubuntu-24.04
|
|
cross: true
|
|
- target: s390x-unknown-linux-gnu
|
|
runner: ubuntu-24.04
|
|
cross: true
|
|
- target: sparc64-unknown-linux-gnu
|
|
runner: ubuntu-24.04
|
|
cross: true
|
|
# - target: sparcv9-sun-solaris
|
|
# runner: ubuntu-24.04
|
|
# cross: true
|
|
# - target: thumbv6m-none-eabi
|
|
# runner: ubuntu-24.04
|
|
# cross: true
|
|
# - target: thumbv7em-none-eabi
|
|
# runner: ubuntu-24.04
|
|
# cross: true
|
|
# - target: thumbv7em-none-eabihf
|
|
# runner: ubuntu-24.04
|
|
# cross: true
|
|
# - target: thumbv7m-none-eabi
|
|
# runner: ubuntu-24.04
|
|
# cross: true
|
|
- target: thumbv7neon-linux-androideabi
|
|
runner: ubuntu-24.04
|
|
cross: true
|
|
- target: thumbv7neon-unknown-linux-gnueabihf
|
|
runner: ubuntu-24.04
|
|
cross: true
|
|
# - target: thumbv8m.base-none-eabi
|
|
# runner: ubuntu-24.04
|
|
# cross: true
|
|
# - target: thumbv8m.main-none-eabi
|
|
# runner: ubuntu-24.04
|
|
# cross: true
|
|
# - target: thumbv8m.main-none-eabihf
|
|
# runner: ubuntu-24.04
|
|
# cross: true
|
|
# - target: wasm32-unknown-emscripten
|
|
# runner: ubuntu-24.04
|
|
# cross: true
|
|
- target: x86_64-linux-android
|
|
runner: ubuntu-24.04
|
|
cross: true
|
|
# - target: x86_64-pc-windows-gnu
|
|
# runner: ubuntu-24.04
|
|
# cross: true
|
|
# - target: x86_64-pc-solaris
|
|
# runner: ubuntu-24.04
|
|
# cross: true
|
|
- target: x86_64-unknown-freebsd
|
|
runner: ubuntu-24.04
|
|
cross: true
|
|
# - target: x86_64-unknown-dragonfly
|
|
# runner: ubuntu-24.04
|
|
# cross: true
|
|
- target: x86_64-unknown-illumos
|
|
runner: ubuntu-24.04
|
|
cross: true
|
|
# - target: x86_64-unknown-linux-gnu
|
|
# runner: ubuntu-24.04
|
|
# cross: true
|
|
# - target: x86_64-unknown-linux-gnu:centos
|
|
# runner: ubuntu-24.04
|
|
# cross: true
|
|
- target: x86_64-unknown-linux-musl
|
|
runner: ubuntu-24.04
|
|
cross: true
|
|
- target: x86_64-unknown-netbsd
|
|
runner: ubuntu-24.04
|
|
cross: true
|
|
fail-fast: false
|
|
runs-on: ${{ matrix.runner }}
|
|
permissions:
|
|
id-token: write
|
|
attestations: write
|
|
env:
|
|
SCCACHE_GHA_ENABLED: "true"
|
|
RUSTC_WRAPPER: "sccache"
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
persist-credentials: false
|
|
- run: rustup toolchain install beta --profile minimal --target '${{ matrix.target }}' --allow-downgrade
|
|
- run: rustup default beta
|
|
- uses: mozilla-actions/sccache-action@v0.0.9
|
|
- if: ${{ matrix.cross }}
|
|
run: cargo +beta install cross --git https://github.com/cross-rs/cross
|
|
- if: ${{ matrix.cross }}
|
|
run: cross +beta build --features tui --release --target '${{ matrix.target }}' --locked
|
|
- if: ${{ !matrix.cross }}
|
|
run: cargo +beta build --features tui --release --target '${{ matrix.target }}' --locked
|
|
- run: mkdir dist
|
|
- run: echo -n '${{ github.sha }}' > dist/commit-sha.txt
|
|
shell: bash
|
|
- run: mv config.toml dist/
|
|
- run: mv target/${{ matrix.target}}/release/${{ matrix.executable || 'proxy-scraper-checker' }} dist/
|
|
- if: ${{ github.event_name != 'pull_request' }}
|
|
uses: actions/attest-build-provenance@v2
|
|
with:
|
|
subject-path: dist
|
|
- uses: actions/upload-artifact@v4
|
|
with:
|
|
name: proxy-scraper-checker-${{ matrix.target }}
|
|
path: dist/
|
|
if-no-files-found: error
|
|
build-docker:
|
|
runs-on: ubuntu-24.04
|
|
permissions:
|
|
attestations: write
|
|
id-token: write
|
|
packages: write
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
persist-credentials: false
|
|
- uses: docker/login-action@v3
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
- id: meta
|
|
uses: docker/metadata-action@v5
|
|
with:
|
|
images: ghcr.io/${{ github.repository }}
|
|
tags: |
|
|
type=raw,value=${{ github.sha }}
|
|
- uses: docker/setup-qemu-action@v3
|
|
- uses: docker/setup-buildx-action@v3
|
|
- id: push
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
cache-from: type=gha
|
|
cache-to: type=gha,mode=max
|
|
labels: ${{ steps.meta.outputs.labels }}
|
|
platforms: linux/386,linux/amd64,linux/arm/v7,linux/arm64/v8,linux/ppc64le,linux/s390x
|
|
push: true
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
- uses: actions/attest-build-provenance@v2
|
|
with:
|
|
subject-digest: ${{ steps.push.outputs.digest }}
|
|
subject-name: ghcr.io/${{ github.repository }}
|
|
push-to-registry: true
|
|
- run: mkdir -p dist
|
|
- run: echo -n '${{ github.sha }}' > dist/commit-sha.txt
|
|
- run: mv compose.yaml dist/
|
|
- run: mv config.toml dist/
|
|
- name: Create Dockerfile
|
|
run: |
|
|
echo "# syntax=docker.io/docker/dockerfile:1
|
|
|
|
FROM ghcr.io/${{ github.repository }}:${{ github.sha }}
|
|
|
|
ARG \\
|
|
UID=1000 \\
|
|
GID=1000
|
|
|
|
USER root
|
|
|
|
RUN groupmod --gid \"${GID}\" app \\
|
|
&& usermod --uid \"${UID}\" --gid \"${GID}\" app
|
|
|
|
USER app
|
|
" > dist/Dockerfile
|
|
- uses: actions/attest-build-provenance@v2
|
|
with:
|
|
subject-path: dist
|
|
- uses: actions/upload-artifact@v4
|
|
with:
|
|
name: proxy-scraper-checker-docker
|
|
path: dist/
|
|
if-no-files-found: error
|
|
check:
|
|
if: ${{ always() && github.event_name == 'pull_request' }}
|
|
needs:
|
|
- build
|
|
# Too slow
|
|
# - build-docker
|
|
- clippy
|
|
- pre-commit
|
|
- rustfmt
|
|
runs-on: ubuntu-24.04
|
|
steps:
|
|
- uses: re-actors/alls-green@release/v1
|
|
with:
|
|
jobs: ${{ toJSON(needs) }}
|
|
clippy:
|
|
runs-on: ubuntu-24.04
|
|
strategy:
|
|
matrix:
|
|
features:
|
|
- "--features tui"
|
|
- ""
|
|
fail-fast: false
|
|
env:
|
|
SCCACHE_GHA_ENABLED: "true"
|
|
RUSTC_WRAPPER: "sccache"
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
persist-credentials: false
|
|
- run: rustup toolchain install beta --profile minimal --component clippy --allow-downgrade
|
|
- uses: mozilla-actions/sccache-action@v0.0.9
|
|
- run: cargo +beta clippy --all-targets ${{ matrix.features }} -- -Dwarnings -Wclippy::pedantic
|
|
pre-commit:
|
|
runs-on: ubuntu-24.04
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
persist-credentials: false
|
|
- uses: astral-sh/setup-uv@v5
|
|
with:
|
|
enable-cache: false
|
|
- run: uv tool run --from pre-commit@latest --with pre-commit-uv --no-cache --python 3.13 pre-commit run --all-files --show-diff-on-failure
|
|
env:
|
|
RUFF_OUTPUT_FORMAT: github
|
|
rustfmt:
|
|
runs-on: ubuntu-24.04
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
persist-credentials: false
|
|
- run: rustup toolchain install nightly --profile minimal --component rustfmt --allow-downgrade
|
|
- run: cargo +nightly fmt --check
|