Switch to docker build step for artifact #3
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: Master Branch CI | |
on: | |
push: | |
branches: [ "main", "master" ] | |
paths-ignore: | |
- '**.md' | |
- 'docs/**' | |
- '.gitignore' | |
env: | |
CARGO_TERM_COLOR: always | |
RUSTFLAGS: "-D warnings" | |
jobs: | |
test-and-lint: | |
name: Test and Lint | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install Rust toolchain | |
uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: 1.78.0 | |
components: clippy, rustfmt | |
- name: Cache dependencies | |
uses: Swatinem/rust-cache@v2 | |
with: | |
cache-directories: | | |
~/.cargo/registry/index | |
~/.cargo/registry/cache | |
~/.cargo/git | |
target | |
- name: Install dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y pkg-config libssl-dev | |
- name: Run tests | |
run: cargo test | |
- name: Check formatting | |
run: cargo fmt --all -- --check | |
- name: Run clippy | |
run: cargo clippy --all-targets | |
build: | |
name: Build Release (${{ matrix.target }}) | |
runs-on: ubuntu-latest | |
needs: test-and-lint | |
strategy: | |
matrix: | |
include: | |
- target: x86_64-unknown-linux-gnu | |
artifact_name: ghost-resend-mailer-x86_64-linux | |
platform: linux/amd64 | |
- target: aarch64-unknown-linux-gnu | |
artifact_name: ghost-resend-mailer-aarch64-linux | |
platform: linux/arm64 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Create builder container | |
run: | | |
docker buildx create --name multiarch-builder --driver docker-container --bootstrap | |
docker buildx use multiarch-builder | |
- name: Build in Docker | |
run: | | |
docker buildx build --platform ${{ matrix.platform }} \ | |
--build-arg RUST_TARGET=${{ matrix.target }} \ | |
--output type=local,dest=./output \ | |
-f .github/workflows/build.Dockerfile . | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.artifact_name }} | |
path: output/ghost-resend-mailer | |
retention-days: 7 |