diff --git a/.github/workflows/compose-tests.yml b/.github/workflows/compose-tests.yml new file mode 100644 index 0000000000..84ca08f8f1 --- /dev/null +++ b/.github/workflows/compose-tests.yml @@ -0,0 +1,41 @@ +name: Compose Tests +on: + pull_request: + push: + branches: + - main* + +concurrency: + group: compose-tests-${{ github.ref }} + cancel-in-progress: true + +jobs: + compose_tests: + runs-on: charon-ci + steps: + - uses: actions/checkout@v4 + - name: Set up QEMU + id: qemu + uses: docker/setup-qemu-action@v3 + - uses: docker/setup-buildx-action@v3 + with: + driver-opts: "image=moby/buildkit:v0.10.5" + - uses: ./.github/actions/setup-go + - uses: actions/cache@v4 + with: + path: | + ~/go/pkg/mod + ~/.cache/go-build + key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} + restore-keys: | + ${{ runner.os }}-go- + - run: | + echo "CHARON_REPO=$(pwd)" >> $GITHUB_ENV + echo "DOCKER_BUILDKIT=1" >> $GITHUB_ENV + - run: go test -race github.com/obolnetwork/charon/testutil/compose/smoke -v -integration -sudo-perms -timeout=20m -log-dir=. + - uses: actions/upload-artifact@v4 + if: always() + with: + name: smoke-test-logs + path: testutil/compose/smoke/*.log + retention-days: 3 diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml new file mode 100644 index 0000000000..c25a0882a7 --- /dev/null +++ b/.github/workflows/integration-tests.yml @@ -0,0 +1,26 @@ +name: Integration Tests +on: + pull_request: + push: + branches: + - main* + +concurrency: + group: integration-tests-${{ github.ref }} + cancel-in-progress: true + +jobs: + integration_tests: + runs-on: charon-ci + steps: + - uses: actions/checkout@v4 + - uses: ./.github/actions/setup-go + - uses: actions/cache@v4 + with: + path: | + ~/go/pkg/mod + ~/.cache/go-build + key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} + restore-keys: | + ${{ runner.os }}-go- + - run: go test -v -timeout=10m -race github.com/obolnetwork/charon/testutil/integration -integration diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml deleted file mode 100644 index e8b272f09d..0000000000 --- a/.github/workflows/test.yml +++ /dev/null @@ -1,78 +0,0 @@ -name: go tests -on: - pull_request: - push: - branches: - - main* -jobs: - unit_tests: - runs-on: charon-ci - steps: - - uses: actions/checkout@v4 - - uses: ./.github/actions/setup-go - - uses: actions/cache@v4 - with: - path: | - ~/go/pkg/mod - ~/.cache/go-build - key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} - restore-keys: | - ${{ runner.os }}-go- - - run: go test -coverprofile=coverage.out -covermode=atomic -timeout=5m -race ./... - - name: Upload coverage to Codecov - uses: codecov/codecov-action@v5.4.0 - with: - token: ${{ secrets.CODECOV_TOKEN }} - files: coverage.out - - integration_tests: - runs-on: charon-ci - if: ${{ always() }} # makes this step always execute, even if unit_tests fails - needs: - - unit_tests - steps: - - uses: actions/checkout@v4 - - uses: ./.github/actions/setup-go - - uses: actions/cache@v4 - with: - path: | - ~/go/pkg/mod - ~/.cache/go-build - key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} - restore-keys: | - ${{ runner.os }}-go- - - run: go test -v -timeout=10m -race github.com/obolnetwork/charon/testutil/integration -integration - - compose_tests: - runs-on: charon-ci - if: ${{ always() }} # makes this step always execute, even if unit_tests or integration_tests fails - needs: - - unit_tests - - integration_tests - steps: - - uses: actions/checkout@v4 - - name: Set up QEMU - id: qemu - uses: docker/setup-qemu-action@v3 - - uses: docker/setup-buildx-action@v3 # For compose to build images - with: - driver-opts: "image=moby/buildkit:v0.10.5" # avoid unknown/unknown arch in ghcr - - uses: ./.github/actions/setup-go - - uses: actions/cache@v4 - with: - path: | - ~/go/pkg/mod - ~/.cache/go-build - key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} - restore-keys: | - ${{ runner.os }}-go- - - run: | - echo "CHARON_REPO=$(pwd)" >> $GITHUB_ENV - echo "DOCKER_BUILDKIT=1" >> $GITHUB_ENV - - run: go test -race github.com/obolnetwork/charon/testutil/compose/smoke -v -integration -sudo-perms -timeout=20m -log-dir=. - - uses: actions/upload-artifact@v4 - if: always() - with: - name: smoke-test-logs - path: testutil/compose/smoke/*.log - retention-days: 3 diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml new file mode 100644 index 0000000000..2771d109eb --- /dev/null +++ b/.github/workflows/unit-tests.yml @@ -0,0 +1,31 @@ +name: Unit Tests +on: + pull_request: + push: + branches: + - main* + +concurrency: + group: unit-tests-${{ github.ref }} + cancel-in-progress: true + +jobs: + unit_tests: + runs-on: charon-ci + steps: + - uses: actions/checkout@v4 + - uses: ./.github/actions/setup-go + - uses: actions/cache@v4 + with: + path: | + ~/go/pkg/mod + ~/.cache/go-build + key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} + restore-keys: | + ${{ runner.os }}-go- + - run: go test -coverprofile=coverage.out -covermode=atomic -timeout=5m -race ./... + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v5.4.0 + with: + token: ${{ secrets.CODECOV_TOKEN }} + files: coverage.out