From 8eb584db940d89eb37c805f145eabf55b6d35611 Mon Sep 17 00:00:00 2001 From: Abdul Rabbani <58230246+abdulrabbani00@users.noreply.github.com> Date: Fri, 22 Apr 2022 16:54:09 -0400 Subject: [PATCH] Try combining everything into one pipeline (#13) * Try combining everything into one pipeline * Update on-pr-manual.yml * Remove PAth for testing * Combine single YML workflow file for PR * Add a comment --- .github/workflows/on-pr-automated.yaml | 139 ------------------ .../workflows/{on-pr-manual.yml => on-pr.yml} | 20 ++- 2 files changed, 15 insertions(+), 144 deletions(-) delete mode 100644 .github/workflows/on-pr-automated.yaml rename .github/workflows/{on-pr-manual.yml => on-pr.yml} (85%) diff --git a/.github/workflows/on-pr-automated.yaml b/.github/workflows/on-pr-automated.yaml deleted file mode 100644 index d210b2e..0000000 --- a/.github/workflows/on-pr-automated.yaml +++ /dev/null @@ -1,139 +0,0 @@ -name: Test Application - -on: - pull_request: - paths: - - "!**.md" - - ".gitignore" - - "!LICENSE" - - "!.github/workflows/**" - - ".github/workflows/on-pr-automated.yaml" - -jobs: - build: - name: Run Docker Build - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Run docker build - run: make docker-build - - unit-test: - name: Run Unit Tests - runs-on: ubuntu-latest - env: - foundry-test-ref: feature/build-stack - ipld-eth-db-ref: main - GOPATH: /tmp/go - steps: - - name: Create GOPATH - run: mkdir -p /tmp/go - - - uses: actions/checkout@v2 - with: - path: "./ipld-ethcl-indexer" - - - uses: actions/checkout@v3 - with: - ref: ${{ env.foundry-test-ref }} - path: "./foundry-test/" - repository: vulcanize/foundry-test - fetch-depth: 0 - - - uses: actions/checkout@v3 - with: - ref: ${{ env.ipld-eth-db-ref }} - repository: vulcanize/ipld-eth-db - path: "./ipld-eth-db/" - fetch-depth: 0 - - - name: Create config file - run: | - echo vulcanize_ipld_eth_db=$GITHUB_WORKSPACE/ipld-eth-db/ > ./config.sh - echo vulcanize_ipld_ethcl_indexer=$GITHUB_WORKSPACE/ipld-ethcl-indexer >> ./config.sh - cat ./config.sh - - - uses: actions/setup-go@v3 - with: - go-version: ">=1.17.0" - check-latest: true - - - name: Install packages - run: | - go install github.com/onsi/ginkgo/v2/ginkgo@latest - which ginkgo - - - name: Run the tests using Make - run: | - cd ipld-ethcl-indexer - make unit-test-ci - - integration-test: - name: Run Integration Tests - runs-on: ubuntu-latest - env: - foundry-test-ref: feature/build-stack - ipld-eth-db-ref: main - GOPATH: /tmp/go - steps: - - name: Create GOPATH - run: mkdir -p /tmp/go - - - uses: actions/checkout@v2 - with: - path: "./ipld-ethcl-indexer" - - - uses: actions/checkout@v3 - with: - ref: ${{ env.foundry-test-ref }} - path: "./foundry-test/" - repository: vulcanize/foundry-test - fetch-depth: 0 - - - uses: actions/checkout@v3 - with: - ref: ${{ env.ipld-eth-db-ref }} - repository: vulcanize/ipld-eth-db - path: "./ipld-eth-db/" - fetch-depth: 0 - - - name: Create config file - run: | - echo vulcanize_ipld_eth_db=$GITHUB_WORKSPACE/ipld-eth-db/ > ./config.sh - echo vulcanize_ipld_ethcl_indexer=$GITHUB_WORKSPACE/ipld-ethcl-indexer >> ./config.sh - cat ./config.sh - - - name: Run docker compose - run: | - docker-compose \ - -f "$GITHUB_WORKSPACE/foundry-test/docker/local/docker-compose-db.yml" \ - -f "$GITHUB_WORKSPACE/foundry-test/docker/latest/docker-compose-lighthouse.yml" \ - --env-file ./config.sh \ - up -d --build - - - uses: actions/setup-go@v3 - with: - go-version: ">=1.17.0" - check-latest: true - - - name: Install packages - run: | - go install github.com/onsi/ginkgo/v2/ginkgo@latest - which ginkgo - - - name: Run the tests using Make - run: | - cd ipld-ethcl-indexer - make integration-test-ci - - golangci: - runs-on: ubuntu-latest - steps: - - uses: actions/setup-go@v3 - with: - go-version: ">=1.17.0" - - uses: actions/checkout@v3 - - name: golangci-lint - uses: golangci/golangci-lint-action@v3 - with: - args: --disable errcheck diff --git a/.github/workflows/on-pr-manual.yml b/.github/workflows/on-pr.yml similarity index 85% rename from .github/workflows/on-pr-manual.yml rename to .github/workflows/on-pr.yml index d5d015a..a033463 100644 --- a/.github/workflows/on-pr-manual.yml +++ b/.github/workflows/on-pr.yml @@ -1,4 +1,4 @@ -name: Test Application Manually +name: Test Application On PR on: workflow_dispatch: @@ -11,6 +11,13 @@ on: description: "The branch, commit or sha from ipld-eth-db to checkout" required: false default: "main" + pull_request: + paths: + - "!**.md" + - ".gitignore" + - "!LICENSE" + - "!.github/workflows/**" + - ".github/workflows/on-pr.yml" jobs: build: @@ -24,7 +31,10 @@ jobs: unit-test: name: Run Unit Tests runs-on: ubuntu-latest + ## IF you want to update the default branch for `pull_request runs, do it after the ||` env: + foundry-test-ref: ${{ github.event.inputs.foundry-test-ref || 'feature/build-stack'}} + ipld-eth-db-ref: ${{ github.event.inputs.ipld-eth-db-ref || 'main' }} GOPATH: /tmp/go steps: - name: Create GOPATH @@ -36,14 +46,14 @@ jobs: - uses: actions/checkout@v3 with: - ref: ${{ github.event.inputs.foundry-test-ref }} + ref: ${{ env.foundry-test-ref }} path: "./foundry-test/" repository: vulcanize/foundry-test fetch-depth: 0 - uses: actions/checkout@v3 with: - ref: ${{ github.event.inputs.ipld-eth-db-ref }} + ref: ${{ env.ipld-eth-db-ref }} repository: vulcanize/ipld-eth-db path: "./ipld-eth-db/" fetch-depth: 0 @@ -86,14 +96,14 @@ jobs: - uses: actions/checkout@v3 with: - ref: ${{ github.event.inputs.foundry-test-ref }} + ref: ${{ env.foundry-test-ref }} path: "./foundry-test/" repository: vulcanize/foundry-test fetch-depth: 0 - uses: actions/checkout@v3 with: - ref: ${{ github.event.inputs.ipld-eth-db-ref }} + ref: ${{ env.ipld-eth-db-ref }} repository: vulcanize/ipld-eth-db path: "./ipld-eth-db/" fetch-depth: 0