Merge pull request #939 from portier/auto/update-deps #1683
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: Build | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
jobs: | |
toolchain-compat: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@1.77 | |
- name: Cache | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/.cargo/registry | |
~/.cargo/git | |
target | |
key: ${{ runner.os }}-cargo-mintoolchain-${{ hashFiles('**/Cargo.lock') }} | |
- name: Check | |
run: cargo check --locked | |
linux-build: | |
runs-on: ubuntu-latest | |
env: | |
BUILD_TARGET: x86_64-unknown-linux-musl | |
# For E2E tests. | |
PORTIER_BIN: target/x86_64-unknown-linux-musl/debug/portier-broker | |
services: | |
redis: | |
image: redis:latest | |
ports: | |
- 6379:6379 | |
steps: | |
- name: APT dependencies | |
run: sudo apt-get install gettext musl-tools | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
targets: ${{ env.BUILD_TARGET }} | |
components: rustfmt, clippy | |
- name: Cache | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/.cargo/registry | |
~/.cargo/git | |
target | |
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
- name: Build | |
run: cargo build --locked --target $BUILD_TARGET | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: Linux binary (debug) | |
path: target/${{ env.BUILD_TARGET }}/debug/portier-broker | |
- name: Test | |
run: cargo test --locked --target $BUILD_TARGET | |
- name: Clippy | |
run: cargo clippy --locked --target $BUILD_TARGET | |
- name: Rustfmt | |
run: cargo fmt -- --check | |
- name: Check translations | |
run: | | |
set -e | |
if [ -n "$(git status -s)" ]; then | |
echo "Working tree dirty before checking translations:" | |
echo | |
git status | |
exit 1 | |
fi | |
./msgfmt.sh | |
if [ -n "$(git status -s)" ]; then | |
echo "Working tree dirty after checking translations." | |
echo "If this fails, the lang/*.mo files are out of date." | |
echo "To fix this, run: ./msgfmt.sh" | |
echo | |
git status | |
exit 1 | |
fi | |
# Feature `insecure` is used so the broker can connect to | |
# the plain HTTP server created by the E2E test harness. | |
- name: Build insecure | |
run: cargo build --locked --target $BUILD_TARGET --features insecure | |
- name: E2E test deps | |
run: cd tests/e2e/ && corepack enable && yarn | |
timeout-minutes: 10 | |
- name: E2E test Firefox | |
run: cd tests/e2e/ && SELENIUM_BROWSER=firefox ./main.js | |
timeout-minutes: 10 | |
- name: E2E test Chrome | |
run: cd tests/e2e/ && SELENIUM_BROWSER=chrome ./main.js | |
timeout-minutes: 10 | |
- name: E2E test Redis | |
run: cd tests/e2e/ && TEST_STORE=redis TEST_KEY_MANAGER=rotating ./main.js | |
timeout-minutes: 10 | |
- name: E2E test SQLite | |
run: cd tests/e2e/ && TEST_STORE=sqlite TEST_KEY_MANAGER=rotating ./main.js | |
timeout-minutes: 10 | |
- name: E2E test sendmail | |
run: cd tests/e2e/ && TEST_MAILER=sendmail ./main.js | |
timeout-minutes: 10 | |
- name: E2E test Postmark | |
run: cd tests/e2e/ && TEST_MAILER=postmark ./main.js | |
timeout-minutes: 10 | |
- name: E2E test Mailgun | |
run: cd tests/e2e/ && TEST_MAILER=mailgun ./main.js | |
timeout-minutes: 10 | |
- name: E2E test SendGrid | |
run: cd tests/e2e/ && TEST_MAILER=sendgrid ./main.js | |
timeout-minutes: 10 | |
macos-build: | |
runs-on: macos-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@stable | |
- name: Cache | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/.cargo/registry | |
~/.cargo/git | |
target | |
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
- name: Build | |
run: cargo build --locked | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: MacOS binary (debug) | |
path: target/debug/portier-broker | |
- name: Test | |
run: cargo test --locked | |
- name: E2E test deps | |
run: cd tests/e2e/ && corepack enable && yarn | |
timeout-minutes: 10 | |
- name: E2E test Safari | |
run: cd tests/e2e/ && SELENIUM_BROWSER=safari ./main.js | |
timeout-minutes: 10 | |
# TODO: fails sporadically | |
continue-on-error: true | |
windows-build: | |
runs-on: windows-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@stable | |
# Required for building AWS Libcrypto | |
- name: Install NASM | |
uses: ilammy/setup-nasm@v1 | |
- name: Cache | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/.cargo/registry | |
~/.cargo/git | |
target | |
key: v1-${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
- name: Build | |
run: cargo build --locked | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: Windows binary (debug) | |
path: target/debug/portier-broker.exe | |
- name: Test | |
run: cargo test --locked |