fix: use cacao timestamp strings and parse #1034
Workflow file for this run
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: Rust Build and Test | |
on: | |
pull_request: {} | |
merge_group: | |
branches: [ "main" ] | |
workflow_dispatch: | |
inputs: | |
test_selector: | |
description: 'Test selector' | |
required: false | |
default: '.' | |
options: | |
- "fast" | |
- "slow" | |
- "." | |
env: | |
CARGO_TERM_COLOR: always | |
SCCACHE_GHA_ENABLED: "true" | |
RUSTC_WRAPPER: "sccache" | |
jobs: | |
check: | |
runs-on: ubuntu-latest | |
container: 'public.ecr.aws/r5b3e0r5/3box/rust-builder:latest' | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: Swatinem/rust-cache@v2 | |
with: | |
# The prefix cache key, this can be changed to start a new cache manually. | |
# default: "v0-rust" | |
prefix-key: v0 | |
# Cache only the cargo registry | |
cache-targets: false | |
- uses: mozilla-actions/sccache-action@v0.0.3 | |
- name: git file permission config | |
run: git config --global --add safe.directory '*' | |
- name: Check fmt | |
run: make check-fmt | |
- name: Check clippy | |
run: make check-clippy | |
- name: Check generated servers | |
run: | | |
make check-api-server | |
make check-kubo-rpc-server | |
- name: Check deps | |
run: make check-deps | |
test: | |
runs-on: ubuntu-latest | |
container: 'public.ecr.aws/r5b3e0r5/3box/rust-builder:latest' | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: Swatinem/rust-cache@v2 | |
with: | |
# The prefix cache key, this can be changed to start a new cache manually. | |
# default: "v0-rust" | |
prefix-key: v0 | |
# Cache only the cargo registry | |
cache-targets: false | |
- uses: mozilla-actions/sccache-action@v0.0.3 | |
- name: Run tests | |
run: make test | |
build: | |
runs-on: ubuntu-latest | |
outputs: | |
build_tag: ${{ steps.build.outputs.build_tag }} | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: Swatinem/rust-cache@v2 | |
with: | |
# The prefix cache key, this can be changed to start a new cache manually. | |
# default: "v0-rust" | |
prefix-key: v0 | |
# Cache only the cargo registry | |
cache-targets: false | |
- uses: mozilla-actions/sccache-action@v0.0.3 | |
- | |
name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- | |
name: Login to Public ECR | |
uses: docker/login-action@v2 | |
with: | |
registry: public.ecr.aws | |
username: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
password: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
env: | |
AWS_REGION: us-east-1 | |
- | |
name: Build and Publish Docker Image | |
id: build | |
run: | | |
if [ "${{ github.event_name }}" == "pull_request" ]; then | |
BUILD_TAG=$(echo ${{ github.event.pull_request.head.sha }} | head -c 12) | |
else | |
BUILD_TAG=$(echo ${{ github.sha }} | head -c 12) | |
fi | |
make SHA_TAG="$BUILD_TAG" TAG_LATEST="false" publish-docker | |
echo "Build tag:" | |
echo ${BUILD_TAG} | |
echo "build_tag=${BUILD_TAG}" >> $GITHUB_OUTPUT | |
correctness-tests: | |
runs-on: ubuntu-latest | |
environment: github-tests-2024 | |
needs: | |
- build | |
steps: | |
- uses: actions/checkout@v3 | |
- | |
name: Setup GKE auth | |
uses: 'google-github-actions/auth@v1' | |
with: | |
credentials_json: ${{ secrets.GKE_SA_KEY }} | |
- | |
name: Get GKE credentials | |
uses: 'google-github-actions/get-gke-credentials@v1' | |
with: | |
cluster_name: ${{ vars.GKE_CLUSTER }} | |
location: ${{ vars.GKE_ZONE }} | |
- | |
name: Get Network template and update | |
env: | |
RUST_CERAMIC_IMAGE_TAG: ${{ needs.build.outputs.build_tag }} | |
RUST_CERAMIC_IMAGE_REPO: public.ecr.aws/r5b3e0r5/3box/ceramic-one | |
run: | | |
set -ex | |
export RUST_CERAMIC_IMAGE=${RUST_CERAMIC_IMAGE_REPO}:${RUST_CERAMIC_IMAGE_TAG} | |
export KERAMIK_NETWORK_NAME=hermetic-rust-ceramic-${RUST_CERAMIC_IMAGE_TAG} | |
mkdir ./bin | |
curl -L https://github.com/mikefarah/yq/releases/download/v4.40.5/yq_linux_amd64 -o ./bin/yq | |
chmod +x ./bin/yq | |
curl -L https://github.com/3box/ceramic-tests/releases/download/v0.2.0/hermetic-driver-x86_64-linux -o ./bin/hermetic-driver | |
chmod +x ./bin/hermetic-driver | |
curl -LO https://raw.githubusercontent.com/3box/ceramic-tests/main/networks/basic-rust.yaml | |
./bin/yq -i '.spec.ceramic[0].ipfs.rust.image = strenv(RUST_CERAMIC_IMAGE)' basic-rust.yaml | |
./bin/yq -i '.metadata.name = strenv(KERAMIK_NETWORK_NAME)' basic-rust.yaml | |
./bin/yq --no-colors basic-rust.yaml | |
- | |
name: Run correctness-tests | |
# On PRs run fast tests | |
# On merges to main, run all tests | |
# Workflow_dispatch picks what to run | |
run: | | |
set -ex | |
if [ "${{ github.event_name }}" == "pull_request" ]; then | |
TEST_SELECTOR="correctness/fast" | |
elif [ "${{ github.event_name }}" == "merge_group" ]; then | |
TEST_SELECTOR="correctness" | |
elif [ "${{ github.event_name}}" == "workflow_dispatch" ]; then | |
TEST_SELECTOR="${{ github.event.inputs.test_selector || 'correctness' }}" | |
fi | |
./bin/hermetic-driver test \ | |
--network basic-rust.yaml \ | |
--flavor correctness \ | |
--test-selector ${TEST_SELECTOR} \ | |
--network-ttl 3600 |