From f150e4b466affd325d878725215c55dd6dcac961 Mon Sep 17 00:00:00 2001 From: Xe Iaso Date: Sun, 28 Sep 2025 02:40:54 +0000 Subject: [PATCH] ci: fix rust dependencies Signed-off-by: Xe Iaso --- .github/workflows/docker-pr.yml | 4 +- .github/workflows/docker.yml | 2 + .github/workflows/go.yml | 130 ++++++++++++----------- .github/workflows/rust.yml | 26 +++++ .github/workflows/smoke-tests.yml | 2 + .github/workflows/ssh-ci-runner-cron.yml | 37 ------- 6 files changed, 99 insertions(+), 102 deletions(-) create mode 100644 .github/workflows/rust.yml delete mode 100644 .github/workflows/ssh-ci-runner-cron.yml diff --git a/.github/workflows/docker-pr.yml b/.github/workflows/docker-pr.yml index db83ff9e..4efd403c 100644 --- a/.github/workflows/docker-pr.yml +++ b/.github/workflows/docker-pr.yml @@ -2,7 +2,7 @@ name: Docker image builds (pull requests) on: pull_request: - branches: [ "main" ] + branches: ["main"] env: DOCKER_METADATA_SET_OUTPUT_ENV: "true" @@ -45,6 +45,8 @@ jobs: run: | brew bundle + - uses: actions-rust-lang/setup-rust-toolchain@02be93da58aa71fb456aa9c43b301149248829d8 # v1.15.1 + - name: Docker meta id: meta uses: docker/metadata-action@c1e51972afc2121e065aed6d45c65596fe445f3f # v5.8.0 diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 5da3be6b..2fe0d658 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -55,6 +55,8 @@ jobs: run: | brew bundle + - uses: actions-rust-lang/setup-rust-toolchain@02be93da58aa71fb456aa9c43b301149248829d8 # v1.15.1 + - name: Log into registry uses: docker/login-action@184bdaa0721073962dff0199f1fb9940f07167d1 # v3.5.0 with: diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 45a2bb5e..91d0ad1b 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -2,9 +2,9 @@ name: Go on: push: - branches: [ "main" ] + branches: ["main"] pull_request: - branches: [ "main" ] + branches: ["main"] permissions: contents: read @@ -15,77 +15,79 @@ jobs: #runs-on: alrest-techarohq runs-on: ubuntu-24.04 steps: - - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 - with: - persist-credentials: false + - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 + with: + persist-credentials: false - - name: build essential - run: | - sudo apt-get update - sudo apt-get install -y build-essential + - name: build essential + run: | + sudo apt-get update + sudo apt-get install -y build-essential - - name: Set up Homebrew - uses: Homebrew/actions/setup-homebrew@main + - name: Set up Homebrew + uses: Homebrew/actions/setup-homebrew@main - - name: Setup Homebrew cellar cache - uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4 - with: - path: | - /home/linuxbrew/.linuxbrew/Cellar - /home/linuxbrew/.linuxbrew/bin - /home/linuxbrew/.linuxbrew/etc - /home/linuxbrew/.linuxbrew/include - /home/linuxbrew/.linuxbrew/lib - /home/linuxbrew/.linuxbrew/opt - /home/linuxbrew/.linuxbrew/sbin - /home/linuxbrew/.linuxbrew/share - /home/linuxbrew/.linuxbrew/var - key: ${{ runner.os }}-go-homebrew-cellar-${{ hashFiles('go.sum') }} - restore-keys: | - ${{ runner.os }}-go-homebrew-cellar- + - name: Setup Homebrew cellar cache + uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4 + with: + path: | + /home/linuxbrew/.linuxbrew/Cellar + /home/linuxbrew/.linuxbrew/bin + /home/linuxbrew/.linuxbrew/etc + /home/linuxbrew/.linuxbrew/include + /home/linuxbrew/.linuxbrew/lib + /home/linuxbrew/.linuxbrew/opt + /home/linuxbrew/.linuxbrew/sbin + /home/linuxbrew/.linuxbrew/share + /home/linuxbrew/.linuxbrew/var + key: ${{ runner.os }}-go-homebrew-cellar-${{ hashFiles('go.sum') }} + restore-keys: | + ${{ runner.os }}-go-homebrew-cellar- - - name: Install Brew dependencies - run: | - brew bundle + - name: Install Brew dependencies + run: | + brew bundle - - name: Setup Golang caches - uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4 - with: - path: | - ~/.cache/go-build - ~/go/pkg/mod - key: ${{ runner.os }}-golang-${{ hashFiles('**/go.sum') }} - restore-keys: | - ${{ runner.os }}-golang- + - name: Setup Golang caches + uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4 + with: + path: | + ~/.cache/go-build + ~/go/pkg/mod + key: ${{ runner.os }}-golang-${{ hashFiles('**/go.sum') }} + restore-keys: | + ${{ runner.os }}-golang- - - name: Cache playwright binaries - uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4 - id: playwright-cache - with: - path: | - ~/.cache/ms-playwright - key: ${{ runner.os }}-playwright-${{ hashFiles('**/go.sum') }} + - uses: actions-rust-lang/setup-rust-toolchain@02be93da58aa71fb456aa9c43b301149248829d8 # v1.15.1 - - name: install node deps - run: | - npm ci + - name: Cache playwright binaries + uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4 + id: playwright-cache + with: + path: | + ~/.cache/ms-playwright + key: ${{ runner.os }}-playwright-${{ hashFiles('**/go.sum') }} - - name: install playwright browsers - run: | - npx --no-install playwright@1.52.0 install --with-deps - npx --no-install playwright@1.52.0 run-server --port 9001 & + - name: install node deps + run: | + npm ci - - name: Build - run: npm run build + - name: install playwright browsers + run: | + npx --no-install playwright@1.52.0 install --with-deps + npx --no-install playwright@1.52.0 run-server --port 9001 & - - name: Test - run: npm run test + - name: Build + run: npm run build - - name: Lint with staticcheck - uses: dominikh/staticcheck-action@024238d2898c874f26d723e7d0ff4308c35589a2 # v1.4.0 - with: - version: "latest" + - name: Test + run: npm run test - - name: Govulncheck - run: | - go tool govulncheck ./... + - name: Lint with staticcheck + uses: dominikh/staticcheck-action@024238d2898c874f26d723e7d0ff4308c35589a2 # v1.4.0 + with: + version: "latest" + + - name: Govulncheck + run: | + go tool govulncheck ./... diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml new file mode 100644 index 00000000..0f3b638d --- /dev/null +++ b/.github/workflows/rust.yml @@ -0,0 +1,26 @@ +name: "Rust tests" +on: + push: + pull_request: + +jobs: + rust-test: + name: cargo test + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 + - uses: actions-rust-lang/setup-rust-toolchain@02be93da58aa71fb456aa9c43b301149248829d8 # v1.15.1 + - run: cargo test --all-features + + # Check formatting with rustfmt + rust-formatting: + name: cargo fmt + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 + # Ensure rustfmt is installed and setup problem matcher + - uses: actions-rust-lang/setup-rust-toolchain@02be93da58aa71fb456aa9c43b301149248829d8 # v1.15.1 + with: + components: rustfmt + - name: Rustfmt Check + uses: actions-rust-lang/rustfmt@559aa3035a47390ba96088dffa783b5d26da9326 # v1.1.1 diff --git a/.github/workflows/smoke-tests.yml b/.github/workflows/smoke-tests.yml index ef1a834c..67ce51ea 100644 --- a/.github/workflows/smoke-tests.yml +++ b/.github/workflows/smoke-tests.yml @@ -37,6 +37,8 @@ jobs: with: go-version: stable + - uses: actions-rust-lang/setup-rust-toolchain@02be93da58aa71fb456aa9c43b301149248829d8 # v1.15.1 + - uses: ko-build/setup-ko@d006021bd0c28d1ce33a07e7943d48b079944c8d # v0.9 - name: Install utils diff --git a/.github/workflows/ssh-ci-runner-cron.yml b/.github/workflows/ssh-ci-runner-cron.yml deleted file mode 100644 index 58db5278..00000000 --- a/.github/workflows/ssh-ci-runner-cron.yml +++ /dev/null @@ -1,37 +0,0 @@ -name: Regenerate ssh ci runner image - -on: - # pull_request: - # branches: ["main"] - schedule: - - cron: "0 0 1,8,15,22 * *" - workflow_dispatch: - -permissions: - pull-requests: write - contents: write - packages: write - -jobs: - ssh-ci-rebuild: - if: github.repository == 'TecharoHQ/anubis' - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 - with: - fetch-tags: true - fetch-depth: 0 - persist-credentials: false - - name: Log into registry - uses: docker/login-action@184bdaa0721073962dff0199f1fb9940f07167d1 # v3.5.0 - with: - registry: ghcr.io - username: ${{ github.repository_owner }} - password: ${{ secrets.GITHUB_TOKEN }} - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1 - - name: Build and push - run: | - cd ./test/ssh-ci - docker buildx bake --push