diff options
Diffstat (limited to '.github')
| -rw-r--r-- | .github/workflows/autobot.yaml | 3 | ||||
| -rw-r--r-- | .github/workflows/ci.yaml | 60 | ||||
| -rw-r--r-- | .github/workflows/clippy.yaml | 23 | ||||
| -rw-r--r-- | .github/workflows/docker.yaml | 37 | ||||
| -rw-r--r-- | .github/workflows/update-flake.yaml | 5 |
5 files changed, 79 insertions, 49 deletions
diff --git a/.github/workflows/autobot.yaml b/.github/workflows/autobot.yaml index b57ea58..4e74d0a 100644 --- a/.github/workflows/autobot.yaml +++ b/.github/workflows/autobot.yaml @@ -14,7 +14,8 @@ jobs: pull-requests: write steps: - - uses: dependabot/fetch-metadata@v2 + - name: Fetch metadata + uses: dependabot/fetch-metadata@v2 id: metadata with: github-token: ${{ github.token }} diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 9394567..f084a2a 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -3,7 +3,17 @@ name: CI on: push: branches: [main] + paths: + - "**.nix" + - "**.rs" + - "**.lock" + - "Cargo.toml" pull_request: + paths: + - "**.nix" + - "**.rs" + - "**.lock" + - "Cargo.toml" workflow_dispatch: jobs: @@ -13,7 +23,7 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-latest, macos-latest, windows-latest] + os: [macos-latest, windows-latest] runs-on: ${{ matrix.os }} @@ -22,18 +32,14 @@ jobs: uses: actions/checkout@v4 - name: Install Rust - uses: dtolnay/rust-toolchain@stable - with: - toolchain: stable - - - name: Setup Rust cache - uses: Swatinem/rust-cache@v2 + uses: actions-rust-lang/setup-rust-toolchain@v1 - name: Run build - run: cargo build --locked --release + run: | + cargo build --locked --release - format-and-lint: - name: Format & lint + nix: + name: Nix runs-on: ubuntu-latest @@ -42,21 +48,41 @@ jobs: uses: actions/checkout@v4 - name: Install Nix - uses: DeterminateSystems/nix-installer-action@v12 + uses: DeterminateSystems/nix-installer-action@v13 - name: Setup Nix cache uses: DeterminateSystems/magic-nix-cache-action@v7 - - name: Run treefmt + - name: Run flake checks run: | - nix flake check --all-systems --print-build-logs --show-trace + nix build --print-build-logs --show-trace + + rustfmt: + name: Rustfmt + + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Install Rust + uses: actions-rust-lang/setup-rust-toolchain@v1 + with: + components: rustfmt + + - name: Run rustfmt + uses: actions-rust-lang/rustfmt@v1 release-gate: - name: CI Release Gate - needs: [build, format-and-lint] + name: CI Release gate + needs: [build, rustfmt, nix] + + if: ${{ always() }} runs-on: ubuntu-latest steps: - - name: Exit with result - run: echo "We're good to go!" + - name: Exit with error + if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') + run: exit 1 diff --git a/.github/workflows/clippy.yaml b/.github/workflows/clippy.yaml index 56b39df..cd99256 100644 --- a/.github/workflows/clippy.yaml +++ b/.github/workflows/clippy.yaml @@ -2,6 +2,7 @@ name: Clippy on: push: + branches: [main] paths: - 'Cargo.toml' - 'Cargo.lock' @@ -26,31 +27,23 @@ jobs: - name: Checkout repository uses: actions/checkout@v4 - - name: Install Nix - uses: DeterminateSystems/nix-installer-action@v12 - - - name: Setup Nix cache - uses: DeterminateSystems/magic-nix-cache-action@v7 - - - name: Setup Rust cache - uses: Swatinem/rust-cache@v2 + - name: Install Rust + uses: actions-rust-lang/setup-rust-toolchain@v1 + with: + components: clippy - name: Install SARIF tools run: | - nix profile install \ - --inputs-from . \ - github:getchoo/nix-exprs#{clippy-sarif,sarif-fmt} + cargo install clippy-sarif sarif-fmt - name: Fetch Cargo deps run: | - nix develop .#ci --command \ - cargo fetch --locked + cargo fetch --locked - name: Run Clippy continue-on-error: true run: | - nix develop .#ci --command \ - cargo clippy \ + cargo clippy \ --all-features \ --all-targets \ --message-format=json \ diff --git a/.github/workflows/docker.yaml b/.github/workflows/docker.yaml index 30c84d9..0bb28ad 100644 --- a/.github/workflows/docker.yaml +++ b/.github/workflows/docker.yaml @@ -3,7 +3,17 @@ name: Docker on: push: branches: [main] + paths: + - "**.nix" + - "**.rs" + - "**.lock" + - "Cargo.toml" pull_request: + paths: + - "**.nix" + - "**.rs" + - "**.lock" + - "Cargo.toml" workflow_dispatch: jobs: @@ -13,7 +23,7 @@ jobs: strategy: fail-fast: false matrix: - arch: [x86_64, aarch64] + arch: [amd64, arm64] runs-on: ubuntu-latest @@ -22,7 +32,7 @@ jobs: uses: actions/checkout@v4 - name: Install Nix - uses: DeterminateSystems/nix-installer-action@v12 + uses: DeterminateSystems/nix-installer-action@v13 - name: Setup Nix cache uses: DeterminateSystems/magic-nix-cache-action@v7 @@ -53,17 +63,21 @@ jobs: name: Docker Release Gate needs: build + if: always() + runs-on: ubuntu-latest steps: - - name: Exit with result - run: echo "We're good to go!" + - name: Exit with error + if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') + run: exit 1 push: name: Push image - if: github.event_name == 'push' needs: release-gate + if: github.event_name == 'push' + runs-on: ubuntu-latest permissions: @@ -72,12 +86,9 @@ jobs: env: REGISTRY: ghcr.io USERNAME: ${{ github.actor }} + IMAGE_NAME: teawie-bot steps: - - name: Set image name - run: | - echo "IMAGE_NAME=${GITHUB_REPOSITORY,,}" >> "$GITHUB_ENV" - - name: Checkout repository uses: actions/checkout@v4 @@ -97,15 +108,15 @@ jobs: env: TAG: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest run: | - architectures=("x86_64" "aarch64") + architectures=("amd64" "arm64") for arch in "${architectures[@]}"; do docker load < images/container-"$arch"/*.tar.gz - docker tag teawiebot:latest-"$arch" "$TAG"-"$arch" + docker tag teawie-bot:latest-"$arch" "$TAG"-"$arch" docker push "$TAG"-"$arch" done docker manifest create "$TAG" \ - --amend "$TAG"-x86_64 \ - --amend "$TAG"-aarch64 + --amend "$TAG"-amd64 \ + --amend "$TAG"-arm64 docker manifest push "$TAG" diff --git a/.github/workflows/update-flake.yaml b/.github/workflows/update-flake.yaml index 968fc15..06eabfd 100644 --- a/.github/workflows/update-flake.yaml +++ b/.github/workflows/update-flake.yaml @@ -20,15 +20,14 @@ jobs: uses: actions/checkout@v4 - name: Install Nix - uses: DeterminateSystems/nix-installer-action@v12 + uses: DeterminateSystems/nix-installer-action@v13 - name: Update flake.lock & make PR - uses: DeterminateSystems/update-flake-lock@v23 id: update + uses: DeterminateSystems/update-flake-lock@v23 with: commit-msg: "nix: update flake.lock" pr-title: "nix: update flake.lock" - token: ${{ secrets.MERGE_TOKEN }} - name: Enable auto-merge if: env.PR_ID != '' |
