Repository navigation
Rust #1003
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Rust | |
| on: | |
| push: | |
| # Run every day at 3AM. | |
| schedule: | |
| - cron: "0 3 * * *" | |
| env: | |
| # Used by `postgresql_embedded` to download the PostgreSQL binaries which are embedded in inshd. | |
| # Downloading them without a token is subject to a much lower rate limit. | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| jobs: | |
| check: | |
| name: Check | |
| strategy: | |
| matrix: | |
| os: [ubuntu-latest, macos-latest] | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - uses: actions/checkout@v3 | |
| with: | |
| submodules: true | |
| - name: Cache build dependencies | |
| uses: actions/cache@v3 | |
| env: | |
| cache-name: deps | |
| with: | |
| path: ~/.cargo/registry/ | |
| key: ${{ env.cache-name }}-default-features-${{ hashFiles('Cargo.lock') }} | |
| restore-keys: | | |
| ${{ env.cache-name }}-default-features | |
| ${{ env.cache-name }}- | |
| - name: Cache the PostgreSQL archive | |
| uses: actions/cache@v3 | |
| env: | |
| cache-name: postgresql-archive | |
| with: | |
| path: ~/.theseus/ | |
| key: ${{ env.cache-name }}-${{ hashFiles('.cargo/config.toml') }} | |
| restore-keys: | | |
| ${{ env.cache-name }}- | |
| - name: Cache build output | |
| uses: actions/cache@v3 | |
| env: | |
| cache-name: rustc | |
| with: | |
| path: target/ | |
| key: ${{ env.cache-name }}-debug-check-default-features | |
| restore-keys: | | |
| ${{ env.cache-name }}-debug- | |
| ${{ env.cache-name }}- | |
| - name: Check that it compiles | |
| run: ./cargo-scripts/check | |
| check-with-logging-feature: | |
| name: Check (with logging feature) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| with: | |
| submodules: true | |
| - name: Cache build dependencies | |
| uses: actions/cache@v3 | |
| env: | |
| cache-name: deps | |
| with: | |
| path: ~/.cargo/registry/ | |
| key: ${{ env.cache-name }}-with-logging-${{ hashFiles('Cargo.lock') }} | |
| restore-keys: | | |
| ${{ env.cache-name }}-with-logging- | |
| ${{ env.cache-name }}- | |
| - name: Cache the PostgreSQL archive | |
| uses: actions/cache@v3 | |
| env: | |
| cache-name: postgresql-archive | |
| with: | |
| path: ~/.theseus/ | |
| key: ${{ env.cache-name }}-${{ hashFiles('.cargo/config.toml') }} | |
| restore-keys: | | |
| ${{ env.cache-name }}- | |
| - name: Cache build output | |
| uses: actions/cache@v3 | |
| env: | |
| cache-name: rustc | |
| with: | |
| path: target/ | |
| key: ${{ env.cache-name }}-debug-check-with-logging | |
| restore-keys: | | |
| ${{ env.cache-name }}-debug- | |
| ${{ env.cache-name }}- | |
| - name: Check that it compiles with the logging feature enabled | |
| run: ./scripts/check-with-logging-feature | |
| lint: | |
| name: Lint | |
| strategy: | |
| matrix: | |
| os: [ubuntu-latest, macos-latest] | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - uses: actions/checkout@v3 | |
| with: | |
| submodules: true | |
| - name: Cache build dependencies | |
| uses: actions/cache@v3 | |
| env: | |
| cache-name: deps | |
| with: | |
| path: ~/.cargo/registry/ | |
| key: ${{ env.cache-name }}-default-features-${{ hashFiles('Cargo.lock') }} | |
| restore-keys: | | |
| ${{ env.cache-name }}-default-features | |
| ${{ env.cache-name }}- | |
| - name: Cache the PostgreSQL archive | |
| uses: actions/cache@v3 | |
| env: | |
| cache-name: postgresql-archive | |
| with: | |
| path: ~/.theseus/ | |
| key: ${{ env.cache-name }}-${{ hashFiles('.cargo/config.toml') }} | |
| restore-keys: | | |
| ${{ env.cache-name }}- | |
| - name: Cache build output | |
| uses: actions/cache@v3 | |
| env: | |
| cache-name: rustc | |
| with: | |
| path: target/ | |
| key: ${{ env.cache-name }}-debug-lint | |
| restore-keys: | | |
| ${{ env.cache-name }}-debug- | |
| ${{ env.cache-name }}- | |
| - name: Lint with clippy | |
| run: ./cargo-scripts/lint | |
| arbsego: | |
| name: Arbsego | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| with: | |
| submodules: true | |
| # Caches getting the Arbsego version from the truth file. | |
| - name: Cache Arbsego version | |
| id: cache-arbsego-version | |
| uses: actions/cache@v3 | |
| env: | |
| cache-name: arbsego-version-${{ hashFiles('truth.yaml') }} | |
| with: | |
| path: ~/arbsego-version.txt | |
| key: ${{ env.cache-name }} | |
| - if: ${{ steps.cache-arbsego-version.outputs.cache-hit != 'true' }} | |
| name: Cache Homebrew | |
| uses: actions/cache@v3 | |
| env: | |
| cache-name: homebrew | |
| with: | |
| path: ~/.cache/Homebrew | |
| key: ${{ env.cache-name }} | |
| - if: ${{ steps.cache-arbsego-version.outputs.cache-hit != 'true' }} | |
| name: Install yq | |
| run: | | |
| # Make sure Brew is setup. | |
| eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" | |
| # Install yq using Brew. | |
| brew install yq | |
| - if: ${{ steps.cache-arbsego-version.outputs.cache-hit != 'true' }} | |
| name: Get Abrsego version | |
| run: | | |
| # Make sure brew is setup. | |
| eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" | |
| # Get the version of Arbsego to use. | |
| ARBSEGO_VERSION="$(yq '.arbsego.version' < truth.yaml)" | |
| # Write the Arbsego version to use to a file. | |
| echo "${ARBSEGO_VERSION}" > ~/arbsego-version.txt | |
| # Since we are just testing w/ one platform I think we can get away with this for now. | |
| - name: Cache Arbsego binary | |
| id: cache-arbsego-binary | |
| uses: actions/cache@v3 | |
| env: | |
| cache-name: arbsego-binary | |
| with: | |
| path: ~/.cargo/bin/arbsego | |
| key: ${{ env.cache-name }}-${{ hashFiles('~/arbsego-version.txt') }} | |
| - if: ${{ steps.cache-arbsego-binary.outputs.cache-hit == 'true' }} | |
| name: Verify cached Arbsego binary | |
| id: very-cached-arbsego-binary | |
| continue-on-error: true | |
| run: | | |
| arbsego --version | |
| - if: ${{ steps.cache-arbsego-binary.outputs.cache-hit != 'true' || steps.very-cached-arbsego-binary.outcome == 'failure' }} | |
| name: Cache Arbsego build dependencies | |
| uses: actions/cache@v3 | |
| env: | |
| cache-name: arbsego-deps-${{ hashFiles('~/arbsego-version.txt') }} | |
| with: | |
| path: ~/.cargo/registry/ | |
| key: ${{ env.cache-name }}-${{ hashFiles('~/arbsego-version.txt') }} | |
| restore-keys: | | |
| ${{ env.cache-name }}- | |
| - if: ${{ steps.cache-arbsego-binary.outputs.cache-hit != 'true' || steps.very-cached-arbsego-binary.outcome == 'failure' }} | |
| name: Install Arbsego | |
| run: | | |
| # Get the version of Arbsego to use. | |
| ARBSEGO_VERSION="$(cat ~/arbsego-version.txt)" | |
| # Install Arbsego using cargo. | |
| cargo install --git https://github.com/AustinScola/arbsego.git --tag "v${ARBSEGO_VERSION}" | |
| - name: Lint using Arbsego | |
| env: | |
| CI: 1 | |
| run: | | |
| # Make sure brew is setup. | |
| eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" | |
| # Lint using Arbsego. | |
| ./scripts/lint-arbsego | |
| format: | |
| name: Format | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| with: | |
| submodules: true | |
| - name: Check formatting | |
| run: ./cargo-scripts/format -- --check | |
| test: | |
| name: Test | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| with: | |
| submodules: true | |
| - name: Cache build dependencies | |
| uses: actions/cache@v3 | |
| env: | |
| cache-name: deps | |
| with: | |
| path: ~/.cargo/registry/ | |
| key: ${{ env.cache-name }}-test-${{ hashFiles('Cargo.lock') }} | |
| restore-keys: | | |
| ${{ env.cache-name }}-test | |
| ${{ env.cache-name }}- | |
| - name: Cache the PostgreSQL archive | |
| uses: actions/cache@v3 | |
| env: | |
| cache-name: postgresql-archive | |
| with: | |
| path: ~/.theseus/ | |
| key: ${{ env.cache-name }}-${{ hashFiles('.cargo/config.toml') }} | |
| restore-keys: | | |
| ${{ env.cache-name }}- | |
| - name: Cache build output | |
| uses: actions/cache@v3 | |
| env: | |
| cache-name: rustc | |
| with: | |
| path: target/ | |
| key: ${{ env.cache-name }}-debug-test | |
| restore-keys: | | |
| ${{ env.cache-name }}-debug- | |
| ${{ env.cache-name }}- | |
| - name: Install apt dependencies | |
| run: sudo apt-get install libxcb1-dev | |
| - name: Test | |
| run: cargo test | |
| audit: | |
| name: Audit | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| with: | |
| submodules: true | |
| - name: Get cargo-audit version | |
| id: cargo-audit-version | |
| run: | | |
| echo "version=$(yq '.cargo-audit.version' < truth.yaml)" >> "${GITHUB_OUTPUT}" | |
| - name: Restore cargo-audit binary | |
| id: cache-cargo-audit-binary | |
| uses: actions/cache/restore@v3 | |
| env: | |
| cache-name: cargo-audit-binary | |
| with: | |
| path: ~/.cargo/bin/cargo-audit | |
| key: ${{ env.cache-name }}-${{ steps.cargo-audit-version.outputs.version }} | |
| - if: ${{ steps.cache-cargo-audit-binary.outputs.cache-hit == 'true' }} | |
| name: Verify cached cargo-audit binary | |
| id: verify-cached-cargo-audit-binary | |
| continue-on-error: true | |
| run: | | |
| cargo-audit --version | |
| - if: ${{ steps.cache-cargo-audit-binary.outputs.cache-hit != 'true' || steps.verify-cached-cargo-audit-binary.outcome == 'failure' }} | |
| name: Restore cargo-audit build dependencies | |
| id: cache-cargo-audit-deps | |
| uses: actions/cache/restore@v3 | |
| env: | |
| cache-name: cargo-audit-deps | |
| with: | |
| path: ~/.cargo/registry/ | |
| key: ${{ env.cache-name }}-${{ steps.cargo-audit-version.outputs.version }} | |
| restore-keys: | | |
| ${{ env.cache-name }}- | |
| - if: ${{ steps.cache-cargo-audit-binary.outputs.cache-hit != 'true' || steps.verify-cached-cargo-audit-binary.outcome == 'failure' }} | |
| name: Install cargo-audit | |
| id: install-cargo-audit | |
| run: | | |
| # Install cargo-audit using cargo. | |
| cargo install cargo-audit --locked \ | |
| --version "${{ steps.cargo-audit-version.outputs.version }}" | |
| # Save before auditing since a failing audit would skip the post-job saves. | |
| - if: ${{ steps.install-cargo-audit.outcome == 'success' && steps.cache-cargo-audit-deps.outputs.cache-hit != 'true' }} | |
| name: Save cargo-audit build dependencies | |
| uses: actions/cache/save@v3 | |
| with: | |
| path: ~/.cargo/registry/ | |
| key: ${{ steps.cache-cargo-audit-deps.outputs.cache-primary-key }} | |
| - if: ${{ steps.install-cargo-audit.outcome == 'success' }} | |
| name: Save cargo-audit binary | |
| uses: actions/cache/save@v3 | |
| with: | |
| path: ~/.cargo/bin/cargo-audit | |
| key: ${{ steps.cache-cargo-audit-binary.outputs.cache-primary-key }} | |
| - name: Audit for vulnerabilities | |
| env: | |
| BOOTSTRAP: no | |
| run: ./cargo-scripts/audit |