automatic-timezoned 2.0.134

Automatically update system timezone based on location
name: build

on:
  push:
    branches:
      - main
  pull_request:
    branches:
      - main

concurrency:
  group: ${{ github.workflow }}-${{ github.event.number || github.ref }}
  cancel-in-progress: true

env:
  RUSTFLAGS: --deny warnings
  RUSTDOCFLAGS: --deny warnings

jobs:
  test:
    strategy:
      matrix:
        runs-on:
          - ubuntu-24.04
          - ubuntu-24.04-arm

    runs-on: ${{ matrix.runs-on }}

    timeout-minutes: 10

    steps:
      - name: Checkout repository
        uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
        with:
          fetch-depth: 2

      - name: Set up Rust
        run: rustup show

      - name: Set up Rust cache
        uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1

      - name: Test
        run: cargo --color=always test

  lint:
    runs-on: ubuntu-24.04

    timeout-minutes: 10

    steps:
      - name: Checkout repository
        uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
        with:
          fetch-depth: 2

      - name: Set up Rust
        run: rustup show

      - name: Set up Rust cache
        uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1

      - name: Run clippy
        run: cargo --color=always clippy

      - name: Run doc
        run: cargo --color=always doc

      - name: Run fmt
        run: cargo --color=always fmt --check

  audit:
    runs-on: ubuntu-24.04

    timeout-minutes: 10

    steps:
      - name: Checkout repository
        uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
        with:
          fetch-depth: 2

      - name: Set up Rust
        run: rustup show

      - name: Set up Rust cache
        uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1

      - name: Set up cargo-audit
        run: cargo --color=always install --locked cargo-audit --version "${CARGO_AUDIT_VERSION}"
        env:
          # renovate: datasource=crate depName=cargo-audit versioning=cargo
          CARGO_AUDIT_VERSION: =0.22.1

      - name: Audit
        run: cargo --color=always audit --deny warnings

  build:
    runs-on: ubuntu-24.04

    timeout-minutes: 10

    steps:
      - name: Checkout repository
        uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
        with:
          fetch-depth: 2

      - name: Set up Rust
        run: rustup show

      - name: Set up Rust cache
        uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1

      - name: Build
        run: cargo --color=always build

  semantic-release:
    needs: [audit, build, lint, test]
    runs-on: ubuntu-24.04
    permissions:
      contents: write
      issues: write
      pull-requests: write

    timeout-minutes: 10

    steps:
      # full checkout for semantic-release
      - name: Checkout repository
        uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
        with:
          fetch-depth: 0
          # Use Deploy key with write access to push changelog to main branch (protected branch)
          ssh-key: ${{ secrets.SEMANTIC_RELEASE_SSH_KEY }}

      - name: Set up Rust
        run: rustup show

      - name: Set up Rust cache
        uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1

      - name: Semantic Release
        uses: cycjimmy/semantic-release-action@b12c8f6015dc215fe37bc154d4ad456dd3833c90 # v6.0.0
        with:
          # renovate: datasource=npm depName=semantic-release
          semantic_version: 25.0.3
          dry_run: ${{ github.event_name == 'pull_request' }}
          extra_plugins: |
            conventional-changelog-conventionalcommits@9.3.1
            @semantic-release/changelog@6.0.3
            @semantic-release/exec@7.1.0
            @semantic-release/git@10.0.1
        env:
          CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}