Merge pull request #799 from portier/auto/update-deps #1398
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: actions-rs/toolchain@v1 | |
with: | |
toolchain: '1.66' | |
profile: minimal | |
default: true | |
- name: Cache | |
uses: actions/cache@v3 | |
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: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
target: ${{ env.BUILD_TARGET }} | |
profile: minimal | |
components: rustfmt, clippy | |
default: true | |
- name: Cache | |
uses: actions/cache@v3 | |
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@v3 | |
with: | |
name: Linux binary (debug) | |
path: target/${{ env.BUILD_TARGET }}/debug/portier-broker | |
- name: Test | |
run: cargo test --locked --target $BUILD_TARGET | |
- name: Clippy | |
uses: actions-rs/clippy-check@v1 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- 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/ && yarn --frozen-lockfile | |
- name: E2E test Firefox | |
run: cd tests/e2e/ && SELENIUM_BROWSER=firefox ./main.js | |
- name: E2E test Chrome | |
run: cd tests/e2e/ && SELENIUM_BROWSER=chrome ./main.js | |
- name: E2E test Redis | |
run: cd tests/e2e/ && TEST_STORE=redis TEST_KEY_MANAGER=rotating ./main.js | |
- name: E2E test SQLite | |
run: cd tests/e2e/ && TEST_STORE=sqlite TEST_KEY_MANAGER=rotating ./main.js | |
- name: E2E test sendmail | |
run: cd tests/e2e/ && TEST_MAILER=sendmail ./main.js | |
- name: E2E test Postmark | |
run: cd tests/e2e/ && TEST_MAILER=postmark ./main.js | |
- name: E2E test Mailgun | |
run: cd tests/e2e/ && TEST_MAILER=mailgun ./main.js | |
macos-build: | |
runs-on: macos-latest | |
steps: | |
# Workaround for: https://github.com/actions/cache/issues/403 | |
- name: Install GNU tar | |
run: | | |
brew install gnu-tar | |
echo PATH="/usr/local/opt/gnu-tar/libexec/gnubin:$PATH" >> $GITHUB_ENV | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
profile: minimal | |
default: true | |
- name: Cache | |
uses: actions/cache@v3 | |
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@v3 | |
with: | |
name: MacOS binary (debug) | |
path: target/debug/portier-broker | |
- name: Test | |
run: cargo test --locked | |
- name: E2E test deps | |
run: cd tests/e2e/ && yarn --frozen-lockfile | |
- name: E2E test Safari | |
run: cd tests/e2e/ && SELENIUM_BROWSER=safari ./main.js | |
# TODO: fails sporadically | |
continue-on-error: true | |
timeout-minutes: 1 | |
windows-build: | |
runs-on: windows-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
profile: minimal | |
default: true | |
- name: Cache | |
uses: actions/cache@v3 | |
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@v3 | |
with: | |
name: Windows binary (debug) | |
path: target/debug/portier-broker.exe | |
- name: Test | |
run: cargo test --locked |