diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1d8468c9..2a0245d7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -55,6 +55,25 @@ jobs: name: ember-server path: target/release/ember-server + helm: + name: helm lint + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: azure/setup-helm@v4 + - name: lint + run: helm lint helm/ember + - name: template + run: helm template ember helm/ember + + docker: + name: docker build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: build + run: docker build -t ember:ci . + security: name: security runs-on: ubuntu-latest diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..def3b102 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,117 @@ +name: release + +on: + push: + tags: ["v*"] + +permissions: + contents: write + packages: write + +env: + CARGO_TERM_COLOR: always + +jobs: + build: + name: build ${{ matrix.target }} + runs-on: ${{ matrix.os }} + strategy: + matrix: + include: + - target: x86_64-unknown-linux-gnu + os: ubuntu-latest + artifact: ember-server-linux-amd64 + - target: aarch64-unknown-linux-gnu + os: ubuntu-latest + artifact: ember-server-linux-arm64 + - target: x86_64-apple-darwin + os: macos-latest + artifact: ember-server-darwin-amd64 + - target: aarch64-apple-darwin + os: macos-latest + artifact: ember-server-darwin-arm64 + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@stable + with: + targets: ${{ matrix.target }} + + - name: install cross-compilation tools + if: matrix.target == 'aarch64-unknown-linux-gnu' + run: | + sudo apt-get update + sudo apt-get install -y gcc-aarch64-linux-gnu + echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc" >> $GITHUB_ENV + + - uses: Swatinem/rust-cache@v2 + with: + key: ${{ matrix.target }} + + - name: build + run: cargo build --release --target ${{ matrix.target }} + + - name: package + run: | + mkdir -p dist + cp target/${{ matrix.target }}/release/ember-server dist/${{ matrix.artifact }} + + - name: upload artifact + uses: actions/upload-artifact@v4 + with: + name: ${{ matrix.artifact }} + path: dist/${{ matrix.artifact }} + + docker: + name: docker + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: extract version + id: version + run: echo "tag=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT + + - name: set up docker buildx + uses: docker/setup-buildx-action@v3 + + - name: login to ghcr + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: build and push + uses: docker/build-push-action@v6 + with: + context: . + push: true + tags: | + ghcr.io/${{ github.repository }}:${{ steps.version.outputs.tag }} + ghcr.io/${{ github.repository }}:latest + cache-from: type=gha + cache-to: type=gha,mode=max + + release: + name: github release + runs-on: ubuntu-latest + needs: [build, docker] + steps: + - uses: actions/checkout@v4 + + - name: download artifacts + uses: actions/download-artifact@v4 + with: + path: artifacts + + - name: collect binaries + run: | + mkdir -p release + find artifacts -type f -name 'ember-server-*' -exec cp {} release/ \; + cd release && sha256sum * > checksums.txt + + - name: create release + uses: softprops/action-gh-release@v2 + with: + generate_release_notes: true + files: release/* diff --git a/Dockerfile b/Dockerfile index 0a22054d..b52a4ae8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,6 +3,7 @@ FROM rust:1.93-slim AS builder RUN apt-get update && apt-get install -y --no-install-recommends \ pkg-config \ libssl-dev \ + make \ && rm -rf /var/lib/apt/lists/* WORKDIR /usr/src/ember