feat: Add CI environment setup and verification workflows with Docker support
Some checks failed
Test / test-frontend (pull_request) Successful in 43s
Test / lint-frontend (pull_request) Successful in 47s
Verify / get-ci-image (pull_request) Successful in 47s
Test / frontend-build (pull_request) Successful in 1m29s
Verify / verify-generated-db-entities (pull_request) Has been cancelled
Test / test-crates (pull_request) Has been cancelled
Test / lint-crates (pull_request) Has been cancelled
Some checks failed
Test / test-frontend (pull_request) Successful in 43s
Test / lint-frontend (pull_request) Successful in 47s
Verify / get-ci-image (pull_request) Successful in 47s
Test / frontend-build (pull_request) Successful in 1m29s
Verify / verify-generated-db-entities (pull_request) Has been cancelled
Test / test-crates (pull_request) Has been cancelled
Test / lint-crates (pull_request) Has been cancelled
This commit is contained in:
70
.github/actions/setup-ci-metadata/action.yaml
vendored
Normal file
70
.github/actions/setup-ci-metadata/action.yaml
vendored
Normal file
@@ -0,0 +1,70 @@
|
||||
name: 'Setup CI metadata'
|
||||
description: 'Composite action to derive the registry and CI image tag for the current repository.'
|
||||
inputs:
|
||||
registry:
|
||||
description: 'Container registry derived from the current GitHub server URL'
|
||||
required: false
|
||||
default: ''
|
||||
repository:
|
||||
description: 'GitHub repository in the format owner/repo'
|
||||
required: false
|
||||
default: ${{ github.repository }}
|
||||
image_tag:
|
||||
description: 'Tag for the CI image'
|
||||
required: false
|
||||
default: 'latest'
|
||||
outputs:
|
||||
registry:
|
||||
description: 'Container registry derived from the current GitHub server URL'
|
||||
value: ${{ steps.setup.outputs.registry }}
|
||||
image_tag:
|
||||
description: 'Fully qualified CI image tag'
|
||||
value: ${{ steps.setup.outputs.image_tag }}
|
||||
latest_tag:
|
||||
description: 'Fully qualified latest CI image tag'
|
||||
value: ${{ steps.setup.outputs.latest_tag }}
|
||||
runs:
|
||||
using: 'composite'
|
||||
steps:
|
||||
- name: Setup Dynamic Metadata
|
||||
id: setup
|
||||
shell: bash
|
||||
run: |
|
||||
# Extract the domain from server_url, handling both https:// and ssh:// schemes
|
||||
SERVER_URL="${{ github.server_url }}"
|
||||
|
||||
if [[ "$SERVER_URL" =~ ^ssh:// ]]; then
|
||||
# For SSH URLs like ssh://git@host:port/path, extract just the hostname
|
||||
SERVER_DOMAIN=$(echo "$SERVER_URL" | sed -e 's|^ssh://||' -e 's|^[^@]*@||' -e 's|:[0-9]*.*||')
|
||||
else
|
||||
# For HTTPS URLs, extract domain without scheme
|
||||
SERVER_DOMAIN=$(echo "$SERVER_URL" | sed -e 's|^[^/]*//||' -e 's|/.*$||')
|
||||
fi
|
||||
|
||||
echo "Extracted server domain: $SERVER_DOMAIN"
|
||||
|
||||
if [[ -n "${{ inputs.registry }}" ]]; then
|
||||
REGISTRY="${{ inputs.registry }}"
|
||||
elif [[ "$SERVER_DOMAIN" == "github.com" ]]; then
|
||||
REGISTRY="ghcr.io"
|
||||
else
|
||||
REGISTRY="$SERVER_DOMAIN"
|
||||
fi
|
||||
|
||||
# Extract owner/repo from github.repository, handling SSH URLs
|
||||
REPO="${{ inputs.repository }}"
|
||||
if [[ "$REPO" =~ ^ssh:// ]] || [[ "$REPO" =~ ^https:// ]]; then
|
||||
# Extract owner/repo from URLs like ssh://git@host/owner/repo.git or https://host/owner/repo.git
|
||||
REPO=$(echo "$REPO" | sed -e 's|^[^/]*/||' -e 's|\.git$||' | rev | cut -d'/' -f1,2 | rev)
|
||||
fi
|
||||
|
||||
# Docker image names must be lowercase
|
||||
REGISTRY="${REGISTRY,,}"
|
||||
REPO="${REPO,,}"
|
||||
|
||||
IMAGE_TAG="${REGISTRY}/${REPO}/ci:${{ inputs.image_tag }}"
|
||||
LATEST_TAG="${REGISTRY}/${REPO}/ci:latest"
|
||||
|
||||
echo "registry=$REGISTRY" >> "$GITHUB_OUTPUT"
|
||||
echo "image_tag=$IMAGE_TAG" >> "$GITHUB_OUTPUT"
|
||||
echo "latest_tag=$LATEST_TAG" >> "$GITHUB_OUTPUT"
|
||||
17
.github/actions/setup-rust/action.yaml
vendored
17
.github/actions/setup-rust/action.yaml
vendored
@@ -13,6 +13,10 @@ inputs:
|
||||
description: 'Comma-separated list of additional rust components to install'
|
||||
required: false
|
||||
default: 'clippy, rustfmt'
|
||||
skip_cache:
|
||||
description: 'Whether to skip restoring and uploading caches (useful for testing the workflow without cache interference)'
|
||||
required: false
|
||||
default: 'false'
|
||||
runs:
|
||||
using: 'composite'
|
||||
steps:
|
||||
@@ -23,6 +27,7 @@ runs:
|
||||
|
||||
- name: Cache cargo registry
|
||||
uses: actions/cache@v4
|
||||
if: inputs.skip_cache != 'true'
|
||||
with:
|
||||
path: ~/.cargo/registry
|
||||
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
|
||||
@@ -31,6 +36,7 @@ runs:
|
||||
|
||||
- name: Cache cargo index
|
||||
uses: actions/cache@v4
|
||||
if: inputs.skip_cache != 'true'
|
||||
with:
|
||||
path: ~/.cargo/index
|
||||
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
|
||||
@@ -42,7 +48,8 @@ runs:
|
||||
run: echo "SANITIZED_COMPONENTS=${{ inputs.components }}" | sed -E 's/, ?| /-/g' >> $GITHUB_ENV
|
||||
|
||||
- name: Cache Rust toolchain
|
||||
uses: actions/cache@v4
|
||||
uses: actions/cache@v3
|
||||
if: inputs.skip_cache != 'true'
|
||||
with:
|
||||
path: ~/.rustup
|
||||
# Key includes the OS and the toolchain version (e.g., 'stable')
|
||||
@@ -51,7 +58,8 @@ runs:
|
||||
${{ runner.os }}-rustup-
|
||||
|
||||
- name: Cache cargo build (target)
|
||||
uses: actions/cache@v4
|
||||
uses: actions/cache@v3
|
||||
if: inputs.skip_cache != 'true'
|
||||
with:
|
||||
path: target
|
||||
key: ${{ runner.os }}-cargo-build-${{ hashFiles('**/Cargo.lock') }}
|
||||
@@ -64,8 +72,3 @@ runs:
|
||||
toolchain: ${{ inputs.toolchain }}
|
||||
override: ${{ inputs.override }}
|
||||
components: ${{ inputs.components }}
|
||||
|
||||
- name: install protobuf compiler
|
||||
run: |
|
||||
apt-get update
|
||||
apt-get install -y protobuf-compiler
|
||||
|
||||
Reference in New Issue
Block a user