Skip to content

Commit fd8edbf

Browse files
committed
Added GitHub Actions CI.
1 parent 830c83d commit fd8edbf

File tree

3 files changed

+85
-0
lines changed

3 files changed

+85
-0
lines changed

.github/dependabot.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "github-actions"
4+
directory: "/"
5+
schedule:
6+
interval: "weekly"

.github/workflows/ci.yml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
pull_request:
6+
schedule:
7+
- cron: '0 0 * * 0'
8+
9+
jobs:
10+
Mail-in-a-Box:
11+
name: Mail-in-a-Box
12+
13+
runs-on: ${{ matrix.os }}
14+
strategy:
15+
matrix:
16+
# Add Ubuntu 26.04 here when supported.
17+
os: [ubuntu-22.04]
18+
fail-fast: false
19+
env:
20+
NONINTERACTIVE: 1
21+
PUBLIC_IP: auto
22+
PUBLIC_IPV6: auto
23+
PRIMARY_HOSTNAME: auto
24+
SKIP_NETWORK_CHECKS: 1
25+
PYTHONDEVMODE: 1
26+
steps:
27+
- uses: actions/checkout@v4
28+
with:
29+
fetch-depth: 0
30+
- name: Before Script
31+
run: |
32+
set -x
33+
cat /etc/hosts
34+
# Adds a hostname to the hosts file.
35+
sudo sed -i "/^127\.0\.0\.1/a 127.0.0.1\t$HOSTNAME.example.com\t$HOSTNAME" /etc/hosts
36+
- name: Script
37+
run: |
38+
set -x
39+
# Compiles all Python files to check syntax
40+
shopt -s globstar; python3 -m compileall -o{0..2} -x tools/mail.py */**.py || true
41+
# Runs the script.
42+
sudo -E bash -e -o pipefail -- setup/start.sh
43+
# Verifies all the services are running by getting the HTTP headers.
44+
curl -sSIkLf "https://$HOSTNAME/"
45+
curl -sSIkLf "https://$HOSTNAME/admin"
46+
curl -sSIkLf "https://$HOSTNAME/mail/"
47+
curl -sSIkLf "https://$HOSTNAME/cloud/" || true
48+
# Runs the test suite. Uncomment these three lines once #1039 is merged.
49+
# cd test
50+
# python3 -m pip install -r requirements.txt
51+
# pytest
52+
53+
ShellCheck:
54+
name: ShellCheck
55+
56+
runs-on: ubuntu-latest
57+
steps:
58+
- uses: actions/checkout@v4
59+
- name: ShellCheck
60+
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
61+
# Remove this line once all errors are fixed.
62+
continue-on-error: true
63+
64+
Ruff:
65+
name: Ruff
66+
67+
runs-on: ubuntu-latest
68+
steps:
69+
- uses: actions/checkout@v4
70+
- name: Install dependencies
71+
run: |
72+
python3 -m pip install --upgrade pip
73+
python3 -m pip install ruff
74+
- name: Script
75+
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
76+
# Remove this line once all errors are fixed.
77+
continue-on-error: true

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
[![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)
2+
13
Mail-in-a-Box
24
=============
35

0 commit comments

Comments
 (0)