diff --git a/.github/workflows/argo.yaml b/.github/workflows/argo.yaml deleted file mode 100644 index 4247a60..0000000 --- a/.github/workflows/argo.yaml +++ /dev/null @@ -1,49 +0,0 @@ -name: Build Argo Workflows Runner Image - -on: - push: - branches: - - master - - workflow_dispatch: - -env: - DOCKER_FILE: ./docker/bittorrent-benchmarks-workflows.Dockerfile - DOCKER_REPO: codexstorage/bittorrent-benchmarks-workflows - -jobs: - test-and-build: - runs-on: ubuntu-22.04 - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Login to Docker Hub - uses: docker/login-action@v3 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - - name: Setup Docker Metadata - id: meta - uses: docker/metadata-action@v5 - with: - images: ${{ env.DOCKER_REPO }} - flavor: | - latest=true - tags: | - type=sha - - - name: Build and Push Prod. Image - uses: docker/build-push-action@v6 - with: - context: . - file: ${{ env.DOCKER_FILE }} - push: ${{ github.event_name != 'pull_request' }} - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - - diff --git a/.github/workflows/argo.yml b/.github/workflows/argo.yml new file mode 100644 index 0000000..86cd9e8 --- /dev/null +++ b/.github/workflows/argo.yml @@ -0,0 +1,52 @@ +name: Build Argo Workflows Runner Image + +on: + push: + branches: + - master + tags: + - 'v*.*.*' + workflow_dispatch: + +env: + DOCKER_FILE: ./docker/bittorrent-benchmarks-workflows.Dockerfile + DOCKER_REPO: codexstorage/bittorrent-benchmarks-workflows + +jobs: + build-and-test: + name: Build and Test + runs-on: ubuntu-22.04 + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Build Test Image + uses: docker/build-push-action@v6 + with: + context: . + file: ${{ env.DOCKER_FILE }} + push: false + + variables: + name: Compute outputs + needs: build-and-test + runs-on: ubuntu-latest + outputs: + docker_file: ${{ env.DOCKER_FILE }} + dockerhub_repo: ${{ env.DOCKER_REPO }} + steps: + - name: Dummy job + if: false + run: echo + + build-and-push: + name: Build and Push + needs: variables + uses: codex-storage/github-actions/.github/workflows/docker-reusable.yml@master + with: + docker_file: ${{ needs.variables.outputs.docker_file }} + dockerhub_repo: ${{ needs.variables.outputs.dockerhub_repo }} + secrets: inherit diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1544c62..5c8ba5e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -4,15 +4,19 @@ on: push: branches: - master - + tags: + - 'v*.*.*' workflow_dispatch: env: DOCKER_FILE: ./docker/bittorrent-benchmarks.Dockerfile DOCKER_REPO: codexstorage/bittorrent-benchmarks + BUILD_ARGS: | + BUILD_TYPE=test jobs: - test-and-build: + build-and-test: + name: Build and Test runs-on: ubuntu-22.04 steps: - name: Checkout @@ -21,22 +25,6 @@ jobs: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - - name: Login to Docker Hub - uses: docker/login-action@v3 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - - name: Setup Docker Metadata - id: meta - uses: docker/metadata-action@v5 - with: - images: ${{ env.DOCKER_REPO }} - flavor: | - latest=true - tags: | - type=sha - - name: Build Test Image uses: docker/build-push-action@v6 with: @@ -46,7 +34,7 @@ jobs: load: true tags: bittorrent-benchmarks:test build-args: | - BUILD_TYPE=test + ${{ env.BUILD_ARGS }} - name: Lint run: | @@ -64,11 +52,26 @@ jobs: run: | docker compose -f docker-compose.local.yaml -f docker-compose.ci.yaml up --abort-on-container-exit --exit-code-from test-runner - - name: Build and Push Prod. Image - uses: docker/build-push-action@v6 - with: - context: . - file: ${{ env.DOCKER_FILE }} - push: ${{ github.event_name != 'pull_request' }} - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} + variables: + name: Compute outputs + needs: build-and-test + runs-on: ubuntu-latest + outputs: + docker_file: ${{ env.DOCKER_FILE }} + dockerhub_repo: ${{ env.DOCKER_REPO }} + build_args: ${{ env.BUILD_ARGS }} + steps: + - name: Dummy job + if: false + run: echo + + build-and-push: + name: Build and Push + needs: variables + uses: codex-storage/github-actions/.github/workflows/docker-reusable.yml@master + with: + docker_file: ${{ needs.variables.outputs.docker_file }} + dockerhub_repo: ${{ needs.variables.outputs.dockerhub_repo }} + build_args: | + ${{ needs.variables.outputs.build_args }} + secrets: inherit