ci: remove redundant version
attribute, avoid lldb
personality error
#184
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: CI | |
on: | |
push: | |
pull_request_target: | |
permissions: | |
contents: read | |
packages: write | |
env: | |
DOCKER_DRIVER: overlay2 | |
FAST_MODE: false | |
jobs: | |
build-image: | |
name: Build Image | |
runs-on: ubuntu-22.04 | |
outputs: | |
image-tag: ${{ steps.prepare.outputs.image-tag }} | |
repo-name: ${{ steps.prepare.outputs.repo-name }} | |
dep-matrix: ${{ steps.prepare.outputs.dep-matrix }} | |
src-matrix: ${{ steps.prepare.outputs.src-matrix }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
- name: Prepare | |
id: prepare | |
run: | | |
BRANCH_NAME=$(echo "${GITHUB_REF##*/}" | tr '[:upper:]' '[:lower:]') | |
REPO_NAME=$(echo "${{ github.repository }}" | tr '[:upper:]' '[:lower:]') | |
echo "image-tag=${BRANCH_NAME}" >> $GITHUB_OUTPUT | |
echo "repo-name=${REPO_NAME}" >> $GITHUB_OUTPUT | |
echo "dep-matrix=$(jq -r '.dep' -c .github/workflows/matrix.json)" >> $GITHUB_OUTPUT | |
echo "src-matrix=$(jq -r '.src' -c .github/workflows/matrix.json)" >> $GITHUB_OUTPUT | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v6 | |
with: | |
context: ./contrib/containers/ci | |
file: ./contrib/containers/ci/Dockerfile | |
push: true | |
tags: | | |
ghcr.io/${{ steps.prepare.outputs.repo-name }}/dashcore-ci-runner:${{ steps.prepare.outputs.image-tag }} | |
ghcr.io/${{ steps.prepare.outputs.repo-name }}/dashcore-ci-runner:latest | |
cache-from: type=registry,ref=ghcr.io/${{ steps.prepare.outputs.repo-name }}/dashcore-ci-runner:latest | |
cache-to: type=inline | |
build-depends: | |
name: ${{ matrix.depends_name }} | |
needs: build-image | |
runs-on: ubuntu-22.04 | |
strategy: | |
fail-fast: false | |
matrix: ${{ fromJson(needs.build-image.outputs.dep-matrix) }} | |
container: | |
image: ghcr.io/${{ needs.build-image.outputs.repo-name }}/dashcore-ci-runner:${{ needs.build-image.outputs.image-tag }} | |
options: --user root | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
- name: Cache depends sources | |
uses: actions/cache@v4 | |
with: | |
path: | | |
depends/sources | |
key: depends-sources-${{ hashFiles('depends/packages/*') }} | |
restore-keys: | | |
depends-sources- | |
- name: Determine params | |
id: det-params | |
run: | | |
dep_name="${{ matrix.depends_name }}" | |
dep_opts="${{ matrix.dep_opts }}" | |
dep_hash="$(echo -n ${dep_opts} | sha256sum | head -c 64)" | |
echo "\"${dep_name}\" has DEP_OPTS \"${dep_opts}\" with hash \"${dep_hash}\"" | |
echo "dep_hash=${dep_hash}" >> $GITHUB_OUTPUT | |
- name: Cache depends | |
uses: actions/cache@v4 | |
with: | |
path: | | |
depends/built | |
depends/${{ matrix.host }} | |
key: ${{ runner.os }}-depends-${{ matrix.depends_name }}-${{ hashFiles('depends/packages/*') }}-${{ steps.det-params.outputs.dep_hash }} | |
restore-keys: | | |
${{ runner.os }}-depends-${{ matrix.depends_name }}-${{ hashFiles('depends/packages/*') }}- | |
${{ runner.os }}-depends-${{ matrix.depends_name }}- | |
- name: Build depends | |
run: env HOST=${{ matrix.host }} ${{ matrix.dep_opts }} make -j$(nproc) -C depends | |
build: | |
name: ${{ matrix.build_target }} | |
needs: [build-image, build-depends] | |
runs-on: ubuntu-22.04 | |
strategy: | |
fail-fast: false | |
matrix: ${{ fromJson(needs.build-image.outputs.src-matrix) }} | |
container: | |
image: ghcr.io/${{ needs.build-image.outputs.repo-name }}/dashcore-ci-runner:${{ needs.build-image.outputs.image-tag }} | |
options: --user root | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
- name: Determine params | |
id: det-params | |
run: | | |
dep_name="${{ matrix.depends_name }}" | |
dep_opts="$(jq -r ".dep.include[] | select(.depends_name == \"${{ matrix.depends_name }}\") | .dep_opts" -c .github/workflows/matrix.json)" | |
dep_hash="$(echo -n ${dep_opts} | sha256sum | head -c 64)" | |
echo "\"${dep_name}\" has DEP_OPTS \"${dep_opts}\" with hash \"${dep_hash}\"" | |
echo "dep_hash=${dep_hash}" >> $GITHUB_OUTPUT | |
dep_host="$(jq -r ".dep.include[] | select(.depends_name == \"${{ matrix.depends_name }}\") | .host" -c .github/workflows/matrix.json)" | |
echo "\"${dep_name}\" has HOST \"${dep_host}\"" | |
echo "dep_host=${dep_host}" >> $GITHUB_OUTPUT | |
- name: Restore depends cache | |
uses: actions/cache/restore@v4 | |
with: | |
path: | | |
depends/built | |
depends/${{ steps.det-params.outputs.dep_host }} | |
key: ${{ runner.os }}-depends-${{ matrix.depends_name }}-${{ hashFiles('depends/packages/*') }}-${{ steps.det-params.outputs.dep_hash }} | |
restore-keys: | | |
${{ runner.os }}-depends-${{ matrix.depends_name }}-${{ hashFiles('depends/packages/*') }}- | |
${{ runner.os }}-depends-${{ matrix.depends_name }}- | |
- name: Determine PR Base SHA | |
id: vars | |
run: | | |
echo "PR_BASE_SHA=${{ github.event.pull_request.base.sha || '' }}" >> $GITHUB_OUTPUT | |
- name: CCache | |
uses: actions/cache@v4 | |
with: | |
path: | | |
/cache | |
key: ${{ runner.os }}-${{ matrix.build_target }}-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-${{ matrix.build_target }}-${{ github.sha }} | |
${{ runner.os }}-${{ matrix.build_target }}-${{ steps.vars.outputs.PR_BASE_SHA }} | |
${{ runner.os }}-${{ matrix.build_target }} | |
- name: Build source and run tests | |
run: | | |
git config --global --add safe.directory "$PWD" | |
CCACHE_SIZE="400M" | |
CACHE_DIR="/cache" | |
mkdir /output | |
BASE_OUTDIR="/output" | |
BUILD_TARGET="${{ matrix.build_target }}" | |
source ./ci/dash/matrix.sh | |
./ci/dash/build_src.sh | |
./ci/dash/test_unittests.sh | |
shell: bash | |
- name: Upload build artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: build-artifacts-${{ matrix.build_target }} | |
path: | | |
/output |