Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

82 feature request suggestion create GitHub actions workflow for automating the build and deployments for feature branches #87

Draft
wants to merge 80 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
80 commits
Select commit Hold shift + click to select a range
a4ef143
Add GitHub Actions workflow for building and deploying containers
lmcdonough Dec 13, 2024
bba90fb
fixed error with pr to main.
lmcdonough Dec 13, 2024
8e1570f
updates env vars to be injected into images on build
lmcdonough Dec 13, 2024
8a2a052
updates database url
lmcdonough Dec 13, 2024
f3b897c
Enhance GitHub Actions workflow for building and deploying containers…
lmcdonough Dec 15, 2024
91178bd
correcting attestations
lmcdonough Dec 15, 2024
8b2759d
Fix subject-name formatting in artifact attestation for backend and f…
lmcdonough Dec 15, 2024
09b38d9
fixes docker compose and build_and_run script.
lmcdonough Feb 8, 2025
13a682f
update docker-compose to use environment variables for backend command
lmcdonough Feb 8, 2025
01824ce
Update README and Container-README with additional information and Gi…
lmcdonough Feb 10, 2025
53896ee
Add GitHub Actions workflow for building and deploying containers
lmcdonough Dec 13, 2024
7af487f
fixed error with pr to main.
lmcdonough Dec 13, 2024
4ecd8bf
updates env vars to be injected into images on build
lmcdonough Dec 13, 2024
917fee3
updates database url
lmcdonough Dec 13, 2024
cf35509
Enhance GitHub Actions workflow for building and deploying containers…
lmcdonough Dec 15, 2024
5b9b337
correcting attestations
lmcdonough Dec 15, 2024
1972885
Fix subject-name formatting in artifact attestation for backend and f…
lmcdonough Dec 15, 2024
34944b2
fixes docker compose and build_and_run script.
lmcdonough Feb 8, 2025
b8c4c91
update docker-compose to use environment variables for backend command
lmcdonough Feb 8, 2025
bf6173a
Update README and Container-README with additional information and Gi…
lmcdonough Feb 10, 2025
507c295
added comment to dockerfile
lmcdonough Feb 14, 2025
4e9d593
Merge branch '82-feature-request-suggestion-create-github-actions-wor…
lmcdonough Feb 14, 2025
a66f9cd
Update Dockerfile and docker-compose for improved configuration and s…
lmcdonough Feb 14, 2025
0d1a724
Update Dockerfile to use the latest Rust image and upgrade log crate …
lmcdonough Feb 15, 2025
4595dc6
Update dependencies to latest versions including axum, sqlx, and utoipa
lmcdonough Feb 16, 2025
13ef8bd
removes sqlite dependencies from Cargo files.
lmcdonough Feb 21, 2025
36af35d
removes sqlite deps, upgrades tower for service
lmcdonough Feb 21, 2025
392dcc6
merges in main
lmcdonough Mar 6, 2025
f61c08b
merges remaining changes from main.
lmcdonough Mar 6, 2025
31fdd20
removing cargo clean, bc it can negate Docker layer Caching
lmcdonough Mar 6, 2025
fb44b95
removes sqlite dependencies, update tower version to 0.5.1
lmcdonough Mar 6, 2025
ca9ea8f
merges in changes from test branch.
lmcdonough Mar 14, 2025
9d044ef
removes sqlite dependency from Cargo.toml files.
lmcdonough Mar 14, 2025
8b80cbb
adds correspondong lock file.
lmcdonough Mar 14, 2025
4c4ef94
updates build and deploy container gh actions workflow
lmcdonough Mar 14, 2025
527edcb
noop: addresses README linting warning.
lmcdonough Mar 14, 2025
440f3a5
adds ARM64 cross-compilation tools to Docker builder image
lmcdonough Mar 14, 2025
95f71df
adds the ARM64 architecture support before installing ARM64-specific …
lmcdonough Mar 14, 2025
b96710a
adds openssl dependencies for cross compilation to Dockerfile and gh …
lmcdonough Mar 14, 2025
e600cf2
adds openssl and pkg config env vars to ci gh actions workflow
lmcdonough Mar 14, 2025
a25dab5
adds openssl env vars and aarch linux build deps in Dockerfile
lmcdonough Mar 14, 2025
2796831
adds cross additional build platform target to ci gh actions file and…
lmcdonough Mar 14, 2025
baa751f
adds support for aarch64 architecture in CI workflow by updating Rust…
lmcdonough Mar 14, 2025
e2f3726
brings ci.yml gh actions workflow to parity with main.
lmcdonough Mar 14, 2025
aae1a40
adds binutils for aarch64 to Dockerfile.
lmcdonough Mar 14, 2025
9acd530
adds ARM64 cross-compilation support in Dockerfile by installing nece…
lmcdonough Mar 14, 2025
3289c17
adds libssl-dev instalation to ci.yml gh actions workflow.
lmcdonough Mar 14, 2025
997c443
removes dpkg arm installs, moves symlink setup, ensures .cargo.confin…
lmcdonough Mar 15, 2025
8f8d0ea
adds QEMU setup, forces cargo to rebuild correct linker in gh actions…
lmcdonough Mar 15, 2025
03c67e9
adds support for aarch64 target in CI workflow and sets OpenSSL paths
lmcdonough Mar 15, 2025
b292702
adds matching cargo lock file
lmcdonough Mar 15, 2025
75e7d36
adds support for ARM64 cross-compilation in Dockerfile
lmcdonough Mar 15, 2025
50d962c
adds support for ARM64 architecture in Dockerfile and conditionally i…
lmcdonough Mar 15, 2025
d2a54c6
adds ARM64-specific packages to Dockerfile for cross-compilation support
lmcdonough Mar 15, 2025
f7d6541
removes ARM64-specific packages from Dockerfile to streamline install…
lmcdonough Mar 15, 2025
88c1ea1
refactors Dockerfile to create to builder images for compiling and ad…
lmcdonough Mar 18, 2025
83a974d
adds entrypoint.sh which dynamically determines the host architecture…
lmcdonough Mar 18, 2025
724b61e
reconciles Cargo.lock file
lmcdonough Mar 18, 2025
8eaac98
update conditional compilation and renames binary locationds from arc…
lmcdonough Mar 18, 2025
02b6204
updates entrypoint.sh to match new binary locations from docker image
lmcdonough Mar 18, 2025
d81af53
adds dpkg multi arch repo to dockerfile in second builder
lmcdonough Mar 18, 2025
be65587
limiting github container workflow to just workflow dispatch for testing
lmcdonough Mar 18, 2025
65f6c72
removes dpkg installation and arm package specification from builder …
lmcdonough Mar 18, 2025
7d7b6fe
adds modified Cargo.lock file
lmcdonough Mar 18, 2025
98c072c
adds ENV Vars for finding correct linker and compiler in Dockerfile
lmcdonough Mar 18, 2025
ee714fe
adds ENV vars to dynamically locate the compiler dependent on archite…
lmcdonough Mar 18, 2025
ca8cf1e
updates target directory to find binaries in merger image using env v…
lmcdonough Mar 18, 2025
cc721ed
adds openssl-sys crate
lmcdonough Mar 19, 2025
fd62a8c
adds arm env vars, apt dependencies, and cross to cargo and Dockerfile
lmcdonough Mar 19, 2025
df37620
adds vendored feature for openssl-sys, adds cross.
lmcdonough Mar 19, 2025
bc6b4ed
refactor Dockerfile for multi-platform support and conditional depend…
lmcdonough Mar 21, 2025
4ba7768
exposes port 8000 in dockerfile.
lmcdonough Mar 21, 2025
843f7a1
updates actions workflow for container builds
lmcdonough Mar 21, 2025
ffac161
refactor GitHub Actions workflow for improved readability and organiz…
lmcdonough Mar 21, 2025
051d1dd
add cross-compilation support for ARM64 in GitHub Actions workflow
lmcdonough Mar 21, 2025
53ace92
removes frontend Docker image build, will add gh actions workflow for…
lmcdonough Mar 21, 2025
c495a55
changes image naming convention to ghcr.io/refactor-group/refactor-pl…
lmcdonough Mar 21, 2025
d949880
refactor GitHub Actions workflow for multi-arch builds and improved c…
lmcdonough Mar 21, 2025
a17132c
refactor GitHub Actions ci workflow to simplify cache key for depende…
lmcdonough Mar 21, 2025
ae72837
adds badge for image build and storage workflow in README
lmcdonough Mar 21, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
142 changes: 142 additions & 0 deletions .github/workflows/build_and_deploy_containers.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
name: Build and Deploy Containers

