All apps -- all the time -- tons of improvements to make writing apps easier #4823
This file contains hidden or 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: BuildAndTest | |
on: [pull_request, workflow_dispatch] | |
env: | |
CHIFRA_PATH: src/apps/chifra | |
KHEDRA_PATH: khedra | |
# Go Version | |
GO_VERSION: 1.25.1 | |
jobs: | |
Lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
fetch-depth: 0 | |
- uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
cache: false | |
- name: Generate go.work file | |
run: | | |
./scripts/go-work-sync.sh | |
- name: Lint chifra | |
uses: golangci/golangci-lint-action@v8 | |
with: | |
version: v2.4.0 | |
working-directory: ${{ env.CHIFRA_PATH }} | |
args: --timeout=5m --verbose --output.text.colors=true --output.text.print-linter-name=true | |
- name: Lint khedra | |
uses: golangci/golangci-lint-action@v8 | |
with: | |
version: v2.4.0 | |
working-directory: ${{ env.KHEDRA_PATH }} | |
args: --timeout=5m --verbose --output.text.colors=true --output.text.print-linter-name=true | |
Build: | |
needs: Lint | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout TrueBlocks repo | |
uses: actions/checkout@v4 | |
with: | |
submodules: true | |
fetch-depth: 0 | |
- name: Use latest version of Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
- name: Install prerequistes | |
run: | | |
sudo apt-mark hold grub-efi-amd64-signed | |
sudo apt-mark hold firefox | |
sudo apt-get update --fix-missing || true | |
sudo apt-get upgrade -y --fix-missing || true | |
sudo apt-get install -y build-essential git cmake | |
sudo apt-get install -y python3 tree jq | |
sudo apt-get install -y libcurl3-dev | |
- name: Run chifra unit tests | |
run: | | |
mkdir -p build | |
cd build | |
../scripts/go-work-sync.sh | |
cmake ../src | |
cd other/install # we need to copy install files into place | |
make | |
cd ../../../ # back to the root | |
cd ${{ env.CHIFRA_PATH }} | |
export TB_NO_PROVIDER_CHECK=true | |
go test ./... | |
cd ../../../ | |
# cd ${{ env.KHEDRA_PATH }} | |
# export TB_NO_PROVIDER_CHECK=true | |
# go test ./... | |
RemoteTests: | |
needs: Build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Run tests remotely | |
uses: appleboy/[email protected] | |
with: | |
# These secrets are configured in the repository settings | |
host: ${{ secrets.TESTING_HOST }} # Remote testing server hostname | |
username: ${{ secrets.TESTING_USERNAME }} # SSH username for remote testing | |
key: ${{ secrets.SSH_PRIVATE_KEY }} # SSH private key for authentication | |
command_timeout: 40m | |
script: | | |
set -e # Exit on any error | |
rm -rf testing/${{ github.sha }} | |
mkdir -p testing/${{ github.sha }} | |
mkdir -p test_results/${{ github.sha }} | |
cd testing/${{ github.sha }} | |
git clone --quiet https://github.com/${{ github.repository }} | |
cd trueblocks-core | |
git checkout ${{ github.head_ref }} | |
git submodule update --init --recursive | |
cd scripts | |
bash check_go_version.sh ${{ env.GO_VERSION }} | |
if CONFIG_FILE=$HOME/trueBlocks.toml bash test-with-docker.sh ${{ github.repository }} ${{ github.sha }} ${{ github.head_ref }}; then | |
echo "✅ Tests passed successfully" | |
echo "Results placed in /home/testuser/testing/${{ github.sha }}" | |
else | |
echo "❌ Tests failed" | |
exit 1 | |
fi | |
docker system prune -af --filter "until=1h" |