From 531c3ef7a15d15b55b57aef20dd5d09365315a35 Mon Sep 17 00:00:00 2001 From: K'Ron Spar Date: Thu, 28 Mar 2024 11:54:38 -0400 Subject: [PATCH] Updated Tests & Build workflows The build workflow no allows for automatic builds after a successful and manual builds. The tests workflow had a version update from v3 to v4 and changed docker-compose to docker compose. --- .github/workflows/build-main.yml | 27 -------------- .github/workflows/build-manual.yml | 21 ----------- .github/workflows/build.yml | 56 ++++++++++++++++++++++++++++++ .github/workflows/tests.yml | 10 +++--- 4 files changed, 61 insertions(+), 53 deletions(-) delete mode 100644 .github/workflows/build-main.yml delete mode 100644 .github/workflows/build-manual.yml create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build-main.yml b/.github/workflows/build-main.yml deleted file mode 100644 index 6825a4d..0000000 --- a/.github/workflows/build-main.yml +++ /dev/null @@ -1,27 +0,0 @@ -name: Build latest from main and deploy to staging - -on: - workflow_run: - workflows: ['Run Tests'] - branches: ['main'] - types: [completed] - -jobs: - build: - runs-on: ubuntu-latest - permissions: - contents: read - packages: write - - steps: - - uses: hathitrust/github_actions/build@v1 - with: - image: ghcr.io/${{ github.repository }}-unstable - dockerfile: Dockerfile.prod - tag: ${{ github.sha }} - push_latest: true - registry_token: ${{ github.token }} - -# TODO: automate deployment w/ argocd -# for now - update image in -# https://github.com/hathitrust/ht_tanka/blob/main/environments/search_client/staging/main.jsonnet diff --git a/.github/workflows/build-manual.yml b/.github/workflows/build-manual.yml deleted file mode 100644 index 1b8dd68..0000000 --- a/.github/workflows/build-manual.yml +++ /dev/null @@ -1,21 +0,0 @@ ---- -name: Manual Image Build - -on: - workflow_dispatch: - inputs: - tag: - description: tag - required: true - -jobs: - build_manual: - runs-on: ubuntu-latest - steps: - - uses: hathitrust/github_actions/build@v1 - with: - image: ghcr.io/${{ github.repository }}-unstable - dockerfile: Dockerfile.prod - tag: ${{ github.event.inputs.tag }} - push_latest: false - registry_token: ${{ github.token }} diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..f5b0837 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,56 @@ +name: Build + +on: + workflow_run: + workflows: ['Run Tests'] + branches: ['main'] + types: [completed] + + workflow_dispatch: + inputs: + img_tag: + description: Docker Image Tag + ref: + description: Revision or Branch to build + default: main + push_latest: + description: Set True if the build is for the latest version + type: boolean + required: false + default: false + platforms: + description: Platforms to build for + type: choice + default: linux/amd64,linux/arm64 + options: + - linux/amd64,linux/arm64 + - linux/amd64 + - linux/arm64 + rebuild: + description: Rebuild this image? + type: boolean + default: false + +jobs: + build-image: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + + steps: + - name: Build Image + uses: hathitrust/github_actions/build@v1 + with: + image: ghcr.io/${{ github.repository }}-unstable + dockerfile: Dockerfile.prod + img_tag: ${{ inputs.img_tag }} + tag: ${{ inputs.ref }} + push_latest: ${{ inputs.push_latest}} + registry_token: ${{ github.token }} + rebuild: ${{ inputs.rebuild }} + + +# TODO: automate deployment w/ argocd +# for now - update image in +# https://github.com/hathitrust/ht_tanka/blob/main/environments/search_client/staging/main.jsonnet diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 3bc2cf0..c555012 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -13,7 +13,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Log in to package registry uses: docker/login-action@v2 @@ -24,14 +24,14 @@ jobs: - name: Set up tests run: | - docker-compose build - docker-compose run web bundle install + docker compose build + docker compose run web bundle install - name: Run standardrb - run: docker-compose run test bundle exec standardrb + run: docker compose run test bundle exec standardrb - name: Run tests - run: docker-compose run test + run: docker compose run test - name: Report to Coveralls uses: coverallsapp/github-action@1.1.3