Skip to content

feat(akash): reduce gas prices to average #39

feat(akash): reduce gas prices to average

feat(akash): reduce gas prices to average #39

Workflow file for this run

name: test
on:
push:
branches:
- '**'
pull_request:
workflow_dispatch:
inputs:
projects:
description: 'Comma separated list of projects to test'
required: false
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
list_changed_directories:
if: ${{ github.event_name == 'pull_request' || github.event_name == 'push' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: sankichi92/list-changed-directories@v1
id: list_changed_directories
if: ${{ !env.ACT }}
continue-on-error: true
with:
target-file: build.yml
common-dependency-paths: |-
Dockerfile
.github/workflows/test.yml
outputs:
projects: ${{ steps.list_changed_directories.outputs.changed-directories }}
build_matrix:
if: ${{ always() }}
needs: list_changed_directories
runs-on: ubuntu-latest
env:
PROJECTS: ${{ github.event.inputs.projects }}
steps:
- uses: actions/checkout@v4
- id: set-matrix
run: |
if [ -n "${{ env.PROJECTS }}" ]; then
echo "matrix=$(echo "${{ env.PROJECTS }}" | sed 's/, */,/g' | tr ',' '\n' | jq --raw-input . | jq -c --slurp .)" >> $GITHUB_OUTPUT
else
changed_directories=${{ toJson(needs.list_changed_directories.outputs.projects) }}
if [[ -n "$changed_directories" && "$changed_directories" != "null" ]]; then
echo "matrix=$changed_directories" >> $GITHUB_OUTPUT
else
echo "matrix=$(find * -type f -name build.yml | xargs dirname | sort | uniq | jq --raw-input . | jq -c --slurp .)" >> $GITHUB_OUTPUT
fi
fi
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
build:
needs: build_matrix
if: always() && needs.build_matrix.outputs.matrix != '[]'
runs-on: ubuntu-latest
strategy:
fail-fast: false
max-parallel: 10
matrix:
project: ${{ fromJson(needs.build_matrix.outputs.matrix) }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build
uses: docker/bake-action@v5
with:
workdir: ${{ matrix.project}}
files: build.yml
allow: fs.read=..
load: true
set: |
node.tags=${{ matrix.project }}
node.platform=linux/amd64
# cache is disabled for now
# we build too many images for it to be useful
# it causes cache timeouts and overuse of the 10GB cache limit
# node.cache-from=type=gha,scope=${{ matrix.project }}
# node.cache-to=type=gha,mode=max,scope=${{ matrix.project }}
- name: Test version
if: ${{ matrix.project != 'generic' }}
run: |
cd ${{ matrix.project }}
PROJECT=${{ matrix.project }}
PROJECT_BIN=$(yq '.services.node.build.args.PROJECT_BIN // ""' ./build.yml)
PROJECT_BIN="${PROJECT_BIN:-$PROJECT}"
VERSION=$(yq '.services.node.build.args.VERSION' ./build.yml)
VERSION_CMD=$(yq '.services.node.build.args.VERSION_CMD // ""' ./build.yml)
VERSION_CMD="${VERSION_CMD:-$PROJECT_BIN version}"
VERSION_OUTPUT=$(docker run --platform=linux/amd64 --entrypoint='' $PROJECT $VERSION_CMD 2>&1 || true)
if ! echo "$VERSION_OUTPUT" | grep -q "${VERSION#v}"; then
echo "Expected: $VERSION"
echo "Got: $VERSION_OUTPUT"
exit 1
else
echo "Success: $VERSION_OUTPUT"
fi