From 0b736397e2838ab16cae5c3ce2af734c59fb06bd Mon Sep 17 00:00:00 2001 From: Helio Machado <0x2b3bfa0+git@googlemail.com> Date: Sun, 16 May 2021 14:45:34 +0200 Subject: [PATCH 01/16] Create test.yml --- .github/workflows/test.yml | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 000000000..58e23cc7c --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,37 @@ +name: Test source code +on: + push: + branches: + - master + pull_request: + types: + - opened + - reopened + - synchronize +jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v2 + - run: npm ci + - run: npm run lint + test: + environment: ${{ github.event_name == 'pull_request' && 'external' || 'internal' }} + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v2 + - run: npm ci + - run: npm run test + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + TEST_GITHUB_TOKEN: ${{ secrets.TEST_GITHUB_TOKEN }} + TEST_GITHUB_REPO: https://github.com/iterative/cml_qa_tests_dummy + TEST_GITHUB_SHA: 62edc8b3f46a60b3fe1e5c08fd3e0046d350ee29 + TEST_GITLAB_TOKEN: ${{ secrets.TEST_GITLAB_TOKEN }} + TEST_GITLAB_REPO: https://gitlab.com/iterative.ai/cml_qa_tests_dummy + TEST_GITLAB_SHA: c4c13286e78dc252dd2611f31a755f10d343fbd4 + TEST_BBCLOUD_TOKEN: ${{ secrets.TEST_BBCLOUD_TOKEN }} + TEST_BBCLOUD_REPO: https://bitbucket.org/iterative-ai/cml-qa-tests-dummy + TEST_BBCLOUD_SHA: 9bb9131ce0af294fe1c6eedca1f2bce3983e80bd From dcd3f0c3975446d5c775b27cb21c77b0de28496b Mon Sep 17 00:00:00 2001 From: Helio Machado <0x2b3bfa0+git@googlemail.com> Date: Sun, 16 May 2021 17:56:18 +0200 Subject: [PATCH 02/16] Simplify environments --- .github/workflows/test.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 58e23cc7c..d0254e916 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,8 +1,5 @@ name: Test source code on: - push: - branches: - - master pull_request: types: - opened @@ -17,7 +14,7 @@ jobs: - run: npm ci - run: npm run lint test: - environment: ${{ github.event_name == 'pull_request' && 'external' || 'internal' }} + environment: acceptance-tests runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 From a2a17ff723b38c88b5ab018b482277551097927b Mon Sep 17 00:00:00 2001 From: Helio Machado <0x2b3bfa0+git@googlemail.com> Date: Sun, 16 May 2021 18:16:58 +0200 Subject: [PATCH 03/16] Use github.token instead of secrets.GITHUB_TOKEN MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Just to test the newly created environment; may be reverted later if we don't like it. 😄 --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d0254e916..a202da6d4 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -22,7 +22,7 @@ jobs: - run: npm ci - run: npm run test env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITHUB_TOKEN: ${{ github.token }} TEST_GITHUB_TOKEN: ${{ secrets.TEST_GITHUB_TOKEN }} TEST_GITHUB_REPO: https://github.com/iterative/cml_qa_tests_dummy TEST_GITHUB_SHA: 62edc8b3f46a60b3fe1e5c08fd3e0046d350ee29 From f3405a8bf8afdb90ab9935fc6c083e395e7bc41c Mon Sep 17 00:00:00 2001 From: Helio Machado <0x2b3bfa0+git@googlemail.com> Date: Sun, 16 May 2021 18:31:49 +0200 Subject: [PATCH 04/16] Install tensorboard before running tests --- .github/workflows/test.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a202da6d4..8a7c522e0 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -19,6 +19,8 @@ jobs: steps: - uses: actions/checkout@v2 - uses: actions/setup-node@v2 + - uses: actions/setup-python@v2 + - run: pip install tensorboard - run: npm ci - run: npm run test env: From 1716889306d2ed1f22a64e8ec421d50dad3bcb92 Mon Sep 17 00:00:00 2001 From: 0x2b3bfa0 <0x2b3bfa0+git@googlemail.com> Date: Sun, 16 May 2021 18:36:40 +0200 Subject: [PATCH 05/16] Remove dependancron [sic], superseded by release.yml --- .dependancron | 1 - .github/workflows/dependancron.yml | 39 ------------------------------ 2 files changed, 40 deletions(-) delete mode 100644 .dependancron delete mode 100644 .github/workflows/dependancron.yml diff --git a/.dependancron b/.dependancron deleted file mode 100644 index 7ec1d6db4..000000000 --- a/.dependancron +++ /dev/null @@ -1 +0,0 @@ -2.1.0 diff --git a/.github/workflows/dependancron.yml b/.github/workflows/dependancron.yml deleted file mode 100644 index 95c72b089..000000000 --- a/.github/workflows/dependancron.yml +++ /dev/null @@ -1,39 +0,0 @@ -name: Update dependencies -on: - schedule: - # every six hours - - cron: 0 */6 * * * -jobs: - dependancron: - runs-on: [ubuntu-latest] - steps: - - uses: actions/checkout@v2 - - name: Check dependencies - id: check - run: | - sudo wget https://dvc.org/deb/dvc.list -O /etc/apt/sources.list.d/dvc.list - sudo apt update && sudo apt -y install dvc - CML_VER=$(docker run dvcorg/cml:latest dvc --version) - DVC_VER=$(dvc --version) - UPDATE=false - MESSAGE="Updating DVC from $CML_VER to $DVC_VER" - if [ $CML_VER != $DVC_VER ]; then - UPDATE=true - echo "$DVC_VER" > .dependancron - fi - - echo "::set-output name=update::${UPDATE}" - echo "::set-output name=comment::${MESSAGE}" - - name: Create Pull Request - if: steps.check.outputs.update == 'true' - uses: peter-evans/create-pull-request@v3 - with: - token: ${{ secrets.GITHUB_TOKEN }} - title: 'chore: dependancron update dependencies' - body: ${{ steps.check.outputs.comment }} - branch: dependancron-update-dependencies - commit-message: ${{ steps.check.outputs.comment }} - author: - 'Olivaw[bot] <64868532+iterative-olivaw@users.noreply.github.com>' - committer: - 'Olivaw[bot] <64868532+iterative-olivaw@users.noreply.github.com>' From 088f340892dc3658cfdceae36ca423c0d2628dca Mon Sep 17 00:00:00 2001 From: 0x2b3bfa0 <0x2b3bfa0+git@googlemail.com> Date: Sun, 16 May 2021 18:38:58 +0200 Subject: [PATCH 06/16] Integrate delivery checks with release.yml --- .github/workflows/release.yml | 31 ++++++++++++++++++++++--------- Dockerfile | 2 +- 2 files changed, 23 insertions(+), 10 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 573904692..a1efc2d6d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,10 +1,17 @@ name: Release packages and images on: - workflow_dispatch: + schedule: + - cron: 0 0 * * * release: - types: [published] + types: + - published + pull_request: + types: + - opened + - reopened + - synchronize jobs: - package: + packages: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 @@ -12,10 +19,14 @@ jobs: with: registry-url: https://registry.npmjs.org - run: npm install - - run: npm publish + - run: + npm ${{ github.event_name == 'release' && 'publish' || 'publish + --dry-run' }} env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - docker: + images: + runs-on: ubuntu-latest + needs: packages strategy: matrix: cml: [0] @@ -33,8 +44,6 @@ jobs: cudnn: 8 python: 3.8 ubuntu: 20.04 - runs-on: ubuntu-latest - needs: package steps: - uses: actions/checkout@v2 - uses: docker/setup-buildx-action@v1 @@ -51,7 +60,9 @@ jobs: - uses: docker/build-push-action@v2 if: matrix.gpu == false with: - push: true + push: + ${{ github.event_name == 'release' || github.event_name == + 'schedule' }} context: ./ file: ./Dockerfile tags: | @@ -67,7 +78,9 @@ jobs: - uses: docker/build-push-action@v2 if: matrix.gpu == true with: - push: true + push: + ${{ github.event_name == 'release' || github.event_name == + 'schedule' }} context: ./ file: ./Dockerfile tags: | diff --git a/Dockerfile b/Dockerfile index 1f99d5bca..50a83a3c3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -76,7 +76,7 @@ RUN cd /etc/apt/sources.list.d \ # INSTALL CML ARG CML_VERSION=0 RUN npm config set user 0 \ - && npm install --global "git+https://github.com/iterative/cml" + && npm install --global "@dvcorg/cml@${CML_VERSION}" # INSTALL VEGA RUN add-apt-repository universe --yes \ From 2e06bcc3c17b1aca9f230f83bd3e4e8802b259f2 Mon Sep 17 00:00:00 2001 From: Casper da Costa-Luis Date: Mon, 17 May 2021 07:57:17 +0100 Subject: [PATCH 07/16] merge test & deploy - makes interdepended, removing need for dupllication https://github.com/iterative/cml/pull/526#pullrequestreview-660591409 --- .../{release.yml => test-deploy.yml} | 38 +++++++++++++++---- .github/workflows/test.yml | 36 ------------------ 2 files changed, 31 insertions(+), 43 deletions(-) rename .github/workflows/{release.yml => test-deploy.yml} (70%) delete mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/release.yml b/.github/workflows/test-deploy.yml similarity index 70% rename from .github/workflows/release.yml rename to .github/workflows/test-deploy.yml index a1efc2d6d..48834c0dc 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/test-deploy.yml @@ -1,17 +1,41 @@ -name: Release packages and images +name: Test & Deploy on: schedule: - cron: 0 0 * * * release: - types: - - published + types: [published] pull_request: - types: - - opened - - reopened - - synchronize jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v2 + - run: npm ci + - run: npm run lint + test: + environment: acceptance-tests + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v2 + - uses: actions/setup-python@v2 + - run: pip install tensorboard + - run: npm ci + - run: npm run test + env: + GITHUB_TOKEN: ${{ github.token }} + TEST_GITHUB_TOKEN: ${{ secrets.TEST_GITHUB_TOKEN }} + TEST_GITHUB_REPO: https://github.com/iterative/cml_qa_tests_dummy + TEST_GITHUB_SHA: 62edc8b3f46a60b3fe1e5c08fd3e0046d350ee29 + TEST_GITLAB_TOKEN: ${{ secrets.TEST_GITLAB_TOKEN }} + TEST_GITLAB_REPO: https://gitlab.com/iterative.ai/cml_qa_tests_dummy + TEST_GITLAB_SHA: c4c13286e78dc252dd2611f31a755f10d343fbd4 + TEST_BBCLOUD_TOKEN: ${{ secrets.TEST_BBCLOUD_TOKEN }} + TEST_BBCLOUD_REPO: https://bitbucket.org/iterative-ai/cml-qa-tests-dummy + TEST_BBCLOUD_SHA: 9bb9131ce0af294fe1c6eedca1f2bce3983e80bd packages: + needs: [lint, test] runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml deleted file mode 100644 index 8a7c522e0..000000000 --- a/.github/workflows/test.yml +++ /dev/null @@ -1,36 +0,0 @@ -name: Test source code -on: - pull_request: - types: - - opened - - reopened - - synchronize -jobs: - lint: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-node@v2 - - run: npm ci - - run: npm run lint - test: - environment: acceptance-tests - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-node@v2 - - uses: actions/setup-python@v2 - - run: pip install tensorboard - - run: npm ci - - run: npm run test - env: - GITHUB_TOKEN: ${{ github.token }} - TEST_GITHUB_TOKEN: ${{ secrets.TEST_GITHUB_TOKEN }} - TEST_GITHUB_REPO: https://github.com/iterative/cml_qa_tests_dummy - TEST_GITHUB_SHA: 62edc8b3f46a60b3fe1e5c08fd3e0046d350ee29 - TEST_GITLAB_TOKEN: ${{ secrets.TEST_GITLAB_TOKEN }} - TEST_GITLAB_REPO: https://gitlab.com/iterative.ai/cml_qa_tests_dummy - TEST_GITLAB_SHA: c4c13286e78dc252dd2611f31a755f10d343fbd4 - TEST_BBCLOUD_TOKEN: ${{ secrets.TEST_BBCLOUD_TOKEN }} - TEST_BBCLOUD_REPO: https://bitbucket.org/iterative-ai/cml-qa-tests-dummy - TEST_BBCLOUD_SHA: 9bb9131ce0af294fe1c6eedca1f2bce3983e80bd From 79bc93c5002af9b660bfe337c8d1a3874a123b34 Mon Sep 17 00:00:00 2001 From: Casper da Costa-Luis Date: Mon, 17 May 2021 08:20:11 +0100 Subject: [PATCH 08/16] consistent pkg ordering --- .github/workflows/test-deploy.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test-deploy.yml b/.github/workflows/test-deploy.yml index 48834c0dc..333ecc765 100644 --- a/.github/workflows/test-deploy.yml +++ b/.github/workflows/test-deploy.yml @@ -55,19 +55,19 @@ jobs: matrix: cml: [0] dvc: [1, 2] - gpu: [false, true] base: [0, 1] + gpu: [false, true] include: - base: 0 + ubuntu: 18.04 + python: 2.7 cuda: 10.1 cudnn: 7 - python: 2.7 - ubuntu: 18.04 - base: 1 + ubuntu: 20.04 + python: 3.8 cuda: 11.0.3 cudnn: 8 - python: 3.8 - ubuntu: 20.04 steps: - uses: actions/checkout@v2 - uses: docker/setup-buildx-action@v1 From fc00f1e731142b10ec15f7189ba79468891ab41e Mon Sep 17 00:00:00 2001 From: Casper da Costa-Luis Date: Mon, 17 May 2021 10:03:53 +0100 Subject: [PATCH 09/16] split internal & external envs Co-authored-by: Helio Machado <0x2b3bfa0+git@googlemail.com> --- .github/workflows/test-deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-deploy.yml b/.github/workflows/test-deploy.yml index 333ecc765..57a99cd69 100644 --- a/.github/workflows/test-deploy.yml +++ b/.github/workflows/test-deploy.yml @@ -14,7 +14,7 @@ jobs: - run: npm ci - run: npm run lint test: - environment: acceptance-tests + environment: ${{ (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository) && 'test-external' || 'test-internal' }} runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 From 0cba513ff943e4bd5f7ea1db96726bc30fe23197 Mon Sep 17 00:00:00 2001 From: Casper da Costa-Luis Date: Mon, 17 May 2021 10:06:01 +0100 Subject: [PATCH 10/16] deploy: docker: use cache --- .github/workflows/test-deploy.yml | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test-deploy.yml b/.github/workflows/test-deploy.yml index 57a99cd69..3a64620c8 100644 --- a/.github/workflows/test-deploy.yml +++ b/.github/workflows/test-deploy.yml @@ -14,7 +14,10 @@ jobs: - run: npm ci - run: npm run lint test: - environment: ${{ (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository) && 'test-external' || 'test-internal' }} + environment: + ${{ (github.event_name == 'pull_request' && + github.event.pull_request.head.repo.full_name != github.repository) && + 'test-external' || 'test-internal' }} runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 @@ -71,6 +74,11 @@ jobs: steps: - uses: actions/checkout@v2 - uses: docker/setup-buildx-action@v1 + - uses: actions/cache@v2 + with: + path: /tmp/.buildx-cache + key: ${{ runner.os }}-buildx-${{ github.sha }} + restore-keys: ${{ runner.os }}-buildx- - uses: docker/login-action@v1 with: registry: docker.io @@ -99,6 +107,8 @@ jobs: DVC_VERSION=${{ matrix.dvc }} PYTHON_VERSION=${{ matrix.python }} BASE_IMAGE=ubuntu:${{ matrix.ubuntu }} + cache-from: type=local,src=/tmp/.buildx-cache + cache-to: type=local,dest=/tmp/.buildx-cache-new - uses: docker/build-push-action@v2 if: matrix.gpu == true with: @@ -117,3 +127,11 @@ jobs: DVC_VERSION=${{ matrix.dvc }} PYTHON_VERSION=${{ matrix.python }} BASE_IMAGE=nvidia/cuda:${{ matrix.cuda }}-cudnn${{ matrix.cudnn }}-runtime-ubuntu${{ matrix.ubuntu }} + cache-from: type=local,src=/tmp/.buildx-cache + cache-to: type=local,dest=/tmp/.buildx-cache-new + - name: Move cache + # https://github.com/docker/build-push-action/issues/252 + # https://github.com/moby/buildkit/issues/1896 + run: | + rm -rf /tmp/.buildx-cache + mv /tmp/.buildx-cache-new /tmp/.buildx-cache From e7467d4a8fba414253a0ff7522cf4ba693915b95 Mon Sep 17 00:00:00 2001 From: Casper da Costa-Luis Date: Mon, 17 May 2021 10:35:41 +0100 Subject: [PATCH 11/16] build: docker: pull to update base images --- .github/workflows/test-deploy.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/test-deploy.yml b/.github/workflows/test-deploy.yml index 3a64620c8..f20a9bc61 100644 --- a/.github/workflows/test-deploy.yml +++ b/.github/workflows/test-deploy.yml @@ -107,6 +107,7 @@ jobs: DVC_VERSION=${{ matrix.dvc }} PYTHON_VERSION=${{ matrix.python }} BASE_IMAGE=ubuntu:${{ matrix.ubuntu }} + pull: true cache-from: type=local,src=/tmp/.buildx-cache cache-to: type=local,dest=/tmp/.buildx-cache-new - uses: docker/build-push-action@v2 @@ -127,6 +128,7 @@ jobs: DVC_VERSION=${{ matrix.dvc }} PYTHON_VERSION=${{ matrix.python }} BASE_IMAGE=nvidia/cuda:${{ matrix.cuda }}-cudnn${{ matrix.cudnn }}-runtime-ubuntu${{ matrix.ubuntu }} + pull: true cache-from: type=local,src=/tmp/.buildx-cache cache-to: type=local,dest=/tmp/.buildx-cache-new - name: Move cache From 2acd0553c67faedbceb09cfa32175e3b2e0fb2ec Mon Sep 17 00:00:00 2001 From: Casper da Costa-Luis Date: Mon, 17 May 2021 11:09:09 +0100 Subject: [PATCH 12/16] condense docker matrix --- .github/workflows/test-deploy.yml | 40 ++++++++++--------------------- 1 file changed, 13 insertions(+), 27 deletions(-) diff --git a/.github/workflows/test-deploy.yml b/.github/workflows/test-deploy.yml index f20a9bc61..c72c16834 100644 --- a/.github/workflows/test-deploy.yml +++ b/.github/workflows/test-deploy.yml @@ -89,29 +89,17 @@ jobs: registry: ghcr.io username: ${{ github.repository_owner }} password: ${{ github.token }} + - name: Metadata + id: metadata + run: | + if [[ ${{ matrix.gpu }} == true ]]; the + echo ::set-output name=base::nvidia/cuda:${{ matrix.cuda }}-cudnn${{ matrix.cudnn }}-runtime-ubuntu${{ matrix.ubuntu }} + echo ::set-output name=tag::${{ matrix.cml }}-dvc${{ matrix.dvc }}-base${{ matrix.base }}-gpu + else + echo ::set-output name=base::ubuntu:${{ matrix.ubuntu }} + echo ::set-output name=tag::${{ matrix.cml }}-dvc${{ matrix.dvc }}-base${{ matrix.base }} + fi - uses: docker/build-push-action@v2 - if: matrix.gpu == false - with: - push: - ${{ github.event_name == 'release' || github.event_name == - 'schedule' }} - context: ./ - file: ./Dockerfile - tags: | - docker.io/dvcorg/cml:${{ matrix.cml }}-dvc${{ matrix.dvc }}-base${{ - matrix.base }} - ghcr.io/iterative/cml:${{ matrix.cml }}-dvc${{ matrix.dvc }}-base${{ - matrix.base }} - build-args: | - CML_VERSION=${{ matrix.cml }} - DVC_VERSION=${{ matrix.dvc }} - PYTHON_VERSION=${{ matrix.python }} - BASE_IMAGE=ubuntu:${{ matrix.ubuntu }} - pull: true - cache-from: type=local,src=/tmp/.buildx-cache - cache-to: type=local,dest=/tmp/.buildx-cache-new - - uses: docker/build-push-action@v2 - if: matrix.gpu == true with: push: ${{ github.event_name == 'release' || github.event_name == @@ -119,15 +107,13 @@ jobs: context: ./ file: ./Dockerfile tags: | - docker.io/dvcorg/cml:${{ matrix.cml }}-dvc${{ matrix.dvc }}-base${{ - matrix.base }}-gpu - ghcr.io/iterative/cml:${{ matrix.cml }}-dvc${{ matrix.dvc }}-base${{ - matrix.base }}-gpu + docker.io/dvcorg/cml:${{ steps.metadata.outputs.tag }} + ghcr.io/iterative/cml:${{ steps.metadata.outputs.tag }} build-args: | CML_VERSION=${{ matrix.cml }} DVC_VERSION=${{ matrix.dvc }} PYTHON_VERSION=${{ matrix.python }} - BASE_IMAGE=nvidia/cuda:${{ matrix.cuda }}-cudnn${{ matrix.cudnn }}-runtime-ubuntu${{ matrix.ubuntu }} + BASE_IMAGE=${{ steps.metadata.outputs.base }} pull: true cache-from: type=local,src=/tmp/.buildx-cache cache-to: type=local,dest=/tmp/.buildx-cache-new From a39bbfa0d58b6f0d915884b130f062df4732a995 Mon Sep 17 00:00:00 2001 From: Casper da Costa-Luis Date: Mon, 17 May 2021 11:30:31 +0100 Subject: [PATCH 13/16] docker cache on cml version --- .github/workflows/test-deploy.yml | 35 ++++++++++++++++++------------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/.github/workflows/test-deploy.yml b/.github/workflows/test-deploy.yml index c72c16834..16e4ceb54 100644 --- a/.github/workflows/test-deploy.yml +++ b/.github/workflows/test-deploy.yml @@ -56,7 +56,6 @@ jobs: needs: packages strategy: matrix: - cml: [0] dvc: [1, 2] base: [0, 1] gpu: [false, true] @@ -73,12 +72,30 @@ jobs: cudnn: 8 steps: - uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: Metadata + id: metadata + run: | + latest_tag=$(git describe --tags | cut -d- -f1) + cml_version=${latest_tag##v} + echo ::set-output name=cml_version::$cml_version + if [[ ${{ matrix.gpu }} == true ]]; then + echo ::set-output name=base::nvidia/cuda:${{ matrix.cuda }}-cudnn${{ matrix.cudnn }}-runtime-ubuntu${{ matrix.ubuntu }} + echo ::set-output name=tag::${cml_version//.*/}-dvc${{ matrix.dvc }}-base${{ matrix.base }}-gpu + else + echo ::set-output name=base::ubuntu:${{ matrix.ubuntu }} + echo ::set-output name=tag::${cml_version//.*/}-dvc${{ matrix.dvc }}-base${{ matrix.base }} + fi - uses: docker/setup-buildx-action@v1 - uses: actions/cache@v2 with: path: /tmp/.buildx-cache - key: ${{ runner.os }}-buildx-${{ github.sha }} - restore-keys: ${{ runner.os }}-buildx- + key: + ${{ runner.os }}-buildx-${{ steps.metadata.outputs.cml_version + }}-${{ github.sha }} + restore-keys: + ${{ runner.os }}-buildx-${{ steps.metadata.outputs.cml_version }}- - uses: docker/login-action@v1 with: registry: docker.io @@ -89,16 +106,6 @@ jobs: registry: ghcr.io username: ${{ github.repository_owner }} password: ${{ github.token }} - - name: Metadata - id: metadata - run: | - if [[ ${{ matrix.gpu }} == true ]]; the - echo ::set-output name=base::nvidia/cuda:${{ matrix.cuda }}-cudnn${{ matrix.cudnn }}-runtime-ubuntu${{ matrix.ubuntu }} - echo ::set-output name=tag::${{ matrix.cml }}-dvc${{ matrix.dvc }}-base${{ matrix.base }}-gpu - else - echo ::set-output name=base::ubuntu:${{ matrix.ubuntu }} - echo ::set-output name=tag::${{ matrix.cml }}-dvc${{ matrix.dvc }}-base${{ matrix.base }} - fi - uses: docker/build-push-action@v2 with: push: @@ -110,7 +117,7 @@ jobs: docker.io/dvcorg/cml:${{ steps.metadata.outputs.tag }} ghcr.io/iterative/cml:${{ steps.metadata.outputs.tag }} build-args: | - CML_VERSION=${{ matrix.cml }} + CML_VERSION=${{ steps.metadata.outputs.cml_version }} DVC_VERSION=${{ matrix.dvc }} PYTHON_VERSION=${{ matrix.python }} BASE_IMAGE=${{ steps.metadata.outputs.base }} From d5ff751ad7834d28f0f12f46617c3210c7ba9748 Mon Sep 17 00:00:00 2001 From: Casper da Costa-Luis Date: Mon, 17 May 2021 13:44:23 +0100 Subject: [PATCH 14/16] docker cache on full version --- .github/workflows/test-deploy.yml | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test-deploy.yml b/.github/workflows/test-deploy.yml index 16e4ceb54..524761de1 100644 --- a/.github/workflows/test-deploy.yml +++ b/.github/workflows/test-deploy.yml @@ -79,6 +79,20 @@ jobs: run: | latest_tag=$(git describe --tags | cut -d- -f1) cml_version=${latest_tag##v} + dvc_version=$(\ + curl -L https://pypi.org/pypi/dvc/json | + jq -r '.releases | keys[]' | + python3 -c ' + import sys + from distutils.version import StrictVersion as Ver + print( + max( + (i.strip() for i in sys.stdin if i.startswith("${{ matrix.dvc }}")), + default="${{ matrix.dvc }}", + key=Ver + ) + )') + echo ::set-output name=cache_tag::${cml_version}-${dvc_version}-${{ matrix.base }}-${{ matrix.gpu }} echo ::set-output name=cml_version::$cml_version if [[ ${{ matrix.gpu }} == true ]]; then echo ::set-output name=base::nvidia/cuda:${{ matrix.cuda }}-cudnn${{ matrix.cudnn }}-runtime-ubuntu${{ matrix.ubuntu }} @@ -92,10 +106,10 @@ jobs: with: path: /tmp/.buildx-cache key: - ${{ runner.os }}-buildx-${{ steps.metadata.outputs.cml_version - }}-${{ github.sha }} + ${{ runner.os }}-buildx-${{ steps.metadata.outputs.cache_tag }}-${{ + github.sha }} restore-keys: - ${{ runner.os }}-buildx-${{ steps.metadata.outputs.cml_version }}- + ${{ runner.os }}-buildx-${{ steps.metadata.outputs.cache_tag }}- - uses: docker/login-action@v1 with: registry: docker.io From 4b799ec1e7673ab716cbd2480308b71942182fdb Mon Sep 17 00:00:00 2001 From: Casper da Costa-Luis Date: Mon, 17 May 2021 14:20:27 +0100 Subject: [PATCH 15/16] less Rube Goldberg, more Python --- .github/workflows/test-deploy.yml | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/.github/workflows/test-deploy.yml b/.github/workflows/test-deploy.yml index 524761de1..1444acfa8 100644 --- a/.github/workflows/test-deploy.yml +++ b/.github/workflows/test-deploy.yml @@ -79,15 +79,14 @@ jobs: run: | latest_tag=$(git describe --tags | cut -d- -f1) cml_version=${latest_tag##v} - dvc_version=$(\ - curl -L https://pypi.org/pypi/dvc/json | - jq -r '.releases | keys[]' | - python3 -c ' - import sys + dvc_version=$(python3 -c ' from distutils.version import StrictVersion as Ver + from urllib.request import urlopen + from json import load + data = load(urlopen("https://pypi.org/pypi/dvc/json")) print( max( - (i.strip() for i in sys.stdin if i.startswith("${{ matrix.dvc }}")), + (i.strip() for i in data["releases"] if i.startswith("${{ matrix.dvc }}")), default="${{ matrix.dvc }}", key=Ver ) From 1d2cf35fc27a24b365fe0094ee048759a198c270 Mon Sep 17 00:00:00 2001 From: Casper da Costa-Luis Date: Mon, 17 May 2021 15:43:13 +0100 Subject: [PATCH 16/16] fix version parsing --- .github/workflows/test-deploy.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test-deploy.yml b/.github/workflows/test-deploy.yml index 1444acfa8..7833ba152 100644 --- a/.github/workflows/test-deploy.yml +++ b/.github/workflows/test-deploy.yml @@ -84,9 +84,10 @@ jobs: from urllib.request import urlopen from json import load data = load(urlopen("https://pypi.org/pypi/dvc/json")) + ver_pre = "${{ matrix.dvc }}".rstrip(".") + "." print( max( - (i.strip() for i in data["releases"] if i.startswith("${{ matrix.dvc }}")), + (i.strip() for i in data["releases"] if i.startswith(ver_pre)), default="${{ matrix.dvc }}", key=Ver )