on:
push:
branches:
- main
pull_request:
branches:
- main
types: [opened, synchronize, reopened]
workflow_dispatch:

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
build_test_run:
runs-on: ubuntu-22.04

steps:
# Checkout code
- uses: actions/checkout@v4

# Enable QEMU for multi-arch builds (arm64 on x86)
- name: Set up Rust + QEMU
uses: docker/setup-qemu-action@v2
with:
platforms: linux/amd64,linux/arm64

# Install ARM cross-compiler
- name: Install cross-compilation toolchain
run: |
sudo apt-get update
sudo apt-get install -y gcc-aarch64-linux-gnu

# Install Rust toolchain with both x86_64 and arm64 targets
- name: Set up Rust targets
uses: dtolnay/rust-toolchain@stable
with:
targets: x86_64-unknown-linux-gnu,aarch64-unknown-linux-gnu

# Cache Rust build artifacts to speed up builds
- uses: Swatinem/rust-cache@v2

# Install sea-orm-cli globally
- name: Install sea-orm-cli
run: cargo install sea-orm-cli

# Configure the Rust linker for arm64 builds
- name: Set linker for cross-compilation
run: |
mkdir -p ~/.cargo
echo '[target.aarch64-unknown-linux-gnu]' >> ~/.cargo/config.toml
echo 'linker = "aarch64-linux-gnu-gcc"' >> ~/.cargo/config.toml

