Skip to content

fix(core): allow micro payments #14813

fix(core): allow micro payments

fix(core): allow micro payments #14813

name: "Integration test"
on:
pull_request:
branches: [main]
types: [opened, synchronize, labeled, unlabeled]
jobs:
prepare:
name: prepare build args
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.prepare_args.outputs.matrix }}
steps:
- uses: actions/checkout@v4
- name: Prepare tilt args from labels
id: prepare_args
run: |
# Initialize variables
MATRIX="["
cat <<EOF > labels.json
${{ toJSON(github.event.pull_request.labels.*.name) }}
EOF
DEFAULT_LABELS=("dashboard" "consent" "pay" "core" "admin-panel" "map" "voucher")
LABELS=($(jq -r '.[]' < labels.json))
if [ ${#LABELS[@]} -eq 0 ]; then
LABELS=("${DEFAULT_LABELS[@]}")
elif [ ${#LABELS[@]} -eq 1 ] && [ "${LABELS[0]}" = "ci" ]; then
LABELS=("${DEFAULT_LABELS[@]}")
fi
# Core dependencies that might be needed
CORE_DEPS="//core/api:prod_build //core/notifications:notifications //:node_modules"
# Process each label into a matrix entry
for LABEL in "${LABELS[@]}"; do
BUILD_ARGS=""
# Add core dependencies if needed
case "$LABEL" in
core|dashboard|consent|pay|admin-panel|map|voucher)
BUILD_ARGS+=" $CORE_DEPS"
;;
esac
case "$LABEL" in
dashboard|voucher|consent)
BUILD_ARGS+=" //apps/consent:consent"
BUILD_ARGS+=" //core/api-keys:api-keys"
;;
esac
case "$LABEL" in
core) ;;
pay)
BUILD_ARGS+=" //apps/$LABEL:$LABEL-ci"
;;
dashboard|admin-panel|map|voucher)
BUILD_ARGS+=" //apps/$LABEL:$LABEL"
;;
esac
# Add matrix entry if we have build args
if [ ! -z "$BUILD_ARGS" ]; then
if [ "$MATRIX" != "[" ]; then
MATRIX+=","
fi
MATRIX+="{\"component\":\"$LABEL\",\"build_args\":\"$BUILD_ARGS\"}"
fi
done
MATRIX+="]"
echo "matrix=$MATRIX" >> "$GITHUB_OUTPUT"
build-and-test:
name: build and test ${{ matrix.component }}
needs: prepare
if: needs.prepare.outputs.matrix != '[]'
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include: ${{ fromJSON(needs.prepare.outputs.matrix) }}
steps:
- name: Maximize build space
uses: easimon/maximize-build-space@master
with:
root-reserve-mb: 15360
temp-reserve-mb: 12288
remove-dotnet: "true"
- uses: actions/checkout@v4
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@v14
- name: Run the Magic Nix Cache
uses: DeterminateSystems/magic-nix-cache-action@v8
- name: Build via buck2
run: nix develop -c buck2 build ${{ matrix.build_args }}
- name: Start deps and run tests via tilt
run: nix develop -c xvfb-run ./dev/bin/tilt-ci.sh ${{ matrix.component }}
- name: Prepare Tilt log
id: prepare_tilt_log
if: always()
run: |
TILT_LOG="dev/.e2e-tilt.log"
TARGET="dev/e2e-tilt-${{ matrix.component }}.log"
if [ -f "$TILT_LOG" ]; then
mv "$TILT_LOG" "$TARGET"
echo "prepared=true" >> "$GITHUB_OUTPUT"
else
echo "prepared=false" >> "$GITHUB_OUTPUT"
fi
- name: Upload Tilt log
if: steps.prepare_tilt_log.outputs.prepared == 'true'
uses: actions/upload-artifact@v4
with:
name: Tilt log - ${{ matrix.component }}
path: dev/e2e-tilt-${{ matrix.component }}.log