Skip to content

Test CI Times For https://github.com/swift-on-server/articles/pull/23 #21

Test CI Times For https://github.com/swift-on-server/articles/pull/23

Test CI Times For https://github.com/swift-on-server/articles/pull/23 #21

Workflow file for this run

name: mmbm-deploy
on:
pull_request: { types: [opened, reopened, synchronize, ready_for_review] }
push: { branches: [main] }
jobs:
deploy:
runs-on: swift:6.0-jammy
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install zstd
run: |
apt-get update -y
apt-get install -y zstd
- name: Restore .build
id: "restore-build"
uses: actions/cache/restore@v4
with:
path: .build
key: "swiftpm-build-${{ runner.os }}-${{ github.event.pull_request.base.sha || github.event.after }}"
restore-keys: "swiftpm-build-${{ runner.os }}-"
- name: Build App
run: |
apt-get update -y
apt-get install -y libjemalloc-dev
swift build \
-c release \
--static-swift-stdlib \
-Xlinker -ljemalloc \
$([ -f ./Package.resolved ] && echo "--force-resolved-versions" || true)
- name: Cache .build
if: steps.restore-build.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
path: .build
key: "swiftpm-build-${{ runner.os }}-${{ github.event.pull_request.base.sha || github.event.after }}"
- name: Install Docker
run: |
set -eu
# https://docs.docker.com/engine/install/ubuntu/#install-using-the-repository
# Add Docker's official GPG key:
apt-get update -y
apt-get install ca-certificates curl gnupg -y
install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg
chmod a+r /etc/apt/keyrings/docker.gpg
# Add the repository to Apt sources:
# shellcheck source=/dev/null
echo \
"deb [arch=\"$(dpkg --print-architecture)\" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
\"$(. /etc/os-release && echo "$VERSION_CODENAME")\" stable" |
tee /etc/apt/sources.list.d/docker.list >/dev/null
apt-get update -y
# Install Docker:
apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin -y
- name: Build image
run: docker build --network=host -t app:latest -f template-dockerfile .
# Push the image to a Docker container registry