# Build release binaries for ARM64
- name: Build release binaries
run: cargo build --release --workspace --target aarch64-unknown-linux-gnu

# Run tests for x86_64 (native)
- name: Run tests
run: cargo test --release

build_and_push_docker:
runs-on: ubuntu-22.04
needs: build_test_run
permissions:
contents: read
packages: write
attestations: write
id-token: write

steps:
# Checkout source code
- uses: actions/checkout@v4

# Authenticate to GitHub Container Registry
- name: Docker login
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

# Set up Docker Buildx for multi-platform builds
- uses: docker/setup-buildx-action@v3
with:
install: true

# Show current Docker cache usage
- name: Show Docker Build Cache (Before)
run: |
echo -e "\033[1;34m🔍 Checking buildx cache BEFORE build...\033[0m"
docker buildx du || echo -e "\033[1;33m⚠️ No cache found yet.\033[0m"

# Compute image name based on branch name and tag as `latest`
- name: Determine Image Tags
id: tags
run: |
BRANCH_NAME=${GITHUB_HEAD_REF:-${GITHUB_REF##*/}}
IMAGE_NAME="${{ env.REGISTRY }}/${{ github.repository }}/${BRANCH_NAME}"
echo "backend_tags=$IMAGE_NAME:latest" >> $GITHUB_OUTPUT
echo "backend_image_name=$IMAGE_NAME" >> $GITHUB_OUTPUT

# Build and push multi-arch Docker image with GHA cache
- name: Build + Push Backend
id: push_backend
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
platforms: linux/amd64,linux/arm64
push: true
provenance: true
tags: ${{ steps.tags.outputs.backend_tags }}
cache-from: type=gha
cache-to: type=gha,mode=max

# Show updated Docker cache state
- name: Show Docker Build Cache (After)
run: |
echo -e "\033[1;34m📦 Checking buildx cache AFTER build...\033[0m"
docker buildx du || echo -e "\033[1;31m❌ Failed to get updated cache info\033[0m"

# Generate SBOM + attestation only on main branch
- name: Attest Backend
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
uses: actions/attest-build-provenance@v2
with:
subject-name: ${{ steps.tags.outputs.backend_image_name }}
subject-digest: ${{ steps.push_backend.outputs.digest }}
push-to-registry: true

# Output how to pull and run the pushed image
- name: Print Usage Instructions
run: |
echo -e "\033[1;32m✅ Backend Image Pushed:\033[0m"
echo " docker pull ${{ steps.tags.outputs.backend_image_name }}:latest"
echo ""
echo -e "\033[1;36m▶️ Run Backend:\033[0m"
echo " docker run --rm -p 8000:8000 ${{ steps.tags.outputs.backend_image_name }}:latest"
12 changes: 11 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,17 @@ jobs:
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: x86_64-unknown-linux-gnu
targets: x86_64-unknown-linux-gnu,aarch64-unknown-linux-gnu

- name: Use cached dependencies
uses: Swatinem/rust-cache@v2
with:
key: "ubuntu-22.04-x86_64-and-aarch64"

- name: Set OpenSSL Paths
run: |
echo "OPENSSL_LIB_DIR=/usr/lib/x86_64-linux-gnu" >> $GITHUB_ENV
echo "OPENSSL_INCLUDE_DIR=/usr/include/x86_64-linux-gnu" >> $GITHUB_ENV

- name: Use cached dependencies
uses: Swatinem/rust-cache@v2
Expand Down
Loading
Loading