Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added GitHub Actions CI #1455

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
77 changes: 77 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: CI

on:
push:
pull_request:
schedule:
- cron: '0 0 * * 0'

jobs:
Mail-in-a-Box:
name: Mail-in-a-Box

runs-on: ${{ matrix.os }}
strategy:
matrix:
# Add Ubuntu 26.04 here when supported.
os: [ubuntu-22.04]
fail-fast: false
env:
NONINTERACTIVE: 1
PUBLIC_IP: auto
PUBLIC_IPV6: auto
PRIMARY_HOSTNAME: auto
SKIP_NETWORK_CHECKS: 1
PYTHONDEVMODE: 1
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Before Script
run: |
set -x
cat /etc/hosts
# Adds a hostname to the hosts file.
sudo sed -i "/^127\.0\.0\.1/a 127.0.0.1\t$HOSTNAME.example.com\t$HOSTNAME" /etc/hosts
- name: Script
run: |
set -x
# Compiles all Python files to check syntax
shopt -s globstar; python3 -m compileall -o{0..2} -x tools/mail.py */**.py || true
# Runs the script.
sudo -E bash -e -o pipefail -- setup/start.sh
# Verifies all the services are running by getting the HTTP headers.
curl -sSIkLf "https://$HOSTNAME/"
curl -sSIkLf "https://$HOSTNAME/admin"
curl -sSIkLf "https://$HOSTNAME/mail/"
curl -sSIkLf "https://$HOSTNAME/cloud/" || true
# Runs the test suite. Uncomment these three lines once #1039 is merged.
# cd test
# python3 -m pip install -r requirements.txt
# pytest

ShellCheck:
name: ShellCheck

runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: ShellCheck
run: shopt -s globstar; shellcheck -o avoid-nullary-conditions,check-extra-masked-returns,check-set-e-suppressed,deprecate-which,quote-safe-variables,require-double-brackets -s bash **/*.sh tools/{dns,web}_update
# Remove this line once all errors are fixed.
continue-on-error: true

Ruff:
name: Ruff

runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: |
python3 -m pip install --upgrade pip
python3 -m pip install ruff
- name: Script
run: ruff check --output-format=github --select F,E4,E7,E9,W,UP,YTT,S,BLE,B,A,C4,T10,DJ,EM,EXE,ISC,ICN,G,PIE,PYI,Q003,Q004,RSE,RET,SLF,SLOT,SIM,TID,TCH,ARG,PGH,PL,TRY,FLY,PERF,FURB,LOG,RUF --ignore W191,PLR09,PLR1702,PLR2004,RUF001,RUF002,RUF003,RUF023 --target-version py310 --preview . --exclude tools/mail.py
# Remove this line once all errors are fixed.
continue-on-error: true
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
[![CI](https://github.com/mail-in-a-box/mailinabox/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/mail-in-a-box/mailinabox/actions/workflows/ci.yml)

Mail-in-a-Box
=============

Expand Down