ci: fix issues with reset env #1211
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
# Triggered via !ci-test-basic tag | |
name: Run tc-cli smoke test | |
on: | |
pull_request: | |
types: [labeled, unlabeled, opened, reopened, synchronize] | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
env: | |
BUCKET_NAME: compose-test-logs | |
jobs: | |
test-basic: | |
runs-on: [self-hosted, integration] | |
timeout-minutes: 90 | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Setup Rust cache | |
uses: actions/cache@v4 | |
continue-on-error: false | |
with: | |
path: | | |
~/.cargo/ | |
target/ | |
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
restore-keys: ${{ runner.os }}-cargo- | |
- name: Build dev containers | |
run: | | |
./scripts/build_docker.sh | |
- name: Initialize tc-cli | |
id: tc-cli | |
run: | | |
cat << EOF >> $GITHUB_OUTPUT | |
TC_CLI=docker compose run --rm --remove-orphans \ | |
--env="TIMECHAIN_MNEMONIC=${{ secrets.TIMECHAIN_MNEMONIC }}" \ | |
--env="TARGET_MNEMONIC=${{ secrets.TARGET_MNEMONIC }}" \ | |
--env="TOKEN_PRICE_URL=${{ secrets.TOKEN_PRICE_URL }}" \ | |
--env="TOKEN_API_KEY=${{ secrets.TOKEN_API_KEY }}" \ | |
tc-cli --env=/etc/envs/local --config=local-evm.yaml | |
EOF | |
- name: Setup containers | |
run: | | |
docker compose --profile evm up -d | |
- name: fetch prices | |
run: | | |
${{ steps.tc-cli.outputs.TC_CLI }} fetch-prices | |
- name: Smoke test | |
run: | | |
${{ steps.tc-cli.outputs.TC_CLI }} smoke-test 2 3 | |
- name: Restart chronicles | |
run: | | |
docker compose stop chronicle-2-evm chronicle-3-evm | |
sleep 180s | |
docker compose start chronicle-2-evm chronicle-3-evm | |
- name: Still works | |
run: | | |
${{ steps.tc-cli.outputs.TC_CLI }} smoke-test 2 3 | |
- name: Set up AWS credentials | |
uses: aws-actions/configure-aws-credentials@v2 | |
with: | |
aws-access-key-id: ${{ secrets.LOG_UPLOADER_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.LOG_UPLOADER_SECRET_ACCESS_KEY }} | |
aws-region: us-east-1 | |
# Upload logs step collects all the logs from the containers | |
# and uploads it in a S3 bucket | |
- name: Upload logs | |
if: ${{ always() }} | |
run: | | |
mkdir -p logs | |
echo "Uploading container logs" | |
for container in $(docker compose ps --services); do | |
echo "Export logs for $container" | |
docker compose logs "$container" > "logs/$container.log" | |
done | |
aws s3 cp logs "s3://${BUCKET_NAME}/${GITHUB_RUN_ID}/${GITHUB_RUN_ATTEMPT}" --recursive | |
- name: Cleanup | |
if: ${{ always() }} | |
run: | | |
docker compose --profile "*" down --remove-orphans | |
- name: Cleanup working dir | |
if: ${{ always() }} | |
uses: eviden-actions/clean-self-hosted-runner@v1 |