moved bot config to its own module #151
Workflow file for this run
This file contains 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: CI | |
on: | |
push: | |
paths-ignore: [ README.md ] | |
env: | |
CARGO_TERM_COLOR: always | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.repository }} | |
jobs: | |
tests: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
# https://www.mongodb.com/docs/manual/tutorial/install-mongodb-on-ubuntu/ | |
- name: Install mongod (test dependency) | |
run: | | |
sudo apt-get install gnupg curl | |
curl -fsSL https://www.mongodb.org/static/pgp/server-7.0.asc | \ | |
sudo gpg -o /usr/share/keyrings/mongodb-server-7.0.gpg \ | |
--dearmor | |
echo "deb [ arch=amd64,arm64 signed-by=/usr/share/keyrings/mongodb-server-7.0.gpg ] https://repo.mongodb.org/apt/ubuntu jammy/mongodb-org/7.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-7.0.list | |
sudo apt-get update | |
sudo apt-get install -y mongodb-org-server | |
- name: Install rust | |
uses: dtolnay/rust-toolchain@nightly | |
- name: Cache rust | |
uses: Swatinem/rust-cache@v2 | |
- name: Run tests | |
run: cargo test | |
docker: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
# This is used to complete the identity challenge | |
# with sigstore/fulcio when running outside of PRs. | |
id-token: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 | |
- name: Log into registry ${{ env.REGISTRY }} | |
if: ${{ github.ref_name == 'main' }} | |
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Extract Docker metadata for main branch | |
if: ${{ github.ref_name == 'main' }} | |
id: main_meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
tags: | | |
type=sha | |
git | |
main | |
- name: Extract Docker metadata for PR push | |
if: ${{ github.ref_name != 'main' }} | |
id: pr_meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
tags: | | |
type=ref,event=branch | |
type=sha | |
- name: Build and push image | |
uses: docker/build-push-action@v5 | |
if: ${{ github.ref_name == 'main' }} | |
with: | |
context: . | |
push: true | |
tags: ${{ steps.main_meta.outputs.tags }} | |
labels: ${{ steps.main_meta.outputs.labels }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
- name: Build image | |
uses: docker/build-push-action@v5 | |
if: ${{ github.ref_name != 'main' }} | |
with: | |
context: . | |
push: false | |
tags: ${{ steps.pr_meta.outputs.tags }} | |
labels: ${{ steps.pr_meta.outputs.labels }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |