From 99a4231420ee60332cd51fcb48a9579a871bf2ba Mon Sep 17 00:00:00 2001 From: serhii Date: Sat, 30 Jul 2022 17:34:25 +0100 Subject: [PATCH 001/145] Initial commit --- .github/workflows/github-actions-demo.yml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 .github/workflows/github-actions-demo.yml diff --git a/.github/workflows/github-actions-demo.yml b/.github/workflows/github-actions-demo.yml new file mode 100644 index 00000000..75be1014 --- /dev/null +++ b/.github/workflows/github-actions-demo.yml @@ -0,0 +1,17 @@ +name: GitHub Actions Demo +on: [push] +jobs: + Explore-GitHub-Actions: + runs-on: ubuntu-latest + steps: + - run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event." + - run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub!" + - run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}." + - name: Check out repository code + uses: actions/checkout@v3 + - run: echo "💡 The ${{ github.repository }} repository has been cloned to the runner." + - run: echo "🖥️ The workflow is now ready to test your code on the runner." + - name: List files in the repository + run: | + ls ${{ github.workspace }} + - run: echo "🍏 This job's status is ${{ job.status }}." From 9e63e386a6c98f697b55768cddd9dc52d52a390a Mon Sep 17 00:00:00 2001 From: serhii Date: Sat, 30 Jul 2022 18:06:46 +0100 Subject: [PATCH 002/145] Added pipeline --- .github/workflows/github-actions-demo.yml | 27 +++++++++++++---------- 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/.github/workflows/github-actions-demo.yml b/.github/workflows/github-actions-demo.yml index 75be1014..a280f1bb 100644 --- a/.github/workflows/github-actions-demo.yml +++ b/.github/workflows/github-actions-demo.yml @@ -1,17 +1,20 @@ -name: GitHub Actions Demo +name: Build on: [push] jobs: - Explore-GitHub-Actions: + Juniper: runs-on: ubuntu-latest + timeout-minutes: 180 + steps: + - run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event." + + Koa: + runs-on: ubuntu-latest + timeout-minutes: 180 + steps: + - run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event." + + Lilac: + runs-on: ubuntu-latest + timeout-minutes: 180 steps: - run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event." - - run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub!" - - run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}." - - name: Check out repository code - uses: actions/checkout@v3 - - run: echo "💡 The ${{ github.repository }} repository has been cloned to the runner." - - run: echo "🖥️ The workflow is now ready to test your code on the runner." - - name: List files in the repository - run: | - ls ${{ github.workspace }} - - run: echo "🍏 This job's status is ${{ job.status }}." From ac6e1817786e4aa530d9de01837c4d65b8975aa8 Mon Sep 17 00:00:00 2001 From: serhii Date: Sat, 30 Jul 2022 18:19:22 +0100 Subject: [PATCH 003/145] Added pipeline --- .github/workflows/build.yml | 31 +++++++++++++++++++++++ .github/workflows/github-actions-demo.yml | 20 --------------- 2 files changed, 31 insertions(+), 20 deletions(-) create mode 100644 .github/workflows/build.yml delete mode 100644 .github/workflows/github-actions-demo.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 00000000..25e843e0 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,31 @@ +name: Build +on: [push] + +env: + CACHE_KEY_BASE: 22 # Increment this value to reset the images cache + CACHE_KEY_FILES: $(System.DefaultWorkingDirectory)/docker-definition/**/* + CACHE_KEY_IMAGES: BASE_SEED=$(CACHE_KEY_BASE) | $(CACHE_KEY_FILES) + IMAGE_CACHE_PATH: $(Pipeline.Workspace)/image_cache + SENTINEL_CACHE_PATH: $(Pipeline.Workspace)/sentinel_cache + UBUNTU_VERSION: ubuntu-latest + PIPELINE_TIMEOUT: 180 + +jobs: + Juniper: + runs-on: $UBUNTU_VERSION + timeout-minutes: $PIPELINE_TIMEOUT + steps: + - run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event." + - run: pwd + + Koa: + runs-on: $UBUNTU_VERSION + timeout-minutes: $PIPELINE_TIMEOUT + steps: + - run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event." + + Lilac: + runs-on: $UBUNTU_VERSION + timeout-minutes: $PIPELINE_TIMEOUT + steps: + - run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event." diff --git a/.github/workflows/github-actions-demo.yml b/.github/workflows/github-actions-demo.yml deleted file mode 100644 index a280f1bb..00000000 --- a/.github/workflows/github-actions-demo.yml +++ /dev/null @@ -1,20 +0,0 @@ -name: Build -on: [push] -jobs: - Juniper: - runs-on: ubuntu-latest - timeout-minutes: 180 - steps: - - run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event." - - Koa: - runs-on: ubuntu-latest - timeout-minutes: 180 - steps: - - run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event." - - Lilac: - runs-on: ubuntu-latest - timeout-minutes: 180 - steps: - - run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event." From 459eeb817d65fc7072fbbb052a6100d071475505 Mon Sep 17 00:00:00 2001 From: serhii Date: Sat, 30 Jul 2022 18:21:37 +0100 Subject: [PATCH 004/145] Fix variables --- .github/workflows/build.yml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 25e843e0..2df3a372 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -3,29 +3,29 @@ on: [push] env: CACHE_KEY_BASE: 22 # Increment this value to reset the images cache - CACHE_KEY_FILES: $(System.DefaultWorkingDirectory)/docker-definition/**/* - CACHE_KEY_IMAGES: BASE_SEED=$(CACHE_KEY_BASE) | $(CACHE_KEY_FILES) - IMAGE_CACHE_PATH: $(Pipeline.Workspace)/image_cache - SENTINEL_CACHE_PATH: $(Pipeline.Workspace)/sentinel_cache + CACHE_KEY_FILES: ${{ System.DefaultWorkingDirectory }}/docker-definition/**/* + CACHE_KEY_IMAGES: BASE_SEED=${{ CACHE_KEY_BASE }} | ${{ CACHE_KEY_FILES }} + IMAGE_CACHE_PATH: ${{ Pipeline.Workspace }}/image_cache + SENTINEL_CACHE_PATH: ${{ Pipeline.Workspace }}/sentinel_cache UBUNTU_VERSION: ubuntu-latest PIPELINE_TIMEOUT: 180 jobs: Juniper: - runs-on: $UBUNTU_VERSION - timeout-minutes: $PIPELINE_TIMEOUT + runs-on: ${{ UBUNTU_VERSION }} + timeout-minutes: ${{ PIPELINE_TIMEOUT }} steps: - run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event." - run: pwd Koa: - runs-on: $UBUNTU_VERSION - timeout-minutes: $PIPELINE_TIMEOUT + runs-on: ${{ UBUNTU_VERSION }} + timeout-minutes: ${{ PIPELINE_TIMEOUT }} steps: - run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event." Lilac: - runs-on: $UBUNTU_VERSION - timeout-minutes: $PIPELINE_TIMEOUT + runs-on: ${{ UBUNTU_VERSION }} + timeout-minutes: ${{ PIPELINE_TIMEOUT }} steps: - run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event." From 6279af616c12c87b9d48eb7a0fab21bb72dd46c8 Mon Sep 17 00:00:00 2001 From: serhii Date: Sat, 30 Jul 2022 18:22:13 +0100 Subject: [PATCH 005/145] Fix variables --- .github/workflows/build.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2df3a372..4fe7ff60 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -3,10 +3,10 @@ on: [push] env: CACHE_KEY_BASE: 22 # Increment this value to reset the images cache - CACHE_KEY_FILES: ${{ System.DefaultWorkingDirectory }}/docker-definition/**/* - CACHE_KEY_IMAGES: BASE_SEED=${{ CACHE_KEY_BASE }} | ${{ CACHE_KEY_FILES }} - IMAGE_CACHE_PATH: ${{ Pipeline.Workspace }}/image_cache - SENTINEL_CACHE_PATH: ${{ Pipeline.Workspace }}/sentinel_cache +# CACHE_KEY_FILES: ${{ System.DefaultWorkingDirectory }}/docker-definition/**/* +# CACHE_KEY_IMAGES: BASE_SEED=${{ CACHE_KEY_BASE }} | ${{ CACHE_KEY_FILES }} +# IMAGE_CACHE_PATH: ${{ Pipeline.Workspace }}/image_cache +# SENTINEL_CACHE_PATH: ${{ Pipeline.Workspace }}/sentinel_cache UBUNTU_VERSION: ubuntu-latest PIPELINE_TIMEOUT: 180 From c40e3224747bc371fe0f8d0263b7c06d77f00a41 Mon Sep 17 00:00:00 2001 From: serhii Date: Sat, 30 Jul 2022 18:25:14 +0100 Subject: [PATCH 006/145] Fix variables --- .github/workflows/build.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4fe7ff60..59953cd9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -12,20 +12,20 @@ env: jobs: Juniper: - runs-on: ${{ UBUNTU_VERSION }} - timeout-minutes: ${{ PIPELINE_TIMEOUT }} + runs-on: ${{ env.UBUNTU_VERSION }} + timeout-minutes: ${{ env.PIPELINE_TIMEOUT }} steps: - run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event." - run: pwd Koa: - runs-on: ${{ UBUNTU_VERSION }} - timeout-minutes: ${{ PIPELINE_TIMEOUT }} + runs-on: ${{ env.UBUNTU_VERSION }} + timeout-minutes: ${{ env.PIPELINE_TIMEOUT }} steps: - run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event." Lilac: - runs-on: ${{ UBUNTU_VERSION }} - timeout-minutes: ${{ PIPELINE_TIMEOUT }} + runs-on: ${{ env.UBUNTU_VERSION }} + timeout-minutes: ${{ env.PIPELINE_TIMEOUT }} steps: - run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event." From c4d6b8d115ce9c0c4678f3510d04f42fbea1bd00 Mon Sep 17 00:00:00 2001 From: serhii Date: Sat, 30 Jul 2022 18:28:40 +0100 Subject: [PATCH 007/145] Fix variables --- .github/workflows/build.yml | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 59953cd9..caf710f6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -7,25 +7,24 @@ env: # CACHE_KEY_IMAGES: BASE_SEED=${{ CACHE_KEY_BASE }} | ${{ CACHE_KEY_FILES }} # IMAGE_CACHE_PATH: ${{ Pipeline.Workspace }}/image_cache # SENTINEL_CACHE_PATH: ${{ Pipeline.Workspace }}/sentinel_cache - UBUNTU_VERSION: ubuntu-latest PIPELINE_TIMEOUT: 180 jobs: Juniper: - runs-on: ${{ env.UBUNTU_VERSION }} - timeout-minutes: ${{ env.PIPELINE_TIMEOUT }} + runs-on: ubuntu-latest + timeout-minutes: ${{ PIPELINE_TIMEOUT }} steps: - run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event." - run: pwd Koa: - runs-on: ${{ env.UBUNTU_VERSION }} - timeout-minutes: ${{ env.PIPELINE_TIMEOUT }} + runs-on: ubuntu-latest + timeout-minutes: ${{ PIPELINE_TIMEOUT }} steps: - run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event." Lilac: - runs-on: ${{ env.UBUNTU_VERSION }} - timeout-minutes: ${{ env.PIPELINE_TIMEOUT }} + runs-on: ubuntu-latest + timeout-minutes: ${{ PIPELINE_TIMEOUT }} steps: - run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event." From ec519843db1b35e214c656afd12645c2734f46b9 Mon Sep 17 00:00:00 2001 From: serhii Date: Sat, 30 Jul 2022 18:29:37 +0100 Subject: [PATCH 008/145] Fix variables --- .github/workflows/build.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index caf710f6..e7b6b003 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -7,24 +7,23 @@ env: # CACHE_KEY_IMAGES: BASE_SEED=${{ CACHE_KEY_BASE }} | ${{ CACHE_KEY_FILES }} # IMAGE_CACHE_PATH: ${{ Pipeline.Workspace }}/image_cache # SENTINEL_CACHE_PATH: ${{ Pipeline.Workspace }}/sentinel_cache - PIPELINE_TIMEOUT: 180 jobs: Juniper: runs-on: ubuntu-latest - timeout-minutes: ${{ PIPELINE_TIMEOUT }} + timeout-minutes: 180 steps: - run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event." - run: pwd Koa: runs-on: ubuntu-latest - timeout-minutes: ${{ PIPELINE_TIMEOUT }} + timeout-minutes: 180 steps: - run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event." Lilac: runs-on: ubuntu-latest - timeout-minutes: ${{ PIPELINE_TIMEOUT }} + timeout-minutes: 180 steps: - run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event." From 9581e5bae35f9d70243135ef54cb4ad3bf831451 Mon Sep 17 00:00:00 2001 From: serhii Date: Sat, 30 Jul 2022 18:33:25 +0100 Subject: [PATCH 009/145] Fix variables --- .github/workflows/build.yml | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e7b6b003..e814682b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -3,27 +3,32 @@ on: [push] env: CACHE_KEY_BASE: 22 # Increment this value to reset the images cache -# CACHE_KEY_FILES: ${{ System.DefaultWorkingDirectory }}/docker-definition/**/* -# CACHE_KEY_IMAGES: BASE_SEED=${{ CACHE_KEY_BASE }} | ${{ CACHE_KEY_FILES }} -# IMAGE_CACHE_PATH: ${{ Pipeline.Workspace }}/image_cache -# SENTINEL_CACHE_PATH: ${{ Pipeline.Workspace }}/sentinel_cache + CACHE_KEY_FILES: ${{ GITHUB_WORKSPACE }}/docker-definition/**/* + CACHE_KEY_IMAGES: BASE_SEED=${{ CACHE_KEY_BASE }} | ${{ CACHE_KEY_FILES }} + IMAGE_CACHE_PATH: ${{ GITHUB_WORKSPACE }}/image_cache + SENTINEL_CACHE_PATH: ${{ GITHUB_WORKSPACE }}/sentinel_cache jobs: - Juniper: + juniper: runs-on: ubuntu-latest timeout-minutes: 180 + env: + DOCKER_IMAGES_SLUG: juniper steps: - run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event." - - run: pwd - Koa: + koa: runs-on: ubuntu-latest timeout-minutes: 180 + env: + DOCKER_IMAGES_SLUG: koa steps: - run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event." - Lilac: + lilac: runs-on: ubuntu-latest timeout-minutes: 180 + env: + DOCKER_IMAGES_SLUG: lilac steps: - run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event." From 60093ccd70a31d43a4818183635651bcac91731c Mon Sep 17 00:00:00 2001 From: serhii Date: Sat, 30 Jul 2022 18:35:11 +0100 Subject: [PATCH 010/145] Fix variables --- .github/workflows/build.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e814682b..47d9dc66 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -3,10 +3,10 @@ on: [push] env: CACHE_KEY_BASE: 22 # Increment this value to reset the images cache - CACHE_KEY_FILES: ${{ GITHUB_WORKSPACE }}/docker-definition/**/* - CACHE_KEY_IMAGES: BASE_SEED=${{ CACHE_KEY_BASE }} | ${{ CACHE_KEY_FILES }} - IMAGE_CACHE_PATH: ${{ GITHUB_WORKSPACE }}/image_cache - SENTINEL_CACHE_PATH: ${{ GITHUB_WORKSPACE }}/sentinel_cache + CACHE_KEY_FILES: $GITHUB_WORKSPACE/docker-definition/**/* + CACHE_KEY_IMAGES: BASE_SEED=CACHE_KEY_BASE | ${{ CACHE_KEY_FILES }} + IMAGE_CACHE_PATH: $GITHUB_WORKSPACE/image_cache + SENTINEL_CACHE_PATH: $GITHUB_WORKSPACE/sentinel_cache jobs: juniper: From c2c5cd9bcf41f92a0a55c9ec872861713f08367c Mon Sep 17 00:00:00 2001 From: serhii Date: Sat, 30 Jul 2022 18:35:51 +0100 Subject: [PATCH 011/145] Fix variables --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 47d9dc66..e17174fa 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -4,7 +4,7 @@ on: [push] env: CACHE_KEY_BASE: 22 # Increment this value to reset the images cache CACHE_KEY_FILES: $GITHUB_WORKSPACE/docker-definition/**/* - CACHE_KEY_IMAGES: BASE_SEED=CACHE_KEY_BASE | ${{ CACHE_KEY_FILES }} + CACHE_KEY_IMAGES: BASE_SEED=$CACHE_KEY_BASE | $CACHE_KEY_FILES IMAGE_CACHE_PATH: $GITHUB_WORKSPACE/image_cache SENTINEL_CACHE_PATH: $GITHUB_WORKSPACE/sentinel_cache From 1bd2e03082f37525142495379bbb2a20530a2995 Mon Sep 17 00:00:00 2001 From: serhii Date: Sat, 30 Jul 2022 18:42:53 +0100 Subject: [PATCH 012/145] Add cache --- .github/workflows/build.yml | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e17174fa..13087054 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -15,7 +15,12 @@ jobs: env: DOCKER_IMAGES_SLUG: juniper steps: - - run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event." + - name: Resolve Sentinel cache + id: cache-juniper + uses: action/cache@v3 + with: + path: $(SENTINEL_CACHE_PATH) + key: SENTINEL=1 | $(DOCKER_IMAGES_SLUG) | $(CACHE_KEY_IMAGES) koa: runs-on: ubuntu-latest @@ -23,12 +28,21 @@ jobs: env: DOCKER_IMAGES_SLUG: koa steps: - - run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event." - + - name: Resolve Sentinel cache + id: cache-koa + uses: action/cache@v3 + with: + path: $(SENTINEL_CACHE_PATH) + key: SENTINEL=1 | $(DOCKER_IMAGES_SLUG) | $(CACHE_KEY_IMAGES) lilac: runs-on: ubuntu-latest timeout-minutes: 180 env: DOCKER_IMAGES_SLUG: lilac steps: - - run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event." + - name: Resolve Sentinel cache + id: cache-lilac + uses: action/cache@v3 + with: + path: $(SENTINEL_CACHE_PATH) + key: SENTINEL=1 | $(DOCKER_IMAGES_SLUG) | $(CACHE_KEY_IMAGES) \ No newline at end of file From cf58e5c3f17e4ed165ab94879ff962013659f8cd Mon Sep 17 00:00:00 2001 From: serhii Date: Sat, 30 Jul 2022 18:44:16 +0100 Subject: [PATCH 013/145] Add cache --- .github/workflows/build.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 13087054..4610e372 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -15,6 +15,8 @@ jobs: env: DOCKER_IMAGES_SLUG: juniper steps: + - uses: actions/checkout@v3 + - name: Resolve Sentinel cache id: cache-juniper uses: action/cache@v3 @@ -28,6 +30,8 @@ jobs: env: DOCKER_IMAGES_SLUG: koa steps: + - uses: actions/checkout@v3 + - name: Resolve Sentinel cache id: cache-koa uses: action/cache@v3 @@ -40,6 +44,8 @@ jobs: env: DOCKER_IMAGES_SLUG: lilac steps: + - uses: actions/checkout@v3 + - name: Resolve Sentinel cache id: cache-lilac uses: action/cache@v3 From 009d4e471dd7ecff77aa251bc568fdd53cce59b2 Mon Sep 17 00:00:00 2001 From: serhii Date: Sat, 30 Jul 2022 18:44:56 +0100 Subject: [PATCH 014/145] Fix cache --- .github/workflows/build.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4610e372..18cd2942 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -19,7 +19,7 @@ jobs: - name: Resolve Sentinel cache id: cache-juniper - uses: action/cache@v3 + uses: actions/cache@v3 with: path: $(SENTINEL_CACHE_PATH) key: SENTINEL=1 | $(DOCKER_IMAGES_SLUG) | $(CACHE_KEY_IMAGES) @@ -34,7 +34,7 @@ jobs: - name: Resolve Sentinel cache id: cache-koa - uses: action/cache@v3 + uses: actions/cache@v3 with: path: $(SENTINEL_CACHE_PATH) key: SENTINEL=1 | $(DOCKER_IMAGES_SLUG) | $(CACHE_KEY_IMAGES) @@ -48,7 +48,7 @@ jobs: - name: Resolve Sentinel cache id: cache-lilac - uses: action/cache@v3 + uses: actions/cache@v3 with: path: $(SENTINEL_CACHE_PATH) key: SENTINEL=1 | $(DOCKER_IMAGES_SLUG) | $(CACHE_KEY_IMAGES) \ No newline at end of file From dad5014230683279b88f75476136a19316121517 Mon Sep 17 00:00:00 2001 From: serhii Date: Sat, 30 Jul 2022 18:53:45 +0100 Subject: [PATCH 015/145] Fix cache --- .github/workflows/build.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 18cd2942..1a0074d0 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -24,6 +24,21 @@ jobs: path: $(SENTINEL_CACHE_PATH) key: SENTINEL=1 | $(DOCKER_IMAGES_SLUG) | $(CACHE_KEY_IMAGES) + - name: Docker images cache + if: steps.cache-juniper.outputs.cache-hit == 'true' + uses: actions/cache@v3 + with: + path: $(SENTINEL_CACHE_PATH) + key: BASE_SEED=$(CACHE_KEY_BASE) | juniper + + - name: Load juniper images + run: | + [ -d $(IMAGE_CACHE_PATH) ] || exit 0 + ls -l $(IMAGE_CACHE_PATH) + docker images + set -euxo pipefail + cat $(IMAGE_CACHE_PATH)/edx-juniper.tar.xz | unxz | docker load + docker images koa: runs-on: ubuntu-latest timeout-minutes: 180 From 2b0e4d0febaa970d3c36e4cc270d5eecbd4d0583 Mon Sep 17 00:00:00 2001 From: serhii Date: Sat, 30 Jul 2022 18:58:53 +0100 Subject: [PATCH 016/145] Fix cache --- .github/workflows/build.yml | 39 +++++++++++++++++++++++++++++++++++-- 1 file changed, 37 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1a0074d0..fa66d03f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -32,8 +32,9 @@ jobs: key: BASE_SEED=$(CACHE_KEY_BASE) | juniper - name: Load juniper images + if: steps.cache-juniper.outputs.cache-hit == 'true' run: | - [ -d $(IMAGE_CACHE_PATH) ] || exit 0 +# if [ $(IMAGE_CACHE_PATH) == "" ] || exit 0 ls -l $(IMAGE_CACHE_PATH) docker images set -euxo pipefail @@ -53,6 +54,23 @@ jobs: with: path: $(SENTINEL_CACHE_PATH) key: SENTINEL=1 | $(DOCKER_IMAGES_SLUG) | $(CACHE_KEY_IMAGES) + + - name: Docker images cache + if: steps.cache-koa.outputs.cache-hit == 'true' + uses: actions/cache@v3 + with: + path: $(SENTINEL_CACHE_PATH) + key: BASE_SEED=$(CACHE_KEY_BASE) | juniper + + - name: Load koa images + if: steps.cache-koa.outputs.cache-hit == 'true' + run: | +# if [ $(IMAGE_CACHE_PATH) == "" ] || exit 0 + ls -l $(IMAGE_CACHE_PATH) + docker images + set -euxo pipefail + cat $(IMAGE_CACHE_PATH)/edx-koa.tar.xz | unxz | docker load + docker images lilac: runs-on: ubuntu-latest timeout-minutes: 180 @@ -66,4 +84,21 @@ jobs: uses: actions/cache@v3 with: path: $(SENTINEL_CACHE_PATH) - key: SENTINEL=1 | $(DOCKER_IMAGES_SLUG) | $(CACHE_KEY_IMAGES) \ No newline at end of file + key: SENTINEL=1 | $(DOCKER_IMAGES_SLUG) | $(CACHE_KEY_IMAGES) + + - name: Docker images cache + if: steps.cache-juniper.outputs.cache-hit == 'true' + uses: actions/cache@v3 + with: + path: $(SENTINEL_CACHE_PATH) + key: BASE_SEED=$(CACHE_KEY_BASE) | juniper + + - name: Load lilac images + if: steps.cache-lilac.outputs.cache-hit == 'true' + run: | +# if [ $(IMAGE_CACHE_PATH) == "" ] || exit 0 + ls -l $(IMAGE_CACHE_PATH) + docker images + set -euxo pipefail + cat $(IMAGE_CACHE_PATH)/edx-lilac.tar.xz | unxz | docker load + docker images \ No newline at end of file From cf74af66841605cd690ef25d4ffe996ab1089baf Mon Sep 17 00:00:00 2001 From: serhii Date: Sat, 30 Jul 2022 18:59:45 +0100 Subject: [PATCH 017/145] Fix cache --- .github/workflows/build.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index fa66d03f..201ef26d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -34,7 +34,6 @@ jobs: - name: Load juniper images if: steps.cache-juniper.outputs.cache-hit == 'true' run: | -# if [ $(IMAGE_CACHE_PATH) == "" ] || exit 0 ls -l $(IMAGE_CACHE_PATH) docker images set -euxo pipefail @@ -65,7 +64,6 @@ jobs: - name: Load koa images if: steps.cache-koa.outputs.cache-hit == 'true' run: | -# if [ $(IMAGE_CACHE_PATH) == "" ] || exit 0 ls -l $(IMAGE_CACHE_PATH) docker images set -euxo pipefail @@ -96,7 +94,6 @@ jobs: - name: Load lilac images if: steps.cache-lilac.outputs.cache-hit == 'true' run: | -# if [ $(IMAGE_CACHE_PATH) == "" ] || exit 0 ls -l $(IMAGE_CACHE_PATH) docker images set -euxo pipefail From dfa11e76a118afae0f15633acdb3c77aa957c3df Mon Sep 17 00:00:00 2001 From: serhii Date: Sat, 30 Jul 2022 19:09:07 +0100 Subject: [PATCH 018/145] Fix cache --- .github/workflows/build.yml | 43 ++++++------------------------------- 1 file changed, 7 insertions(+), 36 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 201ef26d..0ada104b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -17,7 +17,7 @@ jobs: steps: - uses: actions/checkout@v3 - - name: Resolve Sentinel cache + - name: Docker images sentinel cache id: cache-juniper uses: actions/cache@v3 with: @@ -25,20 +25,22 @@ jobs: key: SENTINEL=1 | $(DOCKER_IMAGES_SLUG) | $(CACHE_KEY_IMAGES) - name: Docker images cache - if: steps.cache-juniper.outputs.cache-hit == 'true' + if: steps.cache-juniper.outputs.cache-hit != 'true' uses: actions/cache@v3 with: - path: $(SENTINEL_CACHE_PATH) - key: BASE_SEED=$(CACHE_KEY_BASE) | juniper + path: $(IMAGE_CACHE_PATH) + key: BASE_SEED=$(CACHE_KEY_BASE) | juniper | $(CACHE_KEY_IMAGES) + restore-keys: BASE_SEED=$(CACHE_KEY_BASE) | juniper - name: Load juniper images - if: steps.cache-juniper.outputs.cache-hit == 'true' + if: steps.cache-juniper.outputs.cache-hit != 'true' run: | ls -l $(IMAGE_CACHE_PATH) docker images set -euxo pipefail cat $(IMAGE_CACHE_PATH)/edx-juniper.tar.xz | unxz | docker load docker images + koa: runs-on: ubuntu-latest timeout-minutes: 180 @@ -54,21 +56,6 @@ jobs: path: $(SENTINEL_CACHE_PATH) key: SENTINEL=1 | $(DOCKER_IMAGES_SLUG) | $(CACHE_KEY_IMAGES) - - name: Docker images cache - if: steps.cache-koa.outputs.cache-hit == 'true' - uses: actions/cache@v3 - with: - path: $(SENTINEL_CACHE_PATH) - key: BASE_SEED=$(CACHE_KEY_BASE) | juniper - - - name: Load koa images - if: steps.cache-koa.outputs.cache-hit == 'true' - run: | - ls -l $(IMAGE_CACHE_PATH) - docker images - set -euxo pipefail - cat $(IMAGE_CACHE_PATH)/edx-koa.tar.xz | unxz | docker load - docker images lilac: runs-on: ubuntu-latest timeout-minutes: 180 @@ -83,19 +70,3 @@ jobs: with: path: $(SENTINEL_CACHE_PATH) key: SENTINEL=1 | $(DOCKER_IMAGES_SLUG) | $(CACHE_KEY_IMAGES) - - - name: Docker images cache - if: steps.cache-juniper.outputs.cache-hit == 'true' - uses: actions/cache@v3 - with: - path: $(SENTINEL_CACHE_PATH) - key: BASE_SEED=$(CACHE_KEY_BASE) | juniper - - - name: Load lilac images - if: steps.cache-lilac.outputs.cache-hit == 'true' - run: | - ls -l $(IMAGE_CACHE_PATH) - docker images - set -euxo pipefail - cat $(IMAGE_CACHE_PATH)/edx-lilac.tar.xz | unxz | docker load - docker images \ No newline at end of file From a3fa0491c0a3b82146db4c69a87317ab167aeedd Mon Sep 17 00:00:00 2001 From: serhii Date: Sat, 30 Jul 2022 19:14:30 +0100 Subject: [PATCH 019/145] Fix cache --- .github/workflows/build.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0ada104b..823bfd18 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -28,17 +28,17 @@ jobs: if: steps.cache-juniper.outputs.cache-hit != 'true' uses: actions/cache@v3 with: - path: $(IMAGE_CACHE_PATH) + path: $IMAGE_CACHE_PATH key: BASE_SEED=$(CACHE_KEY_BASE) | juniper | $(CACHE_KEY_IMAGES) restore-keys: BASE_SEED=$(CACHE_KEY_BASE) | juniper - name: Load juniper images if: steps.cache-juniper.outputs.cache-hit != 'true' run: | - ls -l $(IMAGE_CACHE_PATH) + ls -l $IMAGE_CACHE_PATH docker images set -euxo pipefail - cat $(IMAGE_CACHE_PATH)/edx-juniper.tar.xz | unxz | docker load + cat $IMAGE_CACHE_PATH/edx-juniper.tar.xz | unxz | docker load docker images koa: From 18183131378ff607d56b33de33493d23ef623f8e Mon Sep 17 00:00:00 2001 From: serhii Date: Sat, 30 Jul 2022 19:15:27 +0100 Subject: [PATCH 020/145] Fix cache --- .github/workflows/build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 823bfd18..64de6f97 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -35,6 +35,7 @@ jobs: - name: Load juniper images if: steps.cache-juniper.outputs.cache-hit != 'true' run: | + [ -d $IMAGE_CACHE_PATH ] || exit 0 ls -l $IMAGE_CACHE_PATH docker images set -euxo pipefail From 9cb43c30fb7e7ce6822980517d60243a2b5ffc7f Mon Sep 17 00:00:00 2001 From: serhii Date: Sat, 30 Jul 2022 19:19:34 +0100 Subject: [PATCH 021/145] Templated release name --- .github/workflows/build.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 64de6f97..a863e516 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -18,28 +18,28 @@ jobs: - uses: actions/checkout@v3 - name: Docker images sentinel cache - id: cache-juniper + id: cache-$DOCKER_IMAGES_SLUG uses: actions/cache@v3 with: path: $(SENTINEL_CACHE_PATH) key: SENTINEL=1 | $(DOCKER_IMAGES_SLUG) | $(CACHE_KEY_IMAGES) - name: Docker images cache - if: steps.cache-juniper.outputs.cache-hit != 'true' + if: steps.cache-$DOCKER_IMAGES_SLUG.outputs.cache-hit != 'true' uses: actions/cache@v3 with: path: $IMAGE_CACHE_PATH - key: BASE_SEED=$(CACHE_KEY_BASE) | juniper | $(CACHE_KEY_IMAGES) - restore-keys: BASE_SEED=$(CACHE_KEY_BASE) | juniper + key: BASE_SEED=$(CACHE_KEY_BASE) | $DOCKER_IMAGES_SLUG | $(CACHE_KEY_IMAGES) + restore-keys: BASE_SEED=$(CACHE_KEY_BASE) | $DOCKER_IMAGES_SLUG - - name: Load juniper images - if: steps.cache-juniper.outputs.cache-hit != 'true' + - name: Load $DOCKER_IMAGES_SLUG images + if: steps.cache-$DOCKER_IMAGES_SLUG.outputs.cache-hit != 'true' run: | [ -d $IMAGE_CACHE_PATH ] || exit 0 ls -l $IMAGE_CACHE_PATH docker images set -euxo pipefail - cat $IMAGE_CACHE_PATH/edx-juniper.tar.xz | unxz | docker load + cat $IMAGE_CACHE_PATH/edx-$DOCKER_IMAGES_SLUG.tar.xz | unxz | docker load docker images koa: From 4c5b532b1fa292c19bc44b7781e00801a6545092 Mon Sep 17 00:00:00 2001 From: serhii Date: Sat, 30 Jul 2022 19:20:56 +0100 Subject: [PATCH 022/145] Templated release name --- .github/workflows/build.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a863e516..8590e199 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -18,14 +18,14 @@ jobs: - uses: actions/checkout@v3 - name: Docker images sentinel cache - id: cache-$DOCKER_IMAGES_SLUG + id: cache-sentinel uses: actions/cache@v3 with: path: $(SENTINEL_CACHE_PATH) key: SENTINEL=1 | $(DOCKER_IMAGES_SLUG) | $(CACHE_KEY_IMAGES) - name: Docker images cache - if: steps.cache-$DOCKER_IMAGES_SLUG.outputs.cache-hit != 'true' + if: steps.cache-sentinel.outputs.cache-hit != 'true' uses: actions/cache@v3 with: path: $IMAGE_CACHE_PATH @@ -33,7 +33,7 @@ jobs: restore-keys: BASE_SEED=$(CACHE_KEY_BASE) | $DOCKER_IMAGES_SLUG - name: Load $DOCKER_IMAGES_SLUG images - if: steps.cache-$DOCKER_IMAGES_SLUG.outputs.cache-hit != 'true' + if: steps.cache-sentinel.outputs.cache-hit != 'true' run: | [ -d $IMAGE_CACHE_PATH ] || exit 0 ls -l $IMAGE_CACHE_PATH From cddd2c06e3e3e1cd7c8cc3df2327db224d861859 Mon Sep 17 00:00:00 2001 From: serhii Date: Sat, 30 Jul 2022 19:21:50 +0100 Subject: [PATCH 023/145] Templated release name --- .github/workflows/build.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8590e199..f8802035 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -32,7 +32,7 @@ jobs: key: BASE_SEED=$(CACHE_KEY_BASE) | $DOCKER_IMAGES_SLUG | $(CACHE_KEY_IMAGES) restore-keys: BASE_SEED=$(CACHE_KEY_BASE) | $DOCKER_IMAGES_SLUG - - name: Load $DOCKER_IMAGES_SLUG images + - name: Load images if: steps.cache-sentinel.outputs.cache-hit != 'true' run: | [ -d $IMAGE_CACHE_PATH ] || exit 0 @@ -50,8 +50,8 @@ jobs: steps: - uses: actions/checkout@v3 - - name: Resolve Sentinel cache - id: cache-koa + - name: Docker images sentinel cache + id: cache-sentinel uses: actions/cache@v3 with: path: $(SENTINEL_CACHE_PATH) @@ -65,8 +65,8 @@ jobs: steps: - uses: actions/checkout@v3 - - name: Resolve Sentinel cache - id: cache-lilac + - name: Docker images sentinel cache + id: cache-sentinel uses: actions/cache@v3 with: path: $(SENTINEL_CACHE_PATH) From d0cf14f2c2980d016ad6b665e30a741cc317f194 Mon Sep 17 00:00:00 2001 From: serhii Date: Mon, 1 Aug 2022 18:06:44 +0100 Subject: [PATCH 024/145] Added few next steps --- .github/workflows/build.yml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f8802035..7db09f8b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -42,6 +42,27 @@ jobs: cat $IMAGE_CACHE_PATH/edx-$DOCKER_IMAGES_SLUG.tar.xz | unxz | docker load docker images + - name: Set needs_build pipeline variable + if: steps.cache-sentinel.outputs.cache-hit != 'true' + run: echo "NEEDS_BUILD=true" >> $GITHUB_ENV + + - name: Remove Haskell compiler and cached apt archives to save disk space + if: NEEDS_BUILD != 'true' && success() + run: df -h; time sudo rm -rf /var/cache/apt/archives /opt/ghc; df -h + + - name: Prepare Transifex credentials + run: | + if [ "$TRANSIFEX_USERNAME" == '$(TRANSIFEX_USERNAME)' ] || [ "$TRANSIFEX_PASSWORD" == '$(TRANSIFEX_PASSWORD)' ]; then + echo "Transifex credentials unset. Building without translations." + exit 0 + fi + printf '[https://www.transifex.com]\nhostname=https://www.transifex.com\nusername=%s\npassword=%s\n' "${TRANSIFEX_USERNAME}" "${TRANSIFEX_PASSWORD}" > $HOME/.transifexrc + ls -l $HOME/.transifexrc + env: + TRANSIFEX_USERNAME: $(TRANSIFEX_USERNAME) + TRANSIFEX_PASSWORD: $(TRANSIFEX_PASSWORD) + + - name: koa: runs-on: ubuntu-latest timeout-minutes: 180 From 958dcdf46b3e8b0f45eb5cc2a753bc22e8f704d3 Mon Sep 17 00:00:00 2001 From: serhii Date: Mon, 1 Aug 2022 18:07:08 +0100 Subject: [PATCH 025/145] Added few next steps --- .github/workflows/build.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7db09f8b..86332a5b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -62,7 +62,6 @@ jobs: TRANSIFEX_USERNAME: $(TRANSIFEX_USERNAME) TRANSIFEX_PASSWORD: $(TRANSIFEX_PASSWORD) - - name: koa: runs-on: ubuntu-latest timeout-minutes: 180 From 71cbefd55cfaa770f6699e2659a181126ec4e1db Mon Sep 17 00:00:00 2001 From: serhii Date: Mon, 1 Aug 2022 18:10:13 +0100 Subject: [PATCH 026/145] Added few next steps --- .github/workflows/build.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 86332a5b..35eb0d04 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -7,7 +7,7 @@ env: CACHE_KEY_IMAGES: BASE_SEED=$CACHE_KEY_BASE | $CACHE_KEY_FILES IMAGE_CACHE_PATH: $GITHUB_WORKSPACE/image_cache SENTINEL_CACHE_PATH: $GITHUB_WORKSPACE/sentinel_cache - + NEEDS_BUILD: false jobs: juniper: runs-on: ubuntu-latest @@ -47,10 +47,11 @@ jobs: run: echo "NEEDS_BUILD=true" >> $GITHUB_ENV - name: Remove Haskell compiler and cached apt archives to save disk space - if: NEEDS_BUILD != 'true' && success() + if: NEEDS_BUILD != 'false' && success() run: df -h; time sudo rm -rf /var/cache/apt/archives /opt/ghc; df -h - name: Prepare Transifex credentials + if: NEEDS_BUILD != 'false' run: | if [ "$TRANSIFEX_USERNAME" == '$(TRANSIFEX_USERNAME)' ] || [ "$TRANSIFEX_PASSWORD" == '$(TRANSIFEX_PASSWORD)' ]; then echo "Transifex credentials unset. Building without translations." From 54bcf61b18145b004f54accbbbc150f9b2d7d26b Mon Sep 17 00:00:00 2001 From: serhii Date: Mon, 1 Aug 2022 18:10:45 +0100 Subject: [PATCH 027/145] Added few next steps --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 35eb0d04..dded8040 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -47,11 +47,11 @@ jobs: run: echo "NEEDS_BUILD=true" >> $GITHUB_ENV - name: Remove Haskell compiler and cached apt archives to save disk space - if: NEEDS_BUILD != 'false' && success() + if: $NEEDS_BUILD != 'false' && success() run: df -h; time sudo rm -rf /var/cache/apt/archives /opt/ghc; df -h - name: Prepare Transifex credentials - if: NEEDS_BUILD != 'false' + if: $NEEDS_BUILD != 'false' run: | if [ "$TRANSIFEX_USERNAME" == '$(TRANSIFEX_USERNAME)' ] || [ "$TRANSIFEX_PASSWORD" == '$(TRANSIFEX_PASSWORD)' ]; then echo "Transifex credentials unset. Building without translations." From 290ea89eb9518302311d33465b0303b44264e28a Mon Sep 17 00:00:00 2001 From: serhii Date: Mon, 1 Aug 2022 18:12:58 +0100 Subject: [PATCH 028/145] Added few next steps --- .github/workflows/build.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index dded8040..33fee173 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -8,6 +8,7 @@ env: IMAGE_CACHE_PATH: $GITHUB_WORKSPACE/image_cache SENTINEL_CACHE_PATH: $GITHUB_WORKSPACE/sentinel_cache NEEDS_BUILD: false + jobs: juniper: runs-on: ubuntu-latest @@ -47,11 +48,11 @@ jobs: run: echo "NEEDS_BUILD=true" >> $GITHUB_ENV - name: Remove Haskell compiler and cached apt archives to save disk space - if: $NEEDS_BUILD != 'false' && success() + if: $env.NEEDS_BUILD != 'false' && success() run: df -h; time sudo rm -rf /var/cache/apt/archives /opt/ghc; df -h - name: Prepare Transifex credentials - if: $NEEDS_BUILD != 'false' + if: $env.NEEDS_BUILD != 'false' run: | if [ "$TRANSIFEX_USERNAME" == '$(TRANSIFEX_USERNAME)' ] || [ "$TRANSIFEX_PASSWORD" == '$(TRANSIFEX_PASSWORD)' ]; then echo "Transifex credentials unset. Building without translations." From b0901902598faadc989c5d8dc0ee9bca2c965dd2 Mon Sep 17 00:00:00 2001 From: serhii Date: Mon, 1 Aug 2022 18:13:28 +0100 Subject: [PATCH 029/145] Added few next steps --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 33fee173..7af5b886 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -48,11 +48,11 @@ jobs: run: echo "NEEDS_BUILD=true" >> $GITHUB_ENV - name: Remove Haskell compiler and cached apt archives to save disk space - if: $env.NEEDS_BUILD != 'false' && success() + if: env.NEEDS_BUILD != 'false' && success() run: df -h; time sudo rm -rf /var/cache/apt/archives /opt/ghc; df -h - name: Prepare Transifex credentials - if: $env.NEEDS_BUILD != 'false' + if: env.NEEDS_BUILD != 'false' run: | if [ "$TRANSIFEX_USERNAME" == '$(TRANSIFEX_USERNAME)' ] || [ "$TRANSIFEX_PASSWORD" == '$(TRANSIFEX_PASSWORD)' ]; then echo "Transifex credentials unset. Building without translations." From 209a192eaca03f9d69830f77a29727273d260da2 Mon Sep 17 00:00:00 2001 From: serhii Date: Mon, 1 Aug 2022 18:17:42 +0100 Subject: [PATCH 030/145] Added few next steps --- .github/workflows/build.yml | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7af5b886..06c86f33 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -7,7 +7,6 @@ env: CACHE_KEY_IMAGES: BASE_SEED=$CACHE_KEY_BASE | $CACHE_KEY_FILES IMAGE_CACHE_PATH: $GITHUB_WORKSPACE/image_cache SENTINEL_CACHE_PATH: $GITHUB_WORKSPACE/sentinel_cache - NEEDS_BUILD: false jobs: juniper: @@ -59,11 +58,31 @@ jobs: exit 0 fi printf '[https://www.transifex.com]\nhostname=https://www.transifex.com\nusername=%s\npassword=%s\n' "${TRANSIFEX_USERNAME}" "${TRANSIFEX_PASSWORD}" > $HOME/.transifexrc - ls -l $HOME/.transifexrc + ls -l $GITHUB_WORKSPACE/.transifexrc env: TRANSIFEX_USERNAME: $(TRANSIFEX_USERNAME) TRANSIFEX_PASSWORD: $(TRANSIFEX_PASSWORD) + - name: Setup docker images cache + if: env.NEEDS_BUILD != 'false' && success() + run: | + images=$(docker images|grep -v ''|grep derex|awk '{print $1 ":" $2}') + CACHE_FROM_OPTS="" + if [ -d $IMAGE_CACHE_PATH ]; then + echo "Will use cached layers from images $images" + for image in $images; do + CACHE_FROM_OPTS="${CACHE_FROM_OPTS} --cache-from=$image" + done + else + mkdir $IMAGE_CACHE_PATH + fi + echo "CACHE_FROM_OPTS=$CACHE_FROM_OPTS" >> $GITHUB_ENV + mkdir $SENTINEL_CACHE_PATH + cp -r $CACHE_KEY_FILES $SENTINEL_CACHE_PATH + # We save the sha of the repo that built this image, so that we can push + # it only in a build of the same commit, after tests are passed + git rev-parse --verify HEAD > $SENTINEL_CACHE_PATH/built_version + koa: runs-on: ubuntu-latest timeout-minutes: 180 From 6cffa2189d6fb73015daa0b52977921dc8cf886b Mon Sep 17 00:00:00 2001 From: serhii Date: Mon, 1 Aug 2022 18:20:18 +0100 Subject: [PATCH 031/145] Added few next steps --- .github/workflows/build.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 06c86f33..cefd67d7 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -3,10 +3,10 @@ on: [push] env: CACHE_KEY_BASE: 22 # Increment this value to reset the images cache - CACHE_KEY_FILES: $GITHUB_WORKSPACE/docker-definition/**/* + CACHE_KEY_FILES: ${{ github.workspace }}/docker-definition/**/* CACHE_KEY_IMAGES: BASE_SEED=$CACHE_KEY_BASE | $CACHE_KEY_FILES - IMAGE_CACHE_PATH: $GITHUB_WORKSPACE/image_cache - SENTINEL_CACHE_PATH: $GITHUB_WORKSPACE/sentinel_cache + IMAGE_CACHE_PATH: ${{ github.workspace }}/image_cache + SENTINEL_CACHE_PATH: ${{ github.workspace }}/sentinel_cache jobs: juniper: From 4584a244597b41b3e84fd23a20aa41c39748024b Mon Sep 17 00:00:00 2001 From: serhii Date: Mon, 1 Aug 2022 18:28:42 +0100 Subject: [PATCH 032/145] Debug git rev-parse --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index cefd67d7..0dd78c46 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -81,7 +81,7 @@ jobs: cp -r $CACHE_KEY_FILES $SENTINEL_CACHE_PATH # We save the sha of the repo that built this image, so that we can push # it only in a build of the same commit, after tests are passed - git rev-parse --verify HEAD > $SENTINEL_CACHE_PATH/built_version + git rev-parse --verify HEAD koa: runs-on: ubuntu-latest From 42445a2a41e7e148e90fe6f94d2a93631e97eb62 Mon Sep 17 00:00:00 2001 From: serhii Date: Mon, 1 Aug 2022 18:31:10 +0100 Subject: [PATCH 033/145] Debug git rev-parse --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0dd78c46..483a0c53 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -81,7 +81,7 @@ jobs: cp -r $CACHE_KEY_FILES $SENTINEL_CACHE_PATH # We save the sha of the repo that built this image, so that we can push # it only in a build of the same commit, after tests are passed - git rev-parse --verify HEAD + git rev-parse --verify HEAD:${{ github.workspace }} koa: runs-on: ubuntu-latest From 0776e57c9e89b7a03efbcc538440419a7c5ae7c1 Mon Sep 17 00:00:00 2001 From: serhii Date: Mon, 1 Aug 2022 18:32:45 +0100 Subject: [PATCH 034/145] Debug git rev-parse --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 483a0c53..13507c30 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -81,7 +81,7 @@ jobs: cp -r $CACHE_KEY_FILES $SENTINEL_CACHE_PATH # We save the sha of the repo that built this image, so that we can push # it only in a build of the same commit, after tests are passed - git rev-parse --verify HEAD:${{ github.workspace }} + git rev-parse koa: runs-on: ubuntu-latest From bf4e2078e154c6640f45778f58bad3aa3ba98c7d Mon Sep 17 00:00:00 2001 From: serhii Date: Mon, 1 Aug 2022 18:35:15 +0100 Subject: [PATCH 035/145] Debug git rev-parse --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 13507c30..de74e40e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -81,7 +81,7 @@ jobs: cp -r $CACHE_KEY_FILES $SENTINEL_CACHE_PATH # We save the sha of the repo that built this image, so that we can push # it only in a build of the same commit, after tests are passed - git rev-parse + git rev-parse --verify HEAD:$SENTINEL_CACHE_PATH koa: runs-on: ubuntu-latest From acc1c98f2f503ffd1cc5b942615b5f830373f364 Mon Sep 17 00:00:00 2001 From: serhii Date: Mon, 1 Aug 2022 18:36:36 +0100 Subject: [PATCH 036/145] Debug git rev-parse --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index de74e40e..cb91a6ac 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -81,7 +81,7 @@ jobs: cp -r $CACHE_KEY_FILES $SENTINEL_CACHE_PATH # We save the sha of the repo that built this image, so that we can push # it only in a build of the same commit, after tests are passed - git rev-parse --verify HEAD:$SENTINEL_CACHE_PATH + git rev-parse --verify HEAD:$CACHE_KEY_FILES koa: runs-on: ubuntu-latest From e623bfb798e918fb033035f061b349867e02ae58 Mon Sep 17 00:00:00 2001 From: serhii Date: Mon, 1 Aug 2022 18:38:25 +0100 Subject: [PATCH 037/145] Debug git rev-parse --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index cb91a6ac..7bb11c6b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -78,10 +78,10 @@ jobs: fi echo "CACHE_FROM_OPTS=$CACHE_FROM_OPTS" >> $GITHUB_ENV mkdir $SENTINEL_CACHE_PATH - cp -r $CACHE_KEY_FILES $SENTINEL_CACHE_PATH + cp -fr $CACHE_KEY_FILES $SENTINEL_CACHE_PATH # We save the sha of the repo that built this image, so that we can push # it only in a build of the same commit, after tests are passed - git rev-parse --verify HEAD:$CACHE_KEY_FILES + git rev-parse --verify HEAD > $SENTINEL_CACHE_PATH/built_version koa: runs-on: ubuntu-latest From e85e158e63f8242415568112e9b4d6b2af98424a Mon Sep 17 00:00:00 2001 From: serhii Date: Mon, 1 Aug 2022 18:41:53 +0100 Subject: [PATCH 038/145] Debug git rev-parse --- .github/workflows/build.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7bb11c6b..c43767b1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -78,7 +78,8 @@ jobs: fi echo "CACHE_FROM_OPTS=$CACHE_FROM_OPTS" >> $GITHUB_ENV mkdir $SENTINEL_CACHE_PATH - cp -fr $CACHE_KEY_FILES $SENTINEL_CACHE_PATH + rm -r $SENTINEL_CACHE_PATH + cp -r $CACHE_KEY_FILES $SENTINEL_CACHE_PATH # We save the sha of the repo that built this image, so that we can push # it only in a build of the same commit, after tests are passed git rev-parse --verify HEAD > $SENTINEL_CACHE_PATH/built_version From a4ae2a7f2860a05be5aeefc7fc1662085d0cdcfb Mon Sep 17 00:00:00 2001 From: serhii Date: Mon, 1 Aug 2022 18:45:14 +0100 Subject: [PATCH 039/145] Debug git rev-parse --- .github/workflows/build.yml | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c43767b1..0f927ff2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -69,16 +69,15 @@ jobs: images=$(docker images|grep -v ''|grep derex|awk '{print $1 ":" $2}') CACHE_FROM_OPTS="" if [ -d $IMAGE_CACHE_PATH ]; then - echo "Will use cached layers from images $images" - for image in $images; do - CACHE_FROM_OPTS="${CACHE_FROM_OPTS} --cache-from=$image" - done + echo "Will use cached layers from images $images" + for image in $images; do + CACHE_FROM_OPTS="${CACHE_FROM_OPTS} --cache-from=$image" + done else - mkdir $IMAGE_CACHE_PATH + mkdir $IMAGE_CACHE_PATH fi echo "CACHE_FROM_OPTS=$CACHE_FROM_OPTS" >> $GITHUB_ENV - mkdir $SENTINEL_CACHE_PATH - rm -r $SENTINEL_CACHE_PATH + [ -d $SENTINEL_CACHE_PATH ]; rm -r $SENTINEL_CACHE_PATH || mkdir $SENTINEL_CACHE_PATH cp -r $CACHE_KEY_FILES $SENTINEL_CACHE_PATH # We save the sha of the repo that built this image, so that we can push # it only in a build of the same commit, after tests are passed From 44b7acacb896bb5019caea0dea1f7a55631b48f9 Mon Sep 17 00:00:00 2001 From: serhii Date: Mon, 1 Aug 2022 18:46:46 +0100 Subject: [PATCH 040/145] Debug git rev-parse --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0f927ff2..eafe083f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -77,7 +77,7 @@ jobs: mkdir $IMAGE_CACHE_PATH fi echo "CACHE_FROM_OPTS=$CACHE_FROM_OPTS" >> $GITHUB_ENV - [ -d $SENTINEL_CACHE_PATH ]; rm -r $SENTINEL_CACHE_PATH || mkdir $SENTINEL_CACHE_PATH + if [ -d $SENTINEL_CACHE_PATH ]; then rm -r $SENTINEL_CACHE_PATH; else mkdir $SENTINEL_CACHE_PATH; fi cp -r $CACHE_KEY_FILES $SENTINEL_CACHE_PATH # We save the sha of the repo that built this image, so that we can push # it only in a build of the same commit, after tests are passed From 8a305b9c03493af7cbaa47423892fa8b69ac0505 Mon Sep 17 00:00:00 2001 From: serhii Date: Mon, 1 Aug 2022 18:49:17 +0100 Subject: [PATCH 041/145] Debug git rev-parse --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index eafe083f..6f05ce2f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -3,7 +3,7 @@ on: [push] env: CACHE_KEY_BASE: 22 # Increment this value to reset the images cache - CACHE_KEY_FILES: ${{ github.workspace }}/docker-definition/**/* + CACHE_KEY_FILES: ${{ github.workspace }}/docker-definition/ CACHE_KEY_IMAGES: BASE_SEED=$CACHE_KEY_BASE | $CACHE_KEY_FILES IMAGE_CACHE_PATH: ${{ github.workspace }}/image_cache SENTINEL_CACHE_PATH: ${{ github.workspace }}/sentinel_cache @@ -77,7 +77,7 @@ jobs: mkdir $IMAGE_CACHE_PATH fi echo "CACHE_FROM_OPTS=$CACHE_FROM_OPTS" >> $GITHUB_ENV - if [ -d $SENTINEL_CACHE_PATH ]; then rm -r $SENTINEL_CACHE_PATH; else mkdir $SENTINEL_CACHE_PATH; fi + mkdir $SENTINEL_CACHE_PATH cp -r $CACHE_KEY_FILES $SENTINEL_CACHE_PATH # We save the sha of the repo that built this image, so that we can push # it only in a build of the same commit, after tests are passed From 771584e2d5742e60e473ada4f50c1a360fd0fc5b Mon Sep 17 00:00:00 2001 From: serhii Date: Mon, 1 Aug 2022 18:51:17 +0100 Subject: [PATCH 042/145] Debug git rev-parse --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6f05ce2f..d32680be 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -3,7 +3,7 @@ on: [push] env: CACHE_KEY_BASE: 22 # Increment this value to reset the images cache - CACHE_KEY_FILES: ${{ github.workspace }}/docker-definition/ + CACHE_KEY_FILES: ${{ github.workspace }}/docker-definition/**/* CACHE_KEY_IMAGES: BASE_SEED=$CACHE_KEY_BASE | $CACHE_KEY_FILES IMAGE_CACHE_PATH: ${{ github.workspace }}/image_cache SENTINEL_CACHE_PATH: ${{ github.workspace }}/sentinel_cache @@ -78,7 +78,7 @@ jobs: fi echo "CACHE_FROM_OPTS=$CACHE_FROM_OPTS" >> $GITHUB_ENV mkdir $SENTINEL_CACHE_PATH - cp -r $CACHE_KEY_FILES $SENTINEL_CACHE_PATH + cp -r $CACHE_KEY_FILES $SENTINEL_CACHE_PATH || cp -r $CACHE_KEY_FILES $SENTINEL_CACHE_PATH # We save the sha of the repo that built this image, so that we can push # it only in a build of the same commit, after tests are passed git rev-parse --verify HEAD > $SENTINEL_CACHE_PATH/built_version From c9993f1129822a878dd1adb6134054aa2f5bdea9 Mon Sep 17 00:00:00 2001 From: serhii Date: Mon, 1 Aug 2022 18:52:02 +0100 Subject: [PATCH 043/145] Debug git rev-parse --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d32680be..f491bfe7 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -3,7 +3,7 @@ on: [push] env: CACHE_KEY_BASE: 22 # Increment this value to reset the images cache - CACHE_KEY_FILES: ${{ github.workspace }}/docker-definition/**/* + CACHE_KEY_FILES: ${{ github.workspace }}/docker-definition CACHE_KEY_IMAGES: BASE_SEED=$CACHE_KEY_BASE | $CACHE_KEY_FILES IMAGE_CACHE_PATH: ${{ github.workspace }}/image_cache SENTINEL_CACHE_PATH: ${{ github.workspace }}/sentinel_cache @@ -78,7 +78,7 @@ jobs: fi echo "CACHE_FROM_OPTS=$CACHE_FROM_OPTS" >> $GITHUB_ENV mkdir $SENTINEL_CACHE_PATH - cp -r $CACHE_KEY_FILES $SENTINEL_CACHE_PATH || cp -r $CACHE_KEY_FILES $SENTINEL_CACHE_PATH + cp -r $CACHE_KEY_FILES $SENTINEL_CACHE_PATH # We save the sha of the repo that built this image, so that we can push # it only in a build of the same commit, after tests are passed git rev-parse --verify HEAD > $SENTINEL_CACHE_PATH/built_version From bfaff02cef8eec85d08ddf597ea9babdba22507c Mon Sep 17 00:00:00 2001 From: serhii Date: Mon, 1 Aug 2022 19:27:27 +0100 Subject: [PATCH 044/145] Add next job --- .github/workflows/build.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f491bfe7..473762c8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -83,6 +83,18 @@ jobs: # it only in a build of the same commit, after tests are passed git rev-parse --verify HEAD > $SENTINEL_CACHE_PATH/built_version + - name: Replace Microsoft docker with upsream docker and create build context + if: env.NEEDS_BUILD != 'false' && success() + run: | + set -ex + sudo apt-get remove moby-cli -y + curl -fsSL https://get.docker.com |sudo bash + sudo mv /etc/docker/daemon.json /etc/docker/daemon.json.orig + sudo cat /etc/docker/daemon.json.orig|jq '. + {experimental: true}' |sudo tee /etc/docker/daemon.json + sudo systemctl restart docker.service + docker version + docker buildx create --use + docker images koa: runs-on: ubuntu-latest timeout-minutes: 180 From 54e56b1d7ccd8a9e361fa1ff77745467e7fb1fe6 Mon Sep 17 00:00:00 2001 From: serhii Date: Mon, 1 Aug 2022 19:42:41 +0100 Subject: [PATCH 045/145] Added more jobs --- .github/workflows/build.yml | 52 ++++++++++++++++++++++++++++++++++++- 1 file changed, 51 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 473762c8..43404abf 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -7,6 +7,7 @@ env: CACHE_KEY_IMAGES: BASE_SEED=$CACHE_KEY_BASE | $CACHE_KEY_FILES IMAGE_CACHE_PATH: ${{ github.workspace }}/image_cache SENTINEL_CACHE_PATH: ${{ github.workspace }}/sentinel_cache + AS_PYTHON_PACKAGE: false jobs: juniper: @@ -83,7 +84,7 @@ jobs: # it only in a build of the same commit, after tests are passed git rev-parse --verify HEAD > $SENTINEL_CACHE_PATH/built_version - - name: Replace Microsoft docker with upsream docker and create build context + - name: Replace default docker with upsream docker and create build context if: env.NEEDS_BUILD != 'false' && success() run: | set -ex @@ -95,6 +96,55 @@ jobs: docker version docker buildx create --use docker images + sudo apt-get install pixz -y + + - uses: actions/setup-python@v4 + with: + python-version: '3.x' + + - name: Cache pip packages + uses: actions/cache@v3 + with: + path: ${{ github.workspace }}/.cache/pip + key: pipcache | requirements_dev.txt + restore-keys: pipcache + + - name: Install derex.runner + if: env.AS_PYTHON_PACKAGE == 'false' && env.NEEDS_BUILD != 'false' + run: | + pip3 install --cache-dir ${{ github.workspace }}/.cache/pip -U pip setuptools + pip3 install --cache-dir ${{ github.workspace }}/.cache/pip -r requirements_dev.txt -e . + + - name: Install derex.runner as python package + if: env.AS_PYTHON_PACKAGE != 'false' && env.NEEDS_BUILD != 'false' + run: | + pip3 install --cache-dir ${{ github.workspace }}/.cache/pip -U pip setuptools + pip3 install --cache-dir ${{ github.workspace }}/.cache/pip . + + - name: Build nostatic image + if: env.NEEDS_BUILD != 'false' && success() + run: derex build openedx --docker-opts "${CACHE_FROM_OPTS} --cache-to=type=inline -o type=docker" --target=nostatic $DOCKER_IMAGES_SLUG + + - name: Build dev image + if: env.NEEDS_BUILD != 'false' && success() + run: derex build openedx --docker-opts "--cache-to=type=inline -o type=docker" --target=dev $DOCKER_IMAGES_SLUG + + - name: Check translations + if: env.NEEDS_BUILD != 'false' && success() + run: | + docker images + derex build openedx --docker-opts "${CACHE_FROM_OPTS} --output type=docker,name={docker_image_prefix}-{target}" --target=translations $DOCKER_IMAGES_SLUG + docker images + docker run --rm derex/openedx-$DOCKER_IMAGES_SLUG-translations:$(grep __version__ derex/runner/__init__.py |sed 's/[^"]*"//;s/"//') sh -c "i18n_tool validate || (find conf|grep prob; find conf|grep prob|xargs cat; false)" || echo "Problems with translations found" + + - name: Save images + if: env.NEEDS_BUILD != 'false' && success() + run: | + set -euxo pipefail; + docker save \ + $(derex build openedx --only-print-image-name -t nostatic $DOCKER_IMAGES_SLUG) \ + $(derex build openedx --only-print-image-name -t dev $DOCKER_IMAGES_SLUG) \ + | pixz -0 > $IMAGE_CACHE_PATH/edx-$DOCKER_IMAGES_SLUG.tar.xz koa: runs-on: ubuntu-latest timeout-minutes: 180 From 56384c33e23c37f20a4f99b911c975f7a5fe1785 Mon Sep 17 00:00:00 2001 From: serhii Date: Mon, 1 Aug 2022 20:50:15 +0100 Subject: [PATCH 046/145] Build workflow refactoring --- .github/workflows/build.yml | 133 ++++++++++------------- .github/workflows/juniper.yml | 15 +++ .github/workflows/koa.yml | 17 +++ .github/workflows/lilac.yml | 17 +++ azure-pipelines.yml | 2 +- azure-pipelines/build.yml | 37 ------- azure-pipelines/build_single_version.yml | 102 ----------------- azure-pipelines/load_images.yml | 26 ----- azure-pipelines/prepare.yml | 35 ------ 9 files changed, 107 insertions(+), 277 deletions(-) create mode 100644 .github/workflows/juniper.yml create mode 100644 .github/workflows/koa.yml create mode 100644 .github/workflows/lilac.yml delete mode 100644 azure-pipelines/build.yml delete mode 100644 azure-pipelines/build_single_version.yml delete mode 100644 azure-pipelines/load_images.yml delete mode 100644 azure-pipelines/prepare.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 43404abf..3d5f11ee 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,20 +1,33 @@ name: Build -on: [push] - -env: - CACHE_KEY_BASE: 22 # Increment this value to reset the images cache - CACHE_KEY_FILES: ${{ github.workspace }}/docker-definition - CACHE_KEY_IMAGES: BASE_SEED=$CACHE_KEY_BASE | $CACHE_KEY_FILES - IMAGE_CACHE_PATH: ${{ github.workspace }}/image_cache - SENTINEL_CACHE_PATH: ${{ github.workspace }}/sentinel_cache - AS_PYTHON_PACKAGE: false +on: + workflow_call: + inputs: + DOCKER_IMAGES_SLUG: + required: true + type: string + CACHE_KEY_BASE: + required: true + type: string + CACHE_KEY_FILES: + required: true + type: string + CACHE_KEY_IMAGES: + required: true + type: string + IMAGE_CACHE_PATH: + required: true + type: string + SENTINEL_CACHE_PATH: + required: true + type: string + AS_PYTHON_PACKAGE: + required: true + type: boolean jobs: - juniper: + Build_Juniper: runs-on: ubuntu-latest timeout-minutes: 180 - env: - DOCKER_IMAGES_SLUG: juniper steps: - uses: actions/checkout@v3 @@ -22,25 +35,25 @@ jobs: id: cache-sentinel uses: actions/cache@v3 with: - path: $(SENTINEL_CACHE_PATH) - key: SENTINEL=1 | $(DOCKER_IMAGES_SLUG) | $(CACHE_KEY_IMAGES) + path: ${{ inputs.SENTINEL_CACHE_PATH }} + key: SENTINEL=1 | ${{ inputs.DOCKER_IMAGES_SLUG }} | ${{ inputs.CACHE_KEY_IMAGES }} - name: Docker images cache if: steps.cache-sentinel.outputs.cache-hit != 'true' uses: actions/cache@v3 with: - path: $IMAGE_CACHE_PATH - key: BASE_SEED=$(CACHE_KEY_BASE) | $DOCKER_IMAGES_SLUG | $(CACHE_KEY_IMAGES) - restore-keys: BASE_SEED=$(CACHE_KEY_BASE) | $DOCKER_IMAGES_SLUG + path: ${{ inputs.IMAGE_CACHE_PATH }} + key: BASE_SEED=${{ inputs.CACHE_KEY_BASE }} | ${{ inputs.DOCKER_IMAGES_SLUG }} | ${{ inputs.CACHE_KEY_IMAGES }} + restore-keys: BASE_SEED=${{ inputs.CACHE_KEY_BASE }} | ${{ inputs.DOCKER_IMAGES_SLUG }} - name: Load images if: steps.cache-sentinel.outputs.cache-hit != 'true' run: | - [ -d $IMAGE_CACHE_PATH ] || exit 0 - ls -l $IMAGE_CACHE_PATH + [ -d ${{ inputs.IMAGE_CACHE_PATH }} ] || exit 0 + ls -l ${{ inputs.IMAGE_CACHE_PATH }} docker images set -euxo pipefail - cat $IMAGE_CACHE_PATH/edx-$DOCKER_IMAGES_SLUG.tar.xz | unxz | docker load + cat ${{ inputs.IMAGE_CACHE_PATH }}/edx-${{ inputs.DOCKER_IMAGES_SLUG }}.tar.xz | unxz | docker load docker images - name: Set needs_build pipeline variable @@ -48,44 +61,41 @@ jobs: run: echo "NEEDS_BUILD=true" >> $GITHUB_ENV - name: Remove Haskell compiler and cached apt archives to save disk space - if: env.NEEDS_BUILD != 'false' && success() + if: inputs.NEEDS_BUILD != 'false' run: df -h; time sudo rm -rf /var/cache/apt/archives /opt/ghc; df -h - name: Prepare Transifex credentials - if: env.NEEDS_BUILD != 'false' + if: inputs.NEEDS_BUILD != 'false' run: | if [ "$TRANSIFEX_USERNAME" == '$(TRANSIFEX_USERNAME)' ] || [ "$TRANSIFEX_PASSWORD" == '$(TRANSIFEX_PASSWORD)' ]; then echo "Transifex credentials unset. Building without translations." exit 0 fi printf '[https://www.transifex.com]\nhostname=https://www.transifex.com\nusername=%s\npassword=%s\n' "${TRANSIFEX_USERNAME}" "${TRANSIFEX_PASSWORD}" > $HOME/.transifexrc - ls -l $GITHUB_WORKSPACE/.transifexrc - env: - TRANSIFEX_USERNAME: $(TRANSIFEX_USERNAME) - TRANSIFEX_PASSWORD: $(TRANSIFEX_PASSWORD) + ls -l ${{ github.workspace }}/.transifexrc - name: Setup docker images cache - if: env.NEEDS_BUILD != 'false' && success() + if: inputs.NEEDS_BUILD != 'false' run: | images=$(docker images|grep -v ''|grep derex|awk '{print $1 ":" $2}') CACHE_FROM_OPTS="" - if [ -d $IMAGE_CACHE_PATH ]; then + if [ -d ${{ inputs.IMAGE_CACHE_PATH }} ]; then echo "Will use cached layers from images $images" for image in $images; do CACHE_FROM_OPTS="${CACHE_FROM_OPTS} --cache-from=$image" done else - mkdir $IMAGE_CACHE_PATH + mkdir ${{ inputs.IMAGE_CACHE_PATH }} fi echo "CACHE_FROM_OPTS=$CACHE_FROM_OPTS" >> $GITHUB_ENV - mkdir $SENTINEL_CACHE_PATH - cp -r $CACHE_KEY_FILES $SENTINEL_CACHE_PATH + mkdir ${{ inputs.SENTINEL_CACHE_PATH }} + cp -r ${{ inputs.CACHE_KEY_FILES }} ${{ inputs.SENTINEL_CACHE_PATH }} # We save the sha of the repo that built this image, so that we can push # it only in a build of the same commit, after tests are passed - git rev-parse --verify HEAD > $SENTINEL_CACHE_PATH/built_version + git rev-parse --verify HEAD > ${{ inputs.SENTINEL_CACHE_PATH }}/built_version - name: Replace default docker with upsream docker and create build context - if: env.NEEDS_BUILD != 'false' && success() + if: inputs.NEEDS_BUILD != 'false' run: | set -ex sudo apt-get remove moby-cli -y @@ -100,7 +110,7 @@ jobs: - uses: actions/setup-python@v4 with: - python-version: '3.x' + python-version: '3.8' - name: Cache pip packages uses: actions/cache@v3 @@ -110,67 +120,38 @@ jobs: restore-keys: pipcache - name: Install derex.runner - if: env.AS_PYTHON_PACKAGE == 'false' && env.NEEDS_BUILD != 'false' + if: inputs.AS_PYTHON_PACKAGE == 'false' && inputs.NEEDS_BUILD != 'false' run: | pip3 install --cache-dir ${{ github.workspace }}/.cache/pip -U pip setuptools pip3 install --cache-dir ${{ github.workspace }}/.cache/pip -r requirements_dev.txt -e . - name: Install derex.runner as python package - if: env.AS_PYTHON_PACKAGE != 'false' && env.NEEDS_BUILD != 'false' + if: inputs.AS_PYTHON_PACKAGE != 'false' && inputs.NEEDS_BUILD != 'false' run: | pip3 install --cache-dir ${{ github.workspace }}/.cache/pip -U pip setuptools pip3 install --cache-dir ${{ github.workspace }}/.cache/pip . - name: Build nostatic image - if: env.NEEDS_BUILD != 'false' && success() - run: derex build openedx --docker-opts "${CACHE_FROM_OPTS} --cache-to=type=inline -o type=docker" --target=nostatic $DOCKER_IMAGES_SLUG + if: inputs.NEEDS_BUILD != 'false' + run: derex build openedx --docker-opts "${CACHE_FROM_OPTS} --cache-to=type=inline -o type=docker" --target=nostatic ${{ inputs.DOCKER_IMAGES_SLUG }} - name: Build dev image - if: env.NEEDS_BUILD != 'false' && success() - run: derex build openedx --docker-opts "--cache-to=type=inline -o type=docker" --target=dev $DOCKER_IMAGES_SLUG + if: inputs.NEEDS_BUILD != 'false' + run: derex build openedx --docker-opts "--cache-to=type=inline -o type=docker" --target=dev ${{ inputs.DOCKER_IMAGES_SLUG }} - name: Check translations - if: env.NEEDS_BUILD != 'false' && success() + if: inputs.NEEDS_BUILD != 'false' run: | docker images - derex build openedx --docker-opts "${CACHE_FROM_OPTS} --output type=docker,name={docker_image_prefix}-{target}" --target=translations $DOCKER_IMAGES_SLUG + derex build openedx --docker-opts "${CACHE_FROM_OPTS} --output type=docker,name={docker_image_prefix}-{target}" --target=translations ${{ inputs.DOCKER_IMAGES_SLUG }} docker images - docker run --rm derex/openedx-$DOCKER_IMAGES_SLUG-translations:$(grep __version__ derex/runner/__init__.py |sed 's/[^"]*"//;s/"//') sh -c "i18n_tool validate || (find conf|grep prob; find conf|grep prob|xargs cat; false)" || echo "Problems with translations found" + docker run --rm derex/openedx-${{ inputs.DOCKER_IMAGES_SLUG }}-translations:$(grep __version__ derex/runner/__init__.py |sed 's/[^"]*"//;s/"//') sh -c "i18n_tool validate || (find conf|grep prob; find conf|grep prob|xargs cat; false)" || echo "Problems with translations found" - name: Save images - if: env.NEEDS_BUILD != 'false' && success() + if: inputs.NEEDS_BUILD != 'false' run: | set -euxo pipefail; docker save \ - $(derex build openedx --only-print-image-name -t nostatic $DOCKER_IMAGES_SLUG) \ - $(derex build openedx --only-print-image-name -t dev $DOCKER_IMAGES_SLUG) \ - | pixz -0 > $IMAGE_CACHE_PATH/edx-$DOCKER_IMAGES_SLUG.tar.xz - koa: - runs-on: ubuntu-latest - timeout-minutes: 180 - env: - DOCKER_IMAGES_SLUG: koa - steps: - - uses: actions/checkout@v3 - - - name: Docker images sentinel cache - id: cache-sentinel - uses: actions/cache@v3 - with: - path: $(SENTINEL_CACHE_PATH) - key: SENTINEL=1 | $(DOCKER_IMAGES_SLUG) | $(CACHE_KEY_IMAGES) - - lilac: - runs-on: ubuntu-latest - timeout-minutes: 180 - env: - DOCKER_IMAGES_SLUG: lilac - steps: - - uses: actions/checkout@v3 - - - name: Docker images sentinel cache - id: cache-sentinel - uses: actions/cache@v3 - with: - path: $(SENTINEL_CACHE_PATH) - key: SENTINEL=1 | $(DOCKER_IMAGES_SLUG) | $(CACHE_KEY_IMAGES) + $(derex build openedx --only-print-image-name -t nostatic ${{ inputs.DOCKER_IMAGES_SLUG }}) \ + $(derex build openedx --only-print-image-name -t dev ${{ inputs.DOCKER_IMAGES_SLUG }}) \ + | pixz -0 > ${{ inputs.IMAGE_CACHE_PATH }}/edx-${{ inputs.DOCKER_IMAGES_SLUG }}.tar.xz diff --git a/.github/workflows/juniper.yml b/.github/workflows/juniper.yml new file mode 100644 index 00000000..d70a9d3a --- /dev/null +++ b/.github/workflows/juniper.yml @@ -0,0 +1,15 @@ +name: Build Juniper +on: + push + +jobs: + Build_Juniper: + uses: ./.github/workflows/build.yml + with: + DOCKER_IMAGES_SLUG: juniper + CACHE_KEY_BASE: 22 # Increment this value to reset the images cache + CACHE_KEY_FILES: ${{ github.workspace }}/docker-definition + CACHE_KEY_IMAGES: BASE_SEED=$CACHE_KEY_BASE | $CACHE_KEY_FILES + IMAGE_CACHE_PATH: ${{ github.workspace }}/image_cache + SENTINEL_CACHE_PATH: ${{ github.workspace }}/sentinel_cache + AS_PYTHON_PACKAGE: false \ No newline at end of file diff --git a/.github/workflows/koa.yml b/.github/workflows/koa.yml new file mode 100644 index 00000000..fc3a35b5 --- /dev/null +++ b/.github/workflows/koa.yml @@ -0,0 +1,17 @@ +name: Build Koa +on: + pull_request: + types: + - opened + +jobs: + Build_Koa: + uses: ./.github/workflows/build.yml + with: + DOCKER_IMAGES_SLUG: koa + CACHE_KEY_BASE: 22 # Increment this value to reset the images cache + CACHE_KEY_FILES: ${{ github.workspace }}/docker-definition + CACHE_KEY_IMAGES: BASE_SEED=$CACHE_KEY_BASE | $CACHE_KEY_FILES + IMAGE_CACHE_PATH: ${{ github.workspace }}/image_cache + SENTINEL_CACHE_PATH: ${{ github.workspace }}/sentinel_cache + AS_PYTHON_PACKAGE: false \ No newline at end of file diff --git a/.github/workflows/lilac.yml b/.github/workflows/lilac.yml new file mode 100644 index 00000000..87c2d5e1 --- /dev/null +++ b/.github/workflows/lilac.yml @@ -0,0 +1,17 @@ +name: Build Lilac +on: + pull_request: + types: + - opened + +jobs: + Build_Lilac: + uses: ./.github/workflows/build.yml + with: + DOCKER_IMAGES_SLUG: lilac + CACHE_KEY_BASE: 22 # Increment this value to reset the images cache + CACHE_KEY_FILES: ${{ github.workspace }}/docker-definition + CACHE_KEY_IMAGES: BASE_SEED=$CACHE_KEY_BASE | $CACHE_KEY_FILES + IMAGE_CACHE_PATH: ${{ github.workspace }}/image_cache + SENTINEL_CACHE_PATH: ${{ github.workspace }}/sentinel_cache + AS_PYTHON_PACKAGE: false \ No newline at end of file diff --git a/azure-pipelines.yml b/azure-pipelines.yml index c0fec5a4..082f5f4f 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -7,7 +7,7 @@ schedules: always: true stages: - - template: azure-pipelines/build.yml + - template: azure-pipelines/juniper.yml - template: azure-pipelines/test.yml - template: azure-pipelines/push.yml diff --git a/azure-pipelines/build.yml b/azure-pipelines/build.yml deleted file mode 100644 index 606b7e92..00000000 --- a/azure-pipelines/build.yml +++ /dev/null @@ -1,37 +0,0 @@ -stages: - - stage: Build - variables: - - group: Transifex credentials - - jobs: - - job: juniper - timeoutInMinutes: 180 - pool: - vmImage: $(UBUNTU_VERSION) - continueOnError: true # bad translations currently cause errors - variables: - - name: DOCKER_IMAGES_SLUG - value: juniper - steps: - - template: build_single_version.yml - - - job: koa - timeoutInMinutes: 180 - pool: - vmImage: $(UBUNTU_VERSION) - continueOnError: true # bad translations currently cause errors - variables: - - name: DOCKER_IMAGES_SLUG - value: koa - steps: - - template: build_single_version.yml - - job: lilac - timeoutInMinutes: 180 - pool: - vmImage: $(UBUNTU_VERSION) - - variables: - - name: DOCKER_IMAGES_SLUG - value: lilac - steps: - - template: build_single_version.yml diff --git a/azure-pipelines/build_single_version.yml b/azure-pipelines/build_single_version.yml deleted file mode 100644 index 0b682e46..00000000 --- a/azure-pipelines/build_single_version.yml +++ /dev/null @@ -1,102 +0,0 @@ -steps: - # Sentinel cache: if this one hits, it means the image cache will hit too - # We don't use the image cache for performance reasons - - task: Cache@2 - inputs: - key: SENTINEL=1 | $(DOCKER_IMAGES_SLUG) | $(CACHE_KEY_IMAGES) - path: $(SENTINEL_CACHE_PATH) - cacheHitVar: "ImagesSentinelHit" - displayName: "Docker images sentinel cache" - - - template: load_images.yml - parameters: - DOCKER_IMAGES_SLUG: $(DOCKER_IMAGES_SLUG) - CONDITION: ne(variables.ImagesSentinelHit, 'true') - - - script: echo '##vso[task.setvariable variable=needs_build]true' - condition: ne(variables.ImagesSentinelHit, 'true') - displayName: "Set needs_build pipeline variable" - - - script: df -h; time sudo rm -rf /var/cache/apt/archives /opt/ghc; df -h - condition: and(succeeded(), ne(variables.needs_build, 'false')) - displayName: "Remove Haskell compiler and cached apt archives to save disk space" - - - script: | - if [ "$TRANSIFEX_USERNAME" == '$(TRANSIFEX_USERNAME)' ] || [ "$TRANSIFEX_PASSWORD" == '$(TRANSIFEX_PASSWORD)' ]; then - echo "Transifex credentials unset. Building without translations." - exit 0 - fi - printf '[https://www.transifex.com]\nhostname=https://www.transifex.com\nusername=%s\npassword=%s\n' "${TRANSIFEX_USERNAME}" "${TRANSIFEX_PASSWORD}" > $HOME/.transifexrc - ls -l $HOME/.transifexrc - condition: and(succeeded(), ne(variables.needs_build, 'false')) - displayName: "Prepare Transifex credentials" - env: - TRANSIFEX_USERNAME: $(TRANSIFEX_USERNAME) - TRANSIFEX_PASSWORD: $(TRANSIFEX_PASSWORD) - - - script: | - images=$(docker images|grep -v ''|grep derex|awk '{print $1 ":" $2}') - CACHE_FROM_OPTS="" - if [ -d "$(IMAGE_CACHE_PATH)" ]; then - echo "Will use cached layers from images $images" - for image in $images; do - CACHE_FROM_OPTS="${CACHE_FROM_OPTS} --cache-from=$image" - done - else - mkdir $(IMAGE_CACHE_PATH) - fi - echo "##vso[task.setvariable variable=CACHE_FROM_OPTS]${CACHE_FROM_OPTS}" - mkdir $(SENTINEL_CACHE_PATH) - cp -r $(CACHE_KEY_FILES) $(SENTINEL_CACHE_PATH) - # We save the sha of the repo that built this image, so that we can push - # it only in a build of the same commit, after tests are passed - git rev-parse --verify HEAD > $(SENTINEL_CACHE_PATH)/built_version - condition: and(succeeded(), ne(variables.needs_build, 'false')) - displayName: "Setup docker images cache" - - - script: | - set -ex - sudo apt-get remove moby-cli -y - curl -fsSL https://get.docker.com |sudo bash - sudo mv /etc/docker/daemon.json /etc/docker/daemon.json.orig - sudo cat /etc/docker/daemon.json.orig|jq '. + {experimental: true}' |sudo tee /etc/docker/daemon.json - sudo systemctl restart docker.service - docker version - docker buildx create --use - docker images - condition: and(succeeded(), ne(variables.needs_build, 'false')) - displayName: Replace Microsoft docker with upsream docker and create build context - - - script: sudo apt-get install pixz -y - condition: and(succeeded(), ne(variables.needs_build, 'false')) - displayName: Install pixz - - - template: prepare.yml - parameters: - CONDITION: "ne(variables.needs_build, 'false')" - - - script: derex build openedx --docker-opts "${CACHE_FROM_OPTS} --cache-to=type=inline -o type=docker" --target=nostatic $(DOCKER_IMAGES_SLUG) - condition: and(succeeded(), ne(variables.needs_build, 'false')) - displayName: Build nostatic image - - - script: derex build openedx --docker-opts "--cache-to=type=inline -o type=docker" --target=dev $(DOCKER_IMAGES_SLUG) - condition: and(succeeded(), ne(variables.needs_build, 'false')) - displayName: Build dev image - - - script: | - docker images - derex build openedx --docker-opts "${CACHE_FROM_OPTS} --output type=docker,name={docker_image_prefix}-{target}" --target=translations $(DOCKER_IMAGES_SLUG) - docker images - docker run --rm derex/openedx-${DOCKER_IMAGES_SLUG}-translations:$(grep __version__ derex/runner/__init__.py |sed 's/[^"]*"//;s/"//') sh -c "i18n_tool validate || (find conf|grep prob; find conf|grep prob|xargs cat; false)" || - echo "##vso[task.logissue type=error]Problems with translations found" - condition: and(succeeded(), ne(variables.needs_build, 'false')) - displayName: Check translations - - - script: | - set -euxo pipefail; - docker save \ - $(derex build openedx --only-print-image-name -t nostatic $(DOCKER_IMAGES_SLUG)) \ - $(derex build openedx --only-print-image-name -t dev $(DOCKER_IMAGES_SLUG)) \ - | pixz -0 > $(IMAGE_CACHE_PATH)/edx-$(DOCKER_IMAGES_SLUG).tar.xz - condition: and(succeeded(), ne(variables.needs_build, 'false')) - displayName: Save images diff --git a/azure-pipelines/load_images.yml b/azure-pipelines/load_images.yml deleted file mode 100644 index b98e9a77..00000000 --- a/azure-pipelines/load_images.yml +++ /dev/null @@ -1,26 +0,0 @@ -parameters: - - name: DOCKER_IMAGES_SLUG - type: string - - name: CONDITION - type: string - default: "true" - -steps: - - task: Cache@2 - inputs: - key: BASE_SEED=$(CACHE_KEY_BASE) | ${{ parameters.DOCKER_IMAGES_SLUG }} | $(CACHE_KEY_IMAGES) - path: $(IMAGE_CACHE_PATH) - cacheHitVar: "ImagesHit" - restoreKeys: BASE_SEED=$(CACHE_KEY_BASE) | ${{ parameters.DOCKER_IMAGES_SLUG }} - condition: ${{ parameters.CONDITION }} - displayName: "Docker images cache" - - - script: | - [ -d $(IMAGE_CACHE_PATH) ] || exit 0 - ls -l $(IMAGE_CACHE_PATH) - docker images - set -euxo pipefail - cat $(IMAGE_CACHE_PATH)/edx-${{ parameters.DOCKER_IMAGES_SLUG }}.tar.xz | unxz | docker load - docker images - condition: ${{ parameters.CONDITION }} - displayName: "Load ${{ parameters.DOCKER_IMAGES_SLUG }} images" diff --git a/azure-pipelines/prepare.yml b/azure-pipelines/prepare.yml deleted file mode 100644 index 53054366..00000000 --- a/azure-pipelines/prepare.yml +++ /dev/null @@ -1,35 +0,0 @@ -parameters: - - name: CONDITION - type: string - default: "true" - - name: AS_PYTHON_PACKAGE - type: boolean - default: False - -steps: - - task: UsePythonVersion@0 - inputs: - versionSpec: "3.8" - condition: ${{ parameters.CONDITION }} - displayName: "Use Python 3.8" - - - task: Cache@2 - inputs: - key: pipcache | requirements_dev.txt - path: $(Pipeline.Workspace)/.cache/pip - restoreKeys: | - pipcache - condition: ${{ parameters.CONDITION }} - displayName: Cache pip packages - - - script: | - pip3 install --cache-dir $(Pipeline.Workspace)/.cache/pip -U pip setuptools - pip3 install --cache-dir $(Pipeline.Workspace)/.cache/pip -r requirements_dev.txt -e . git+https://github.com/tonybaloney/pytest-azurepipelines.git - condition: and(${{ parameters.CONDITION }}, eq(${{ parameters.AS_PYTHON_PACKAGE }}, False)) - displayName: "Install derex.runner" - - - script: | - pip3 install --cache-dir $(Pipeline.Workspace)/.cache/pip -U pip setuptools - pip3 install --cache-dir $(Pipeline.Workspace)/.cache/pip . git+https://github.com/tonybaloney/pytest-azurepipelines.git - condition: and(${{ parameters.CONDITION }}, eq(${{ parameters.AS_PYTHON_PACKAGE }}, True)) - displayName: "Install derex.runner as python package" From a96088ebcf6bbc8c58fea3273837733a6cfc71ac Mon Sep 17 00:00:00 2001 From: serhii Date: Mon, 1 Aug 2022 20:51:43 +0100 Subject: [PATCH 047/145] Build workflow refactoring --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3d5f11ee..c88ced4d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -71,7 +71,7 @@ jobs: echo "Transifex credentials unset. Building without translations." exit 0 fi - printf '[https://www.transifex.com]\nhostname=https://www.transifex.com\nusername=%s\npassword=%s\n' "${TRANSIFEX_USERNAME}" "${TRANSIFEX_PASSWORD}" > $HOME/.transifexrc + printf '[https://www.transifex.com]\nhostname=https://www.transifex.com\nusername=%s\npassword=%s\n' "${TRANSIFEX_USERNAME}" "${TRANSIFEX_PASSWORD}" > ${{ github.workspace }}/.transifexrc ls -l ${{ github.workspace }}/.transifexrc - name: Setup docker images cache From b510a890e0af94368e8877d19560d79002dad4bf Mon Sep 17 00:00:00 2001 From: serhii Date: Mon, 1 Aug 2022 20:56:27 +0100 Subject: [PATCH 048/145] Build workflow refactoring --- .github/workflows/build.yml | 2 +- .github/workflows/juniper.yml | 12 ++++++------ .github/workflows/koa.yml | 4 ++-- .github/workflows/lilac.yml | 4 ++-- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c88ced4d..4508751b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -25,7 +25,7 @@ on: type: boolean jobs: - Build_Juniper: + Build: runs-on: ubuntu-latest timeout-minutes: 180 steps: diff --git a/.github/workflows/juniper.yml b/.github/workflows/juniper.yml index d70a9d3a..dcd96b0f 100644 --- a/.github/workflows/juniper.yml +++ b/.github/workflows/juniper.yml @@ -1,15 +1,15 @@ -name: Build Juniper +name: Juniper on: push jobs: - Build_Juniper: + Juniper: uses: ./.github/workflows/build.yml with: DOCKER_IMAGES_SLUG: juniper CACHE_KEY_BASE: 22 # Increment this value to reset the images cache - CACHE_KEY_FILES: ${{ github.workspace }}/docker-definition - CACHE_KEY_IMAGES: BASE_SEED=$CACHE_KEY_BASE | $CACHE_KEY_FILES - IMAGE_CACHE_PATH: ${{ github.workspace }}/image_cache - SENTINEL_CACHE_PATH: ${{ github.workspace }}/sentinel_cache + CACHE_KEY_FILES: "${{ github.workspace }}/docker-definition" + CACHE_KEY_IMAGES: "BASE_SEED=$CACHE_KEY_BASE | $CACHE_KEY_FILES" + IMAGE_CACHE_PATH: "${{ github.workspace }}/image_cache" + SENTINEL_CACHE_PATH: "${{ github.workspace }}/sentinel_cache" AS_PYTHON_PACKAGE: false \ No newline at end of file diff --git a/.github/workflows/koa.yml b/.github/workflows/koa.yml index fc3a35b5..1f99f151 100644 --- a/.github/workflows/koa.yml +++ b/.github/workflows/koa.yml @@ -1,11 +1,11 @@ -name: Build Koa +name: Koa on: pull_request: types: - opened jobs: - Build_Koa: + Koa: uses: ./.github/workflows/build.yml with: DOCKER_IMAGES_SLUG: koa diff --git a/.github/workflows/lilac.yml b/.github/workflows/lilac.yml index 87c2d5e1..7b8ecd44 100644 --- a/.github/workflows/lilac.yml +++ b/.github/workflows/lilac.yml @@ -1,11 +1,11 @@ -name: Build Lilac +name: Lilac on: pull_request: types: - opened jobs: - Build_Lilac: + Lilac: uses: ./.github/workflows/build.yml with: DOCKER_IMAGES_SLUG: lilac From 0d93f10f3c68deb1613449cabf12be169b0448c6 Mon Sep 17 00:00:00 2001 From: serhii Date: Mon, 1 Aug 2022 21:02:48 +0100 Subject: [PATCH 049/145] Build workflow refactoring --- .github/workflows/build.yml | 14 +++++++------- .github/workflows/juniper.yml | 8 ++++---- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4508751b..3140314a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -71,8 +71,8 @@ jobs: echo "Transifex credentials unset. Building without translations." exit 0 fi - printf '[https://www.transifex.com]\nhostname=https://www.transifex.com\nusername=%s\npassword=%s\n' "${TRANSIFEX_USERNAME}" "${TRANSIFEX_PASSWORD}" > ${{ github.workspace }}/.transifexrc - ls -l ${{ github.workspace }}/.transifexrc + printf '[https://www.transifex.com]\nhostname=https://www.transifex.com\nusername=%s\npassword=%s\n' "${TRANSIFEX_USERNAME}" "${TRANSIFEX_PASSWORD}" > $GITHUB_WORKSPACE/.transifexrc + ls -l $GITHUB_WORKSPACE/.transifexrc - name: Setup docker images cache if: inputs.NEEDS_BUILD != 'false' @@ -115,21 +115,21 @@ jobs: - name: Cache pip packages uses: actions/cache@v3 with: - path: ${{ github.workspace }}/.cache/pip + path: $GITHUB_WORKSPACE/.cache/pip key: pipcache | requirements_dev.txt restore-keys: pipcache - name: Install derex.runner if: inputs.AS_PYTHON_PACKAGE == 'false' && inputs.NEEDS_BUILD != 'false' run: | - pip3 install --cache-dir ${{ github.workspace }}/.cache/pip -U pip setuptools - pip3 install --cache-dir ${{ github.workspace }}/.cache/pip -r requirements_dev.txt -e . + pip3 install --cache-dir $GITHUB_WORKSPACE/.cache/pip -U pip setuptools + pip3 install --cache-dir $GITHUB_WORKSPACE/.cache/pip -r requirements_dev.txt -e . - name: Install derex.runner as python package if: inputs.AS_PYTHON_PACKAGE != 'false' && inputs.NEEDS_BUILD != 'false' run: | - pip3 install --cache-dir ${{ github.workspace }}/.cache/pip -U pip setuptools - pip3 install --cache-dir ${{ github.workspace }}/.cache/pip . + pip3 install --cache-dir $GITHUB_WORKSPACE/.cache/pip -U pip setuptools + pip3 install --cache-dir $GITHUB_WORKSPACE/.cache/pip . - name: Build nostatic image if: inputs.NEEDS_BUILD != 'false' diff --git a/.github/workflows/juniper.yml b/.github/workflows/juniper.yml index dcd96b0f..62d83e8b 100644 --- a/.github/workflows/juniper.yml +++ b/.github/workflows/juniper.yml @@ -8,8 +8,8 @@ jobs: with: DOCKER_IMAGES_SLUG: juniper CACHE_KEY_BASE: 22 # Increment this value to reset the images cache - CACHE_KEY_FILES: "${{ github.workspace }}/docker-definition" - CACHE_KEY_IMAGES: "BASE_SEED=$CACHE_KEY_BASE | $CACHE_KEY_FILES" - IMAGE_CACHE_PATH: "${{ github.workspace }}/image_cache" - SENTINEL_CACHE_PATH: "${{ github.workspace }}/sentinel_cache" + CACHE_KEY_FILES: $GITHUB_WORKSPACE/docker-definition + CACHE_KEY_IMAGES: BASE_SEED=$CACHE_KEY_BASE | $CACHE_KEY_FILES + IMAGE_CACHE_PATH: $GITHUB_WORKSPACE/image_cache + SENTINEL_CACHE_PATH: $GITHUB_WORKSPACE/sentinel_cache AS_PYTHON_PACKAGE: false \ No newline at end of file From 61eb5e1a27c20e15b076c92cbdbfaccb78768fd4 Mon Sep 17 00:00:00 2001 From: serhii Date: Mon, 1 Aug 2022 21:08:07 +0100 Subject: [PATCH 050/145] Build workflow refactoring --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3140314a..99883780 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -110,7 +110,7 @@ jobs: - uses: actions/setup-python@v4 with: - python-version: '3.8' + python-version: '3.10' - name: Cache pip packages uses: actions/cache@v3 From afff97c980d770ff938cc9102a84614c8789f010 Mon Sep 17 00:00:00 2001 From: serhii Date: Mon, 1 Aug 2022 21:09:57 +0100 Subject: [PATCH 051/145] Build workflow refactoring --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 99883780..11b52c3f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -110,7 +110,7 @@ jobs: - uses: actions/setup-python@v4 with: - python-version: '3.10' + python-version: '3.10.5' - name: Cache pip packages uses: actions/cache@v3 From b668ac425efd4e6b1fd9ae77eddd0cca663d5653 Mon Sep 17 00:00:00 2001 From: serhii Date: Mon, 1 Aug 2022 21:15:28 +0100 Subject: [PATCH 052/145] Build workflow refactoring --- .github/workflows/build.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 11b52c3f..84103d08 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -133,11 +133,15 @@ jobs: - name: Build nostatic image if: inputs.NEEDS_BUILD != 'false' - run: derex build openedx --docker-opts "${CACHE_FROM_OPTS} --cache-to=type=inline -o type=docker" --target=nostatic ${{ inputs.DOCKER_IMAGES_SLUG }} + run: | + cd $GITHUB_WORKSPACE + derex build openedx --docker-opts "${CACHE_FROM_OPTS} --cache-to=type=inline -o type=docker" --target=nostatic ${{ inputs.DOCKER_IMAGES_SLUG }} - name: Build dev image if: inputs.NEEDS_BUILD != 'false' - run: derex build openedx --docker-opts "--cache-to=type=inline -o type=docker" --target=dev ${{ inputs.DOCKER_IMAGES_SLUG }} + run: | + cd $GITHUB_WORKSPACE + derex build openedx --docker-opts "--cache-to=type=inline -o type=docker" --target=dev ${{ inputs.DOCKER_IMAGES_SLUG }} - name: Check translations if: inputs.NEEDS_BUILD != 'false' From 9aa7f4c540ed3d9848e505bab0cc6fb3af524b42 Mon Sep 17 00:00:00 2001 From: serhii Date: Mon, 1 Aug 2022 21:22:52 +0100 Subject: [PATCH 053/145] Build workflow refactoring --- .github/workflows/build.yml | 18 +++++++++--------- .github/workflows/juniper.yml | 7 ++++--- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 84103d08..b6100eaf 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -71,8 +71,8 @@ jobs: echo "Transifex credentials unset. Building without translations." exit 0 fi - printf '[https://www.transifex.com]\nhostname=https://www.transifex.com\nusername=%s\npassword=%s\n' "${TRANSIFEX_USERNAME}" "${TRANSIFEX_PASSWORD}" > $GITHUB_WORKSPACE/.transifexrc - ls -l $GITHUB_WORKSPACE/.transifexrc + printf '[https://www.transifex.com]\nhostname=https://www.transifex.com\nusername=%s\npassword=%s\n' "${TRANSIFEX_USERNAME}" "${TRANSIFEX_PASSWORD}" > $WORKSPACE/.transifexrc + ls -l $WORKSPACE/.transifexrc - name: Setup docker images cache if: inputs.NEEDS_BUILD != 'false' @@ -115,32 +115,32 @@ jobs: - name: Cache pip packages uses: actions/cache@v3 with: - path: $GITHUB_WORKSPACE/.cache/pip + path: $WORKSPACE/.cache/pip key: pipcache | requirements_dev.txt restore-keys: pipcache - name: Install derex.runner if: inputs.AS_PYTHON_PACKAGE == 'false' && inputs.NEEDS_BUILD != 'false' run: | - pip3 install --cache-dir $GITHUB_WORKSPACE/.cache/pip -U pip setuptools - pip3 install --cache-dir $GITHUB_WORKSPACE/.cache/pip -r requirements_dev.txt -e . + pip3 install --cache-dir $WORKSPACE/.cache/pip -U pip setuptools + pip3 install --cache-dir $WORKSPACE/.cache/pip -r requirements_dev.txt -e . - name: Install derex.runner as python package if: inputs.AS_PYTHON_PACKAGE != 'false' && inputs.NEEDS_BUILD != 'false' run: | - pip3 install --cache-dir $GITHUB_WORKSPACE/.cache/pip -U pip setuptools - pip3 install --cache-dir $GITHUB_WORKSPACE/.cache/pip . + pip3 install --cache-dir $WORKSPACE/.cache/pip -U pip setuptools + pip3 install --cache-dir $WORKSPACE/.cache/pip . - name: Build nostatic image if: inputs.NEEDS_BUILD != 'false' run: | - cd $GITHUB_WORKSPACE + cd $WORKSPACE derex build openedx --docker-opts "${CACHE_FROM_OPTS} --cache-to=type=inline -o type=docker" --target=nostatic ${{ inputs.DOCKER_IMAGES_SLUG }} - name: Build dev image if: inputs.NEEDS_BUILD != 'false' run: | - cd $GITHUB_WORKSPACE + cd $WORKSPACE derex build openedx --docker-opts "--cache-to=type=inline -o type=docker" --target=dev ${{ inputs.DOCKER_IMAGES_SLUG }} - name: Check translations diff --git a/.github/workflows/juniper.yml b/.github/workflows/juniper.yml index 62d83e8b..00c265bd 100644 --- a/.github/workflows/juniper.yml +++ b/.github/workflows/juniper.yml @@ -6,10 +6,11 @@ jobs: Juniper: uses: ./.github/workflows/build.yml with: + WORKSPACE: /home/runner/work/derex.runner/derex.runner DOCKER_IMAGES_SLUG: juniper CACHE_KEY_BASE: 22 # Increment this value to reset the images cache - CACHE_KEY_FILES: $GITHUB_WORKSPACE/docker-definition + CACHE_KEY_FILES: $WORKSPACE/docker-definition CACHE_KEY_IMAGES: BASE_SEED=$CACHE_KEY_BASE | $CACHE_KEY_FILES - IMAGE_CACHE_PATH: $GITHUB_WORKSPACE/image_cache - SENTINEL_CACHE_PATH: $GITHUB_WORKSPACE/sentinel_cache + IMAGE_CACHE_PATH: $WORKSPACE/image_cache + SENTINEL_CACHE_PATH: $WORKSPACE/sentinel_cache AS_PYTHON_PACKAGE: false \ No newline at end of file From 02f9393198d6ca4a7a54c23e9d10071cd4764b1e Mon Sep 17 00:00:00 2001 From: serhii Date: Mon, 1 Aug 2022 21:23:29 +0100 Subject: [PATCH 054/145] Build workflow refactoring --- .github/workflows/build.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b6100eaf..cd9d4dba 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -5,6 +5,9 @@ on: DOCKER_IMAGES_SLUG: required: true type: string + WORKSPACE: + required: true + type: string CACHE_KEY_BASE: required: true type: string From 5f6a7712e19ab6d84f9c7f7ff18363183611ae6e Mon Sep 17 00:00:00 2001 From: serhii Date: Mon, 1 Aug 2022 21:26:18 +0100 Subject: [PATCH 055/145] Build workflow refactoring --- .github/workflows/build.yml | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index cd9d4dba..5f1b7c68 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -74,8 +74,8 @@ jobs: echo "Transifex credentials unset. Building without translations." exit 0 fi - printf '[https://www.transifex.com]\nhostname=https://www.transifex.com\nusername=%s\npassword=%s\n' "${TRANSIFEX_USERNAME}" "${TRANSIFEX_PASSWORD}" > $WORKSPACE/.transifexrc - ls -l $WORKSPACE/.transifexrc + printf '[https://www.transifex.com]\nhostname=https://www.transifex.com\nusername=%s\npassword=%s\n' "${TRANSIFEX_USERNAME}" "${TRANSIFEX_PASSWORD}" > ${{ inputs.WORKSPACE }}/.transifexrc + ls -l ${{ inputs.WORKSPACE }}/.transifexrc - name: Setup docker images cache if: inputs.NEEDS_BUILD != 'false' @@ -118,32 +118,30 @@ jobs: - name: Cache pip packages uses: actions/cache@v3 with: - path: $WORKSPACE/.cache/pip + path: ${{ inputs.WORKSPACE }}/.cache/pip key: pipcache | requirements_dev.txt restore-keys: pipcache - name: Install derex.runner if: inputs.AS_PYTHON_PACKAGE == 'false' && inputs.NEEDS_BUILD != 'false' run: | - pip3 install --cache-dir $WORKSPACE/.cache/pip -U pip setuptools - pip3 install --cache-dir $WORKSPACE/.cache/pip -r requirements_dev.txt -e . + pip3 install --cache-dir ${{ inputs.WORKSPACE }}/.cache/pip -U pip setuptools + pip3 install --cache-dir ${{ inputs.WORKSPACE }}/.cache/pip -r requirements_dev.txt -e . - name: Install derex.runner as python package if: inputs.AS_PYTHON_PACKAGE != 'false' && inputs.NEEDS_BUILD != 'false' run: | - pip3 install --cache-dir $WORKSPACE/.cache/pip -U pip setuptools - pip3 install --cache-dir $WORKSPACE/.cache/pip . + pip3 install --cache-dir ${{ inputs.WORKSPACE }}/.cache/pip -U pip setuptools + pip3 install --cache-dir ${{ inputs.WORKSPACE }}/.cache/pip . - name: Build nostatic image if: inputs.NEEDS_BUILD != 'false' run: | - cd $WORKSPACE derex build openedx --docker-opts "${CACHE_FROM_OPTS} --cache-to=type=inline -o type=docker" --target=nostatic ${{ inputs.DOCKER_IMAGES_SLUG }} - name: Build dev image if: inputs.NEEDS_BUILD != 'false' run: | - cd $WORKSPACE derex build openedx --docker-opts "--cache-to=type=inline -o type=docker" --target=dev ${{ inputs.DOCKER_IMAGES_SLUG }} - name: Check translations From a89c222317e8bd8c22563107d1d08efeff711f6b Mon Sep 17 00:00:00 2001 From: serhii Date: Mon, 1 Aug 2022 21:27:39 +0100 Subject: [PATCH 056/145] Build workflow refactoring --- .github/workflows/juniper.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/juniper.yml b/.github/workflows/juniper.yml index 00c265bd..44214cfc 100644 --- a/.github/workflows/juniper.yml +++ b/.github/workflows/juniper.yml @@ -9,8 +9,8 @@ jobs: WORKSPACE: /home/runner/work/derex.runner/derex.runner DOCKER_IMAGES_SLUG: juniper CACHE_KEY_BASE: 22 # Increment this value to reset the images cache - CACHE_KEY_FILES: $WORKSPACE/docker-definition + CACHE_KEY_FILES: /home/runner/work/derex.runner/derex.runner/docker-definition CACHE_KEY_IMAGES: BASE_SEED=$CACHE_KEY_BASE | $CACHE_KEY_FILES - IMAGE_CACHE_PATH: $WORKSPACE/image_cache - SENTINEL_CACHE_PATH: $WORKSPACE/sentinel_cache + IMAGE_CACHE_PATH: /home/runner/work/derex.runner/derex.runner/image_cache + SENTINEL_CACHE_PATH: /home/runner/work/derex.runner/derex.runner/sentinel_cache AS_PYTHON_PACKAGE: false \ No newline at end of file From 6ba535a26dde319e12ce064b988c0ddb929af794 Mon Sep 17 00:00:00 2001 From: serhii Date: Mon, 1 Aug 2022 21:32:48 +0100 Subject: [PATCH 057/145] Build workflow refactoring --- .github/workflows/build.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5f1b7c68..d65e7e0b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -27,6 +27,16 @@ on: required: true type: boolean +env: + WORKSPACE: ${{ inputs.WORKSPACE }} + DOCKER_IMAGES_SLUG: ${{ inputs.DOCKER_IMAGES_SLUG }} + CACHE_KEY_BASE: ${{ inputs.CACHE_KEY_BASE }} + CACHE_KEY_FILES: ${{ inputs.CACHE_KEY_FILES }} + CACHE_KEY_IMAGES: ${{ inputs.CACHE_KEY_IMAGES }} + IMAGE_CACHE_PATH: ${{ inputs.IMAGE_CACHE_PATH }} + SENTINEL_CACHE_PATH: ${{ inputs.SENTINEL_CACHE_PATH }} + AS_PYTHON_PACKAGE: ${{ inputs.AS_PYTHON_PACKAGE }} + jobs: Build: runs-on: ubuntu-latest From 34492ab79119940cf885ecff479d771df7802bb1 Mon Sep 17 00:00:00 2001 From: serhii Date: Mon, 1 Aug 2022 21:35:32 +0100 Subject: [PATCH 058/145] Build workflow refactoring --- .github/workflows/build.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d65e7e0b..a8ceb0c2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -147,11 +147,13 @@ jobs: - name: Build nostatic image if: inputs.NEEDS_BUILD != 'false' run: | + cd ${{ inputs.WORKSPACE }} derex build openedx --docker-opts "${CACHE_FROM_OPTS} --cache-to=type=inline -o type=docker" --target=nostatic ${{ inputs.DOCKER_IMAGES_SLUG }} - name: Build dev image if: inputs.NEEDS_BUILD != 'false' run: | + cd ${{ inputs.WORKSPACE }} derex build openedx --docker-opts "--cache-to=type=inline -o type=docker" --target=dev ${{ inputs.DOCKER_IMAGES_SLUG }} - name: Check translations From 786c4c399410d1fbfee6be9cbb80d64a27c7a5f8 Mon Sep 17 00:00:00 2001 From: serhii Date: Mon, 1 Aug 2022 21:38:09 +0100 Subject: [PATCH 059/145] Build workflow refactoring --- .github/workflows/build.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a8ceb0c2..6a5f0713 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -28,14 +28,14 @@ on: type: boolean env: - WORKSPACE: ${{ inputs.WORKSPACE }} - DOCKER_IMAGES_SLUG: ${{ inputs.DOCKER_IMAGES_SLUG }} - CACHE_KEY_BASE: ${{ inputs.CACHE_KEY_BASE }} - CACHE_KEY_FILES: ${{ inputs.CACHE_KEY_FILES }} - CACHE_KEY_IMAGES: ${{ inputs.CACHE_KEY_IMAGES }} - IMAGE_CACHE_PATH: ${{ inputs.IMAGE_CACHE_PATH }} - SENTINEL_CACHE_PATH: ${{ inputs.SENTINEL_CACHE_PATH }} - AS_PYTHON_PACKAGE: ${{ inputs.AS_PYTHON_PACKAGE }} + WORKSPACE: /home/runner/work/derex.runner/derex.runner + DOCKER_IMAGES_SLUG: juniper + CACHE_KEY_BASE: 22 # Increment this value to reset the images cache + CACHE_KEY_FILES: /home/runner/work/derex.runner/derex.runner/docker-definition + CACHE_KEY_IMAGES: BASE_SEED=$CACHE_KEY_BASE | $CACHE_KEY_FILES + IMAGE_CACHE_PATH: /home/runner/work/derex.runner/derex.runner/image_cache + SENTINEL_CACHE_PATH: /home/runner/work/derex.runner/derex.runner/sentinel_cache + AS_PYTHON_PACKAGE: false jobs: Build: From ec30d0726ba05ae3d1ada00d16886ca7e49638e5 Mon Sep 17 00:00:00 2001 From: serhii Date: Mon, 1 Aug 2022 21:40:41 +0100 Subject: [PATCH 060/145] Build workflow refactoring --- .github/workflows/build.yml | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6a5f0713..55c99461 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -146,15 +146,11 @@ jobs: - name: Build nostatic image if: inputs.NEEDS_BUILD != 'false' - run: | - cd ${{ inputs.WORKSPACE }} - derex build openedx --docker-opts "${CACHE_FROM_OPTS} --cache-to=type=inline -o type=docker" --target=nostatic ${{ inputs.DOCKER_IMAGES_SLUG }} + run: derex build openedx --docker-opts "${CACHE_FROM_OPTS} --cache-to=type=inline -o type=docker" --target=nostatic $DOCKER_IMAGES_SLUG - name: Build dev image if: inputs.NEEDS_BUILD != 'false' - run: | - cd ${{ inputs.WORKSPACE }} - derex build openedx --docker-opts "--cache-to=type=inline -o type=docker" --target=dev ${{ inputs.DOCKER_IMAGES_SLUG }} + run: derex build openedx --docker-opts "--cache-to=type=inline -o type=docker" --target=dev $DOCKER_IMAGES_SLUG - name: Check translations if: inputs.NEEDS_BUILD != 'false' From 6e96484ea092739c59d0b9923f2fcdd30abe1ec0 Mon Sep 17 00:00:00 2001 From: serhii Date: Mon, 1 Aug 2022 21:43:14 +0100 Subject: [PATCH 061/145] Build workflow refactoring --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 55c99461..e102cedf 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -123,7 +123,7 @@ jobs: - uses: actions/setup-python@v4 with: - python-version: '3.10.5' + python-version: '3.x' - name: Cache pip packages uses: actions/cache@v3 From 69d5d72f158f07403fcef47f2745132c0b5a6330 Mon Sep 17 00:00:00 2001 From: serhii Date: Mon, 1 Aug 2022 21:44:50 +0100 Subject: [PATCH 062/145] Build workflow refactoring --- .github/workflows/build.yml | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e102cedf..cd8e7ca2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -27,16 +27,6 @@ on: required: true type: boolean -env: - WORKSPACE: /home/runner/work/derex.runner/derex.runner - DOCKER_IMAGES_SLUG: juniper - CACHE_KEY_BASE: 22 # Increment this value to reset the images cache - CACHE_KEY_FILES: /home/runner/work/derex.runner/derex.runner/docker-definition - CACHE_KEY_IMAGES: BASE_SEED=$CACHE_KEY_BASE | $CACHE_KEY_FILES - IMAGE_CACHE_PATH: /home/runner/work/derex.runner/derex.runner/image_cache - SENTINEL_CACHE_PATH: /home/runner/work/derex.runner/derex.runner/sentinel_cache - AS_PYTHON_PACKAGE: false - jobs: Build: runs-on: ubuntu-latest @@ -121,10 +111,6 @@ jobs: docker images sudo apt-get install pixz -y - - uses: actions/setup-python@v4 - with: - python-version: '3.x' - - name: Cache pip packages uses: actions/cache@v3 with: From 75502b4c444f73646597043c90f4c8eeff32fc7e Mon Sep 17 00:00:00 2001 From: serhii Date: Mon, 1 Aug 2022 21:46:40 +0100 Subject: [PATCH 063/145] Build workflow refactoring --- .github/workflows/build.yml | 4 ++-- .github/workflows/juniper.yml | 7 +++---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index cd8e7ca2..8000302c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -132,11 +132,11 @@ jobs: - name: Build nostatic image if: inputs.NEEDS_BUILD != 'false' - run: derex build openedx --docker-opts "${CACHE_FROM_OPTS} --cache-to=type=inline -o type=docker" --target=nostatic $DOCKER_IMAGES_SLUG + run: derex build openedx --docker-opts "${CACHE_FROM_OPTS} --cache-to=type=inline -o type=docker" --target=nostatic ${{ inputs.DOCKER_IMAGES_SLUG }} - name: Build dev image if: inputs.NEEDS_BUILD != 'false' - run: derex build openedx --docker-opts "--cache-to=type=inline -o type=docker" --target=dev $DOCKER_IMAGES_SLUG + run: derex build openedx --docker-opts "--cache-to=type=inline -o type=docker" --target=dev ${{ inputs.DOCKER_IMAGES_SLUG }} - name: Check translations if: inputs.NEEDS_BUILD != 'false' diff --git a/.github/workflows/juniper.yml b/.github/workflows/juniper.yml index 44214cfc..62d83e8b 100644 --- a/.github/workflows/juniper.yml +++ b/.github/workflows/juniper.yml @@ -6,11 +6,10 @@ jobs: Juniper: uses: ./.github/workflows/build.yml with: - WORKSPACE: /home/runner/work/derex.runner/derex.runner DOCKER_IMAGES_SLUG: juniper CACHE_KEY_BASE: 22 # Increment this value to reset the images cache - CACHE_KEY_FILES: /home/runner/work/derex.runner/derex.runner/docker-definition + CACHE_KEY_FILES: $GITHUB_WORKSPACE/docker-definition CACHE_KEY_IMAGES: BASE_SEED=$CACHE_KEY_BASE | $CACHE_KEY_FILES - IMAGE_CACHE_PATH: /home/runner/work/derex.runner/derex.runner/image_cache - SENTINEL_CACHE_PATH: /home/runner/work/derex.runner/derex.runner/sentinel_cache + IMAGE_CACHE_PATH: $GITHUB_WORKSPACE/image_cache + SENTINEL_CACHE_PATH: $GITHUB_WORKSPACE/sentinel_cache AS_PYTHON_PACKAGE: false \ No newline at end of file From 8149dcc273305698515864e5de53c4b00500c2c7 Mon Sep 17 00:00:00 2001 From: serhii Date: Mon, 1 Aug 2022 21:48:33 +0100 Subject: [PATCH 064/145] Build workflow refactoring --- .github/workflows/juniper.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/juniper.yml b/.github/workflows/juniper.yml index 62d83e8b..44214cfc 100644 --- a/.github/workflows/juniper.yml +++ b/.github/workflows/juniper.yml @@ -6,10 +6,11 @@ jobs: Juniper: uses: ./.github/workflows/build.yml with: + WORKSPACE: /home/runner/work/derex.runner/derex.runner DOCKER_IMAGES_SLUG: juniper CACHE_KEY_BASE: 22 # Increment this value to reset the images cache - CACHE_KEY_FILES: $GITHUB_WORKSPACE/docker-definition + CACHE_KEY_FILES: /home/runner/work/derex.runner/derex.runner/docker-definition CACHE_KEY_IMAGES: BASE_SEED=$CACHE_KEY_BASE | $CACHE_KEY_FILES - IMAGE_CACHE_PATH: $GITHUB_WORKSPACE/image_cache - SENTINEL_CACHE_PATH: $GITHUB_WORKSPACE/sentinel_cache + IMAGE_CACHE_PATH: /home/runner/work/derex.runner/derex.runner/image_cache + SENTINEL_CACHE_PATH: /home/runner/work/derex.runner/derex.runner/sentinel_cache AS_PYTHON_PACKAGE: false \ No newline at end of file From 930491dac93e1a7b7cc07fac170df2e761f8e5a8 Mon Sep 17 00:00:00 2001 From: serhii Date: Mon, 1 Aug 2022 22:00:28 +0100 Subject: [PATCH 065/145] Build workflow refactoring --- .github/workflows/build.yml | 21 +++++++++++---------- .github/workflows/juniper.yml | 7 +++---- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8000302c..3140314a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -5,9 +5,6 @@ on: DOCKER_IMAGES_SLUG: required: true type: string - WORKSPACE: - required: true - type: string CACHE_KEY_BASE: required: true type: string @@ -74,8 +71,8 @@ jobs: echo "Transifex credentials unset. Building without translations." exit 0 fi - printf '[https://www.transifex.com]\nhostname=https://www.transifex.com\nusername=%s\npassword=%s\n' "${TRANSIFEX_USERNAME}" "${TRANSIFEX_PASSWORD}" > ${{ inputs.WORKSPACE }}/.transifexrc - ls -l ${{ inputs.WORKSPACE }}/.transifexrc + printf '[https://www.transifex.com]\nhostname=https://www.transifex.com\nusername=%s\npassword=%s\n' "${TRANSIFEX_USERNAME}" "${TRANSIFEX_PASSWORD}" > $GITHUB_WORKSPACE/.transifexrc + ls -l $GITHUB_WORKSPACE/.transifexrc - name: Setup docker images cache if: inputs.NEEDS_BUILD != 'false' @@ -111,24 +108,28 @@ jobs: docker images sudo apt-get install pixz -y + - uses: actions/setup-python@v4 + with: + python-version: '3.8' + - name: Cache pip packages uses: actions/cache@v3 with: - path: ${{ inputs.WORKSPACE }}/.cache/pip + path: $GITHUB_WORKSPACE/.cache/pip key: pipcache | requirements_dev.txt restore-keys: pipcache - name: Install derex.runner if: inputs.AS_PYTHON_PACKAGE == 'false' && inputs.NEEDS_BUILD != 'false' run: | - pip3 install --cache-dir ${{ inputs.WORKSPACE }}/.cache/pip -U pip setuptools - pip3 install --cache-dir ${{ inputs.WORKSPACE }}/.cache/pip -r requirements_dev.txt -e . + pip3 install --cache-dir $GITHUB_WORKSPACE/.cache/pip -U pip setuptools + pip3 install --cache-dir $GITHUB_WORKSPACE/.cache/pip -r requirements_dev.txt -e . - name: Install derex.runner as python package if: inputs.AS_PYTHON_PACKAGE != 'false' && inputs.NEEDS_BUILD != 'false' run: | - pip3 install --cache-dir ${{ inputs.WORKSPACE }}/.cache/pip -U pip setuptools - pip3 install --cache-dir ${{ inputs.WORKSPACE }}/.cache/pip . + pip3 install --cache-dir $GITHUB_WORKSPACE/.cache/pip -U pip setuptools + pip3 install --cache-dir $GITHUB_WORKSPACE/.cache/pip . - name: Build nostatic image if: inputs.NEEDS_BUILD != 'false' diff --git a/.github/workflows/juniper.yml b/.github/workflows/juniper.yml index 44214cfc..62d83e8b 100644 --- a/.github/workflows/juniper.yml +++ b/.github/workflows/juniper.yml @@ -6,11 +6,10 @@ jobs: Juniper: uses: ./.github/workflows/build.yml with: - WORKSPACE: /home/runner/work/derex.runner/derex.runner DOCKER_IMAGES_SLUG: juniper CACHE_KEY_BASE: 22 # Increment this value to reset the images cache - CACHE_KEY_FILES: /home/runner/work/derex.runner/derex.runner/docker-definition + CACHE_KEY_FILES: $GITHUB_WORKSPACE/docker-definition CACHE_KEY_IMAGES: BASE_SEED=$CACHE_KEY_BASE | $CACHE_KEY_FILES - IMAGE_CACHE_PATH: /home/runner/work/derex.runner/derex.runner/image_cache - SENTINEL_CACHE_PATH: /home/runner/work/derex.runner/derex.runner/sentinel_cache + IMAGE_CACHE_PATH: $GITHUB_WORKSPACE/image_cache + SENTINEL_CACHE_PATH: $GITHUB_WORKSPACE/sentinel_cache AS_PYTHON_PACKAGE: false \ No newline at end of file From ab4877798d41ef3d6c06d019719aa499baf67790 Mon Sep 17 00:00:00 2001 From: serhii Date: Mon, 1 Aug 2022 22:09:46 +0100 Subject: [PATCH 066/145] Build workflow refactoring --- .github/workflows/build.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3140314a..2e8ba35b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -94,6 +94,10 @@ jobs: # it only in a build of the same commit, after tests are passed git rev-parse --verify HEAD > ${{ inputs.SENTINEL_CACHE_PATH }}/built_version + - uses: actions/setup-python@v4 + with: + python-version: '3.8' + - name: Replace default docker with upsream docker and create build context if: inputs.NEEDS_BUILD != 'false' run: | @@ -108,10 +112,6 @@ jobs: docker images sudo apt-get install pixz -y - - uses: actions/setup-python@v4 - with: - python-version: '3.8' - - name: Cache pip packages uses: actions/cache@v3 with: From 394a7abad968941c4229b815e9f123cd4ecf2528 Mon Sep 17 00:00:00 2001 From: serhii Date: Mon, 1 Aug 2022 22:15:14 +0100 Subject: [PATCH 067/145] Build workflow refactoring --- .github/workflows/build.yml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2e8ba35b..6b38ed03 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -24,6 +24,9 @@ on: required: true type: boolean +env: + CACHE_KEY_FILES: /home/runner/work/derex.runner/derex.runner/docker-definition + jobs: Build: runs-on: ubuntu-latest @@ -94,10 +97,6 @@ jobs: # it only in a build of the same commit, after tests are passed git rev-parse --verify HEAD > ${{ inputs.SENTINEL_CACHE_PATH }}/built_version - - uses: actions/setup-python@v4 - with: - python-version: '3.8' - - name: Replace default docker with upsream docker and create build context if: inputs.NEEDS_BUILD != 'false' run: | @@ -112,6 +111,10 @@ jobs: docker images sudo apt-get install pixz -y + - uses: actions/setup-python@v4 + with: + python-version: '3.8' + - name: Cache pip packages uses: actions/cache@v3 with: From 3f76d5aa1e79fa9279d4f505720805a4f383ffef Mon Sep 17 00:00:00 2001 From: serhii Date: Mon, 1 Aug 2022 22:19:22 +0100 Subject: [PATCH 068/145] Build workflow refactoring --- .github/workflows/build.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6b38ed03..dd413f31 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -24,9 +24,6 @@ on: required: true type: boolean -env: - CACHE_KEY_FILES: /home/runner/work/derex.runner/derex.runner/docker-definition - jobs: Build: runs-on: ubuntu-latest @@ -134,6 +131,10 @@ jobs: pip3 install --cache-dir $GITHUB_WORKSPACE/.cache/pip -U pip setuptools pip3 install --cache-dir $GITHUB_WORKSPACE/.cache/pip . + - uses: docker/build-push-action@v2 + with: + context: /home/runner/work/derex.runner/derex.runner/docker-definition + - name: Build nostatic image if: inputs.NEEDS_BUILD != 'false' run: derex build openedx --docker-opts "${CACHE_FROM_OPTS} --cache-to=type=inline -o type=docker" --target=nostatic ${{ inputs.DOCKER_IMAGES_SLUG }} From 7d5defea3978f49075ea643ee20c70f63187bda7 Mon Sep 17 00:00:00 2001 From: serhii Date: Mon, 1 Aug 2022 22:28:02 +0100 Subject: [PATCH 069/145] Build workflow refactoring --- .github/workflows/build.yml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index dd413f31..25a76b48 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -104,7 +104,7 @@ jobs: sudo cat /etc/docker/daemon.json.orig|jq '. + {experimental: true}' |sudo tee /etc/docker/daemon.json sudo systemctl restart docker.service docker version - docker buildx create --use + docker buildx create --use /home/runner/work/derex.runner/derex.runner/docker-definition docker images sudo apt-get install pixz -y @@ -131,10 +131,6 @@ jobs: pip3 install --cache-dir $GITHUB_WORKSPACE/.cache/pip -U pip setuptools pip3 install --cache-dir $GITHUB_WORKSPACE/.cache/pip . - - uses: docker/build-push-action@v2 - with: - context: /home/runner/work/derex.runner/derex.runner/docker-definition - - name: Build nostatic image if: inputs.NEEDS_BUILD != 'false' run: derex build openedx --docker-opts "${CACHE_FROM_OPTS} --cache-to=type=inline -o type=docker" --target=nostatic ${{ inputs.DOCKER_IMAGES_SLUG }} From 77976a0b7ccb660fdb75ee840ae028dd9a7c55a7 Mon Sep 17 00:00:00 2001 From: serhii Date: Mon, 1 Aug 2022 22:31:52 +0100 Subject: [PATCH 070/145] Build workflow refactoring --- .github/workflows/build.yml | 147 ++++++++++++++-------------------- .github/workflows/juniper.yml | 15 ---- .github/workflows/koa.yml | 17 ---- .github/workflows/lilac.yml | 17 ---- 4 files changed, 58 insertions(+), 138 deletions(-) delete mode 100644 .github/workflows/juniper.yml delete mode 100644 .github/workflows/koa.yml delete mode 100644 .github/workflows/lilac.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 25a76b48..54997d07 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,33 +1,19 @@ name: Build -on: - workflow_call: - inputs: - DOCKER_IMAGES_SLUG: - required: true - type: string - CACHE_KEY_BASE: - required: true - type: string - CACHE_KEY_FILES: - required: true - type: string - CACHE_KEY_IMAGES: - required: true - type: string - IMAGE_CACHE_PATH: - required: true - type: string - SENTINEL_CACHE_PATH: - required: true - type: string - AS_PYTHON_PACKAGE: - required: true - type: boolean +on: [push] + +env: + CACHE_KEY_BASE: 22 # Increment this value to reset the images cache + CACHE_KEY_FILES: ${{ github.workspace }}/docker-definition + CACHE_KEY_IMAGES: BASE_SEED=$CACHE_KEY_BASE | $CACHE_KEY_FILES + IMAGE_CACHE_PATH: ${{ github.workspace }}/image_cache + SENTINEL_CACHE_PATH: ${{ github.workspace }}/sentinel_cache jobs: - Build: + juniper: runs-on: ubuntu-latest timeout-minutes: 180 + env: + DOCKER_IMAGES_SLUG: juniper steps: - uses: actions/checkout@v3 @@ -35,25 +21,25 @@ jobs: id: cache-sentinel uses: actions/cache@v3 with: - path: ${{ inputs.SENTINEL_CACHE_PATH }} - key: SENTINEL=1 | ${{ inputs.DOCKER_IMAGES_SLUG }} | ${{ inputs.CACHE_KEY_IMAGES }} + path: $(SENTINEL_CACHE_PATH) + key: SENTINEL=1 | $(DOCKER_IMAGES_SLUG) | $(CACHE_KEY_IMAGES) - name: Docker images cache if: steps.cache-sentinel.outputs.cache-hit != 'true' uses: actions/cache@v3 with: - path: ${{ inputs.IMAGE_CACHE_PATH }} - key: BASE_SEED=${{ inputs.CACHE_KEY_BASE }} | ${{ inputs.DOCKER_IMAGES_SLUG }} | ${{ inputs.CACHE_KEY_IMAGES }} - restore-keys: BASE_SEED=${{ inputs.CACHE_KEY_BASE }} | ${{ inputs.DOCKER_IMAGES_SLUG }} + path: $IMAGE_CACHE_PATH + key: BASE_SEED=$(CACHE_KEY_BASE) | $DOCKER_IMAGES_SLUG | $(CACHE_KEY_IMAGES) + restore-keys: BASE_SEED=$(CACHE_KEY_BASE) | $DOCKER_IMAGES_SLUG - name: Load images if: steps.cache-sentinel.outputs.cache-hit != 'true' run: | - [ -d ${{ inputs.IMAGE_CACHE_PATH }} ] || exit 0 - ls -l ${{ inputs.IMAGE_CACHE_PATH }} + [ -d $IMAGE_CACHE_PATH ] || exit 0 + ls -l $IMAGE_CACHE_PATH docker images set -euxo pipefail - cat ${{ inputs.IMAGE_CACHE_PATH }}/edx-${{ inputs.DOCKER_IMAGES_SLUG }}.tar.xz | unxz | docker load + cat $IMAGE_CACHE_PATH/edx-$DOCKER_IMAGES_SLUG.tar.xz | unxz | docker load docker images - name: Set needs_build pipeline variable @@ -61,41 +47,44 @@ jobs: run: echo "NEEDS_BUILD=true" >> $GITHUB_ENV - name: Remove Haskell compiler and cached apt archives to save disk space - if: inputs.NEEDS_BUILD != 'false' + if: env.NEEDS_BUILD != 'false' && success() run: df -h; time sudo rm -rf /var/cache/apt/archives /opt/ghc; df -h - name: Prepare Transifex credentials - if: inputs.NEEDS_BUILD != 'false' + if: env.NEEDS_BUILD != 'false' run: | if [ "$TRANSIFEX_USERNAME" == '$(TRANSIFEX_USERNAME)' ] || [ "$TRANSIFEX_PASSWORD" == '$(TRANSIFEX_PASSWORD)' ]; then echo "Transifex credentials unset. Building without translations." exit 0 fi - printf '[https://www.transifex.com]\nhostname=https://www.transifex.com\nusername=%s\npassword=%s\n' "${TRANSIFEX_USERNAME}" "${TRANSIFEX_PASSWORD}" > $GITHUB_WORKSPACE/.transifexrc + printf '[https://www.transifex.com]\nhostname=https://www.transifex.com\nusername=%s\npassword=%s\n' "${TRANSIFEX_USERNAME}" "${TRANSIFEX_PASSWORD}" > $HOME/.transifexrc ls -l $GITHUB_WORKSPACE/.transifexrc + env: + TRANSIFEX_USERNAME: $(TRANSIFEX_USERNAME) + TRANSIFEX_PASSWORD: $(TRANSIFEX_PASSWORD) - name: Setup docker images cache - if: inputs.NEEDS_BUILD != 'false' + if: env.NEEDS_BUILD != 'false' && success() run: | images=$(docker images|grep -v ''|grep derex|awk '{print $1 ":" $2}') CACHE_FROM_OPTS="" - if [ -d ${{ inputs.IMAGE_CACHE_PATH }} ]; then + if [ -d $IMAGE_CACHE_PATH ]; then echo "Will use cached layers from images $images" for image in $images; do CACHE_FROM_OPTS="${CACHE_FROM_OPTS} --cache-from=$image" done else - mkdir ${{ inputs.IMAGE_CACHE_PATH }} + mkdir $IMAGE_CACHE_PATH fi echo "CACHE_FROM_OPTS=$CACHE_FROM_OPTS" >> $GITHUB_ENV - mkdir ${{ inputs.SENTINEL_CACHE_PATH }} - cp -r ${{ inputs.CACHE_KEY_FILES }} ${{ inputs.SENTINEL_CACHE_PATH }} + mkdir $SENTINEL_CACHE_PATH + cp -r $CACHE_KEY_FILES $SENTINEL_CACHE_PATH # We save the sha of the repo that built this image, so that we can push # it only in a build of the same commit, after tests are passed - git rev-parse --verify HEAD > ${{ inputs.SENTINEL_CACHE_PATH }}/built_version + git rev-parse --verify HEAD > $SENTINEL_CACHE_PATH/built_version - - name: Replace default docker with upsream docker and create build context - if: inputs.NEEDS_BUILD != 'false' + - name: Replace Microsoft docker with upsream docker and create build context + if: env.NEEDS_BUILD != 'false' && success() run: | set -ex sudo apt-get remove moby-cli -y @@ -104,54 +93,34 @@ jobs: sudo cat /etc/docker/daemon.json.orig|jq '. + {experimental: true}' |sudo tee /etc/docker/daemon.json sudo systemctl restart docker.service docker version - docker buildx create --use /home/runner/work/derex.runner/derex.runner/docker-definition + docker buildx create --use docker images - sudo apt-get install pixz -y - - - uses: actions/setup-python@v4 - with: - python-version: '3.8' + koa: + runs-on: ubuntu-latest + timeout-minutes: 180 + env: + DOCKER_IMAGES_SLUG: koa + steps: + - uses: actions/checkout@v3 - - name: Cache pip packages + - name: Docker images sentinel cache + id: cache-sentinel uses: actions/cache@v3 with: - path: $GITHUB_WORKSPACE/.cache/pip - key: pipcache | requirements_dev.txt - restore-keys: pipcache - - - name: Install derex.runner - if: inputs.AS_PYTHON_PACKAGE == 'false' && inputs.NEEDS_BUILD != 'false' - run: | - pip3 install --cache-dir $GITHUB_WORKSPACE/.cache/pip -U pip setuptools - pip3 install --cache-dir $GITHUB_WORKSPACE/.cache/pip -r requirements_dev.txt -e . - - - name: Install derex.runner as python package - if: inputs.AS_PYTHON_PACKAGE != 'false' && inputs.NEEDS_BUILD != 'false' - run: | - pip3 install --cache-dir $GITHUB_WORKSPACE/.cache/pip -U pip setuptools - pip3 install --cache-dir $GITHUB_WORKSPACE/.cache/pip . - - - name: Build nostatic image - if: inputs.NEEDS_BUILD != 'false' - run: derex build openedx --docker-opts "${CACHE_FROM_OPTS} --cache-to=type=inline -o type=docker" --target=nostatic ${{ inputs.DOCKER_IMAGES_SLUG }} + path: $(SENTINEL_CACHE_PATH) + key: SENTINEL=1 | $(DOCKER_IMAGES_SLUG) | $(CACHE_KEY_IMAGES) - - name: Build dev image - if: inputs.NEEDS_BUILD != 'false' - run: derex build openedx --docker-opts "--cache-to=type=inline -o type=docker" --target=dev ${{ inputs.DOCKER_IMAGES_SLUG }} - - - name: Check translations - if: inputs.NEEDS_BUILD != 'false' - run: | - docker images - derex build openedx --docker-opts "${CACHE_FROM_OPTS} --output type=docker,name={docker_image_prefix}-{target}" --target=translations ${{ inputs.DOCKER_IMAGES_SLUG }} - docker images - docker run --rm derex/openedx-${{ inputs.DOCKER_IMAGES_SLUG }}-translations:$(grep __version__ derex/runner/__init__.py |sed 's/[^"]*"//;s/"//') sh -c "i18n_tool validate || (find conf|grep prob; find conf|grep prob|xargs cat; false)" || echo "Problems with translations found" + lilac: + runs-on: ubuntu-latest + timeout-minutes: 180 + env: + DOCKER_IMAGES_SLUG: lilac + steps: + - uses: actions/checkout@v3 - - name: Save images - if: inputs.NEEDS_BUILD != 'false' - run: | - set -euxo pipefail; - docker save \ - $(derex build openedx --only-print-image-name -t nostatic ${{ inputs.DOCKER_IMAGES_SLUG }}) \ - $(derex build openedx --only-print-image-name -t dev ${{ inputs.DOCKER_IMAGES_SLUG }}) \ - | pixz -0 > ${{ inputs.IMAGE_CACHE_PATH }}/edx-${{ inputs.DOCKER_IMAGES_SLUG }}.tar.xz + - name: Docker images sentinel cache + id: cache-sentinel + uses: actions/cache@v3 + with: + path: $(SENTINEL_CACHE_PATH) + key: SENTINEL=1 | $(DOCKER_IMAGES_SLUG) | $(CACHE_KEY_IMAGES) \ No newline at end of file diff --git a/.github/workflows/juniper.yml b/.github/workflows/juniper.yml deleted file mode 100644 index 62d83e8b..00000000 --- a/.github/workflows/juniper.yml +++ /dev/null @@ -1,15 +0,0 @@ -name: Juniper -on: - push - -jobs: - Juniper: - uses: ./.github/workflows/build.yml - with: - DOCKER_IMAGES_SLUG: juniper - CACHE_KEY_BASE: 22 # Increment this value to reset the images cache - CACHE_KEY_FILES: $GITHUB_WORKSPACE/docker-definition - CACHE_KEY_IMAGES: BASE_SEED=$CACHE_KEY_BASE | $CACHE_KEY_FILES - IMAGE_CACHE_PATH: $GITHUB_WORKSPACE/image_cache - SENTINEL_CACHE_PATH: $GITHUB_WORKSPACE/sentinel_cache - AS_PYTHON_PACKAGE: false \ No newline at end of file diff --git a/.github/workflows/koa.yml b/.github/workflows/koa.yml deleted file mode 100644 index 1f99f151..00000000 --- a/.github/workflows/koa.yml +++ /dev/null @@ -1,17 +0,0 @@ -name: Koa -on: - pull_request: - types: - - opened - -jobs: - Koa: - uses: ./.github/workflows/build.yml - with: - DOCKER_IMAGES_SLUG: koa - CACHE_KEY_BASE: 22 # Increment this value to reset the images cache - CACHE_KEY_FILES: ${{ github.workspace }}/docker-definition - CACHE_KEY_IMAGES: BASE_SEED=$CACHE_KEY_BASE | $CACHE_KEY_FILES - IMAGE_CACHE_PATH: ${{ github.workspace }}/image_cache - SENTINEL_CACHE_PATH: ${{ github.workspace }}/sentinel_cache - AS_PYTHON_PACKAGE: false \ No newline at end of file diff --git a/.github/workflows/lilac.yml b/.github/workflows/lilac.yml deleted file mode 100644 index 7b8ecd44..00000000 --- a/.github/workflows/lilac.yml +++ /dev/null @@ -1,17 +0,0 @@ -name: Lilac -on: - pull_request: - types: - - opened - -jobs: - Lilac: - uses: ./.github/workflows/build.yml - with: - DOCKER_IMAGES_SLUG: lilac - CACHE_KEY_BASE: 22 # Increment this value to reset the images cache - CACHE_KEY_FILES: ${{ github.workspace }}/docker-definition - CACHE_KEY_IMAGES: BASE_SEED=$CACHE_KEY_BASE | $CACHE_KEY_FILES - IMAGE_CACHE_PATH: ${{ github.workspace }}/image_cache - SENTINEL_CACHE_PATH: ${{ github.workspace }}/sentinel_cache - AS_PYTHON_PACKAGE: false \ No newline at end of file From aaf1837d49c181b20ab3937b23a89418dd949fd1 Mon Sep 17 00:00:00 2001 From: serhii Date: Mon, 1 Aug 2022 22:34:21 +0100 Subject: [PATCH 071/145] Build workflow refactoring --- .github/workflows/build.yml | 51 +++++++++++++++++++++++++++++++++++-- 1 file changed, 49 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 54997d07..6acdad12 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -83,8 +83,9 @@ jobs: # it only in a build of the same commit, after tests are passed git rev-parse --verify HEAD > $SENTINEL_CACHE_PATH/built_version - - name: Replace Microsoft docker with upsream docker and create build context - if: env.NEEDS_BUILD != 'false' && success() + + - name: Replace default docker with upsream docker and create build context + if: inputs.NEEDS_BUILD != 'false' run: | set -ex sudo apt-get remove moby-cli -y @@ -95,6 +96,52 @@ jobs: docker version docker buildx create --use docker images + sudo apt-get install pixz -y + - uses: actions/setup-python@v4 + with: + python-version: '3.10' + + - name: Cache pip packages + uses: actions/cache@v3 + with: + path: $GITHUB_WORKSPACE/.cache/pip + key: pipcache | requirements_dev.txt + restore-keys: pipcache + + - name: Install derex.runner + if: inputs.AS_PYTHON_PACKAGE == 'false' && inputs.NEEDS_BUILD != 'false' + run: | + pip3 install --cache-dir $GITHUB_WORKSPACE/.cache/pip -U pip setuptools + pip3 install --cache-dir $GITHUB_WORKSPACE/.cache/pip -r requirements_dev.txt -e . + - name: Install derex.runner as python package + if: inputs.AS_PYTHON_PACKAGE != 'false' && inputs.NEEDS_BUILD != 'false' + run: | + pip3 install --cache-dir $GITHUB_WORKSPACE/.cache/pip -U pip setuptools + pip3 install --cache-dir $GITHUB_WORKSPACE/.cache/pip . + - name: Build nostatic image + if: inputs.NEEDS_BUILD != 'false' + run: derex build openedx --docker-opts "${CACHE_FROM_OPTS} --cache-to=type=inline -o type=docker" --target=nostatic ${{ inputs.DOCKER_IMAGES_SLUG }} + + - name: Build dev image + if: inputs.NEEDS_BUILD != 'false' + run: derex build openedx --docker-opts "--cache-to=type=inline -o type=docker" --target=dev ${{ inputs.DOCKER_IMAGES_SLUG }} + + - name: Check translations + if: inputs.NEEDS_BUILD != 'false' + run: | + docker images + derex build openedx --docker-opts "${CACHE_FROM_OPTS} --output type=docker,name={docker_image_prefix}-{target}" --target=translations ${{ inputs.DOCKER_IMAGES_SLUG }} + docker images + docker run --rm derex/openedx-${{ inputs.DOCKER_IMAGES_SLUG }}-translations:$(grep __version__ derex/runner/__init__.py |sed 's/[^"]*"//;s/"//') sh -c "i18n_tool validate || (find conf|grep prob; find conf|grep prob|xargs cat; false)" || echo "Problems with translations found" + - name: Save images + if: inputs.NEEDS_BUILD != 'false' + run: | + set -euxo pipefail; + docker save \ + $(derex build openedx --only-print-image-name -t nostatic ${{ inputs.DOCKER_IMAGES_SLUG }}) \ + $(derex build openedx --only-print-image-name -t dev ${{ inputs.DOCKER_IMAGES_SLUG }}) \ + | pixz -0 > ${{ inputs.IMAGE_CACHE_PATH }}/edx-${{ inputs.DOCKER_IMAGES_SLUG }}.tar.xz + koa: runs-on: ubuntu-latest timeout-minutes: 180 From 4cfdc8fe91a2a58a3430303937dff8d56ad1f0c6 Mon Sep 17 00:00:00 2001 From: serhii Date: Mon, 1 Aug 2022 22:38:18 +0100 Subject: [PATCH 072/145] Build workflow refactoring --- .github/workflows/build.yml | 37 +++++++++++++++++++++---------------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6acdad12..173a6643 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -7,6 +7,7 @@ env: CACHE_KEY_IMAGES: BASE_SEED=$CACHE_KEY_BASE | $CACHE_KEY_FILES IMAGE_CACHE_PATH: ${{ github.workspace }}/image_cache SENTINEL_CACHE_PATH: ${{ github.workspace }}/sentinel_cache + AS_PYTHON_PACKAGE: false jobs: juniper: @@ -47,7 +48,7 @@ jobs: run: echo "NEEDS_BUILD=true" >> $GITHUB_ENV - name: Remove Haskell compiler and cached apt archives to save disk space - if: env.NEEDS_BUILD != 'false' && success() + if: env.NEEDS_BUILD != 'false' run: df -h; time sudo rm -rf /var/cache/apt/archives /opt/ghc; df -h - name: Prepare Transifex credentials @@ -64,7 +65,7 @@ jobs: TRANSIFEX_PASSWORD: $(TRANSIFEX_PASSWORD) - name: Setup docker images cache - if: env.NEEDS_BUILD != 'false' && success() + if: env.NEEDS_BUILD != 'false' run: | images=$(docker images|grep -v ''|grep derex|awk '{print $1 ":" $2}') CACHE_FROM_OPTS="" @@ -85,7 +86,7 @@ jobs: - name: Replace default docker with upsream docker and create build context - if: inputs.NEEDS_BUILD != 'false' + if: env.NEEDS_BUILD != 'false' run: | set -ex sudo apt-get remove moby-cli -y @@ -97,9 +98,10 @@ jobs: docker buildx create --use docker images sudo apt-get install pixz -y + - uses: actions/setup-python@v4 with: - python-version: '3.10' + python-version: '3.8' - name: Cache pip packages uses: actions/cache@v3 @@ -109,38 +111,41 @@ jobs: restore-keys: pipcache - name: Install derex.runner - if: inputs.AS_PYTHON_PACKAGE == 'false' && inputs.NEEDS_BUILD != 'false' + if: AS_PYTHON_PACKAGE == 'false' && env.NEEDS_BUILD != 'false' run: | pip3 install --cache-dir $GITHUB_WORKSPACE/.cache/pip -U pip setuptools pip3 install --cache-dir $GITHUB_WORKSPACE/.cache/pip -r requirements_dev.txt -e . + - name: Install derex.runner as python package if: inputs.AS_PYTHON_PACKAGE != 'false' && inputs.NEEDS_BUILD != 'false' run: | pip3 install --cache-dir $GITHUB_WORKSPACE/.cache/pip -U pip setuptools pip3 install --cache-dir $GITHUB_WORKSPACE/.cache/pip . + - name: Build nostatic image - if: inputs.NEEDS_BUILD != 'false' - run: derex build openedx --docker-opts "${CACHE_FROM_OPTS} --cache-to=type=inline -o type=docker" --target=nostatic ${{ inputs.DOCKER_IMAGES_SLUG }} + if: env.NEEDS_BUILD != 'false' + run: derex build openedx --docker-opts "${CACHE_FROM_OPTS} --cache-to=type=inline -o type=docker" --target=nostatic $DOCKER_IMAGES_SLUG - name: Build dev image - if: inputs.NEEDS_BUILD != 'false' - run: derex build openedx --docker-opts "--cache-to=type=inline -o type=docker" --target=dev ${{ inputs.DOCKER_IMAGES_SLUG }} + if: env.NEEDS_BUILD != 'false' + run: derex build openedx --docker-opts "--cache-to=type=inline -o type=docker" --target=dev $DOCKER_IMAGES_SLUG - name: Check translations - if: inputs.NEEDS_BUILD != 'false' + if: env.NEEDS_BUILD != 'false' run: | docker images - derex build openedx --docker-opts "${CACHE_FROM_OPTS} --output type=docker,name={docker_image_prefix}-{target}" --target=translations ${{ inputs.DOCKER_IMAGES_SLUG }} + derex build openedx --docker-opts "${CACHE_FROM_OPTS} --output type=docker,name={docker_image_prefix}-{target}" --target=translations $DOCKER_IMAGES_SLUG docker images - docker run --rm derex/openedx-${{ inputs.DOCKER_IMAGES_SLUG }}-translations:$(grep __version__ derex/runner/__init__.py |sed 's/[^"]*"//;s/"//') sh -c "i18n_tool validate || (find conf|grep prob; find conf|grep prob|xargs cat; false)" || echo "Problems with translations found" + docker run --rm derex/openedx-$DOCKER_IMAGES_SLUG-translations:$(grep __version__ derex/runner/__init__.py |sed 's/[^"]*"//;s/"//') sh -c "i18n_tool validate || (find conf|grep prob; find conf|grep prob|xargs cat; false)" || echo "Problems with translations found" + - name: Save images - if: inputs.NEEDS_BUILD != 'false' + if: env.NEEDS_BUILD != 'false' run: | set -euxo pipefail; docker save \ - $(derex build openedx --only-print-image-name -t nostatic ${{ inputs.DOCKER_IMAGES_SLUG }}) \ - $(derex build openedx --only-print-image-name -t dev ${{ inputs.DOCKER_IMAGES_SLUG }}) \ - | pixz -0 > ${{ inputs.IMAGE_CACHE_PATH }}/edx-${{ inputs.DOCKER_IMAGES_SLUG }}.tar.xz + $(derex build openedx --only-print-image-name -t nostatic $DOCKER_IMAGES_SLUG) \ + $(derex build openedx --only-print-image-name -t dev $DOCKER_IMAGES_SLUG) \ + | pixz -0 > $IMAGE_CACHE_PATH/edx-$DOCKER_IMAGES_SLUG.tar.xz koa: runs-on: ubuntu-latest From f61438958a0468b20d255bacd8c0dcbf04e55889 Mon Sep 17 00:00:00 2001 From: serhii Date: Mon, 1 Aug 2022 22:38:56 +0100 Subject: [PATCH 073/145] Build workflow refactoring --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 173a6643..06f79f3b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -117,7 +117,7 @@ jobs: pip3 install --cache-dir $GITHUB_WORKSPACE/.cache/pip -r requirements_dev.txt -e . - name: Install derex.runner as python package - if: inputs.AS_PYTHON_PACKAGE != 'false' && inputs.NEEDS_BUILD != 'false' + if: AS_PYTHON_PACKAGE != 'false' && env.NEEDS_BUILD != 'false' run: | pip3 install --cache-dir $GITHUB_WORKSPACE/.cache/pip -U pip setuptools pip3 install --cache-dir $GITHUB_WORKSPACE/.cache/pip . From 1f8952ca5a233a392c137660482aeb6a119c6a3c Mon Sep 17 00:00:00 2001 From: serhii Date: Mon, 1 Aug 2022 22:40:45 +0100 Subject: [PATCH 074/145] Build workflow refactoring --- .github/workflows/build.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 06f79f3b..3b484fab 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -22,16 +22,16 @@ jobs: id: cache-sentinel uses: actions/cache@v3 with: - path: $(SENTINEL_CACHE_PATH) - key: SENTINEL=1 | $(DOCKER_IMAGES_SLUG) | $(CACHE_KEY_IMAGES) + path: $SENTINEL_CACHE_PATH + key: SENTINEL=1 | $DOCKER_IMAGES_SLUG | $CACHE_KEY_IMAGES - name: Docker images cache if: steps.cache-sentinel.outputs.cache-hit != 'true' uses: actions/cache@v3 with: path: $IMAGE_CACHE_PATH - key: BASE_SEED=$(CACHE_KEY_BASE) | $DOCKER_IMAGES_SLUG | $(CACHE_KEY_IMAGES) - restore-keys: BASE_SEED=$(CACHE_KEY_BASE) | $DOCKER_IMAGES_SLUG + key: BASE_SEED=$CACHE_KEY_BASE | $DOCKER_IMAGES_SLUG | $CACHE_KEY_IMAGES + restore-keys: BASE_SEED=$CACHE_KEY_BASE | $DOCKER_IMAGES_SLUG - name: Load images if: steps.cache-sentinel.outputs.cache-hit != 'true' @@ -111,13 +111,13 @@ jobs: restore-keys: pipcache - name: Install derex.runner - if: AS_PYTHON_PACKAGE == 'false' && env.NEEDS_BUILD != 'false' + if: $AS_PYTHON_PACKAGE == 'false' && env.NEEDS_BUILD != 'false' run: | pip3 install --cache-dir $GITHUB_WORKSPACE/.cache/pip -U pip setuptools pip3 install --cache-dir $GITHUB_WORKSPACE/.cache/pip -r requirements_dev.txt -e . - name: Install derex.runner as python package - if: AS_PYTHON_PACKAGE != 'false' && env.NEEDS_BUILD != 'false' + if: $AS_PYTHON_PACKAGE != 'false' && env.NEEDS_BUILD != 'false' run: | pip3 install --cache-dir $GITHUB_WORKSPACE/.cache/pip -U pip setuptools pip3 install --cache-dir $GITHUB_WORKSPACE/.cache/pip . From 706a7f96dde37fbe5a45aed73a97f700521ab42a Mon Sep 17 00:00:00 2001 From: serhii Date: Mon, 1 Aug 2022 22:41:17 +0100 Subject: [PATCH 075/145] Build workflow refactoring --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3b484fab..f860d9c4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -111,13 +111,13 @@ jobs: restore-keys: pipcache - name: Install derex.runner - if: $AS_PYTHON_PACKAGE == 'false' && env.NEEDS_BUILD != 'false' + if: env.AS_PYTHON_PACKAGE == 'false' && env.NEEDS_BUILD != 'false' run: | pip3 install --cache-dir $GITHUB_WORKSPACE/.cache/pip -U pip setuptools pip3 install --cache-dir $GITHUB_WORKSPACE/.cache/pip -r requirements_dev.txt -e . - name: Install derex.runner as python package - if: $AS_PYTHON_PACKAGE != 'false' && env.NEEDS_BUILD != 'false' + if: env.AS_PYTHON_PACKAGE != 'false' && env.NEEDS_BUILD != 'false' run: | pip3 install --cache-dir $GITHUB_WORKSPACE/.cache/pip -U pip setuptools pip3 install --cache-dir $GITHUB_WORKSPACE/.cache/pip . From d87af6b3fd27e3d74c1a5ce7124f175107be6be8 Mon Sep 17 00:00:00 2001 From: serhii Date: Tue, 2 Aug 2022 12:11:35 +0100 Subject: [PATCH 076/145] Build workflow refactoring --- .github/workflows/build.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f860d9c4..3addae33 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,5 +1,6 @@ name: Build -on: [push] +on: + public env: CACHE_KEY_BASE: 22 # Increment this value to reset the images cache @@ -160,7 +161,7 @@ jobs: uses: actions/cache@v3 with: path: $(SENTINEL_CACHE_PATH) - key: SENTINEL=1 | $(DOCKER_IMAGES_SLUG) | $(CACHE_KEY_IMAGES) + key: SENTINEL=1 | $DOCKER_IMAGES_SLUG | $CACHE_KEY_IMAGES lilac: runs-on: ubuntu-latest @@ -175,4 +176,4 @@ jobs: uses: actions/cache@v3 with: path: $(SENTINEL_CACHE_PATH) - key: SENTINEL=1 | $(DOCKER_IMAGES_SLUG) | $(CACHE_KEY_IMAGES) \ No newline at end of file + key: SENTINEL=1 | $DOCKER_IMAGES_SLUG | $CACHE_KEY_IMAGES \ No newline at end of file From 453502e723d883a9b03238915204210e80a571fc Mon Sep 17 00:00:00 2001 From: serhii Date: Tue, 2 Aug 2022 18:49:26 +0100 Subject: [PATCH 077/145] Add test workflow --- .github/workflows/test.yml | 77 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 77 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 00000000..30cb8387 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,77 @@ +name: Build +on: + push + +env: + PYTEST_ADDOPTS: --cov=derex --cov-report xml --cov-report html --cov-report term --cov-report term-missing --cov-branch --black + AS_PYTHON_PACKAGE: false + +jobs: + test: + runs-on: ubuntu-latest + strategy: + matrix: + release: [ juniper,koa,lilac ] + + steps: + - uses: actions/setup-python@v4 + with: + python-version: '3.8' + + - name: Cache pip packages + uses: actions/cache@v3 + with: + path: $GITHUB_WORKSPACE/.cache/pip + key: pipcache | requirements_dev.txt + restore-keys: pipcache + + - name: Install derex.runner + if: env.AS_PYTHON_PACKAGE == 'false' && env.NEEDS_BUILD != 'false' + run: | + pip3 install --cache-dir $GITHUB_WORKSPACE/.cache/pip -U pip setuptools + pip3 install --cache-dir $GITHUB_WORKSPACE/.cache/pip -r requirements_dev.txt -e . + + - name: Install derex.runner as python package + if: env.AS_PYTHON_PACKAGE != 'false' && env.NEEDS_BUILD != 'false' + run: | + pip3 install --cache-dir $GITHUB_WORKSPACE/.cache/pip -U pip setuptools + pip3 install --cache-dir $GITHUB_WORKSPACE/.cache/pip . + + - name: Build binary with pyinstaller + run: | + pip install pyinstaller + make executable + + - name: Test pyinstaller created binary + run: | + set -ex + ./bundle/dist/derex + ./bundle/dist/ddc-services ps + cd examples/${{ parameters.OPENEDX_RELEASE }}/minimal + ../../../bundle/dist/ddc-project config + + - uses: actions/upload-artifact@v3 + with: + name: LinuxBinary + path: ./bundle/dist/ + + - name: Build binary with pyinstaller + run: | + pip install pyinstaller scrypt + # The Openssl version on MacOS 10.14 does not support scrypt + # so we pip install it and leave a trace to pyinstaller to pick it up + echo -e "\nimport scrypt" >> bundle/executable.py + make executable + + - name: Test pyinstaller created binary + run: | + set -ex + ./bundle/dist/derex --help + ./bundle/dist/ddc-services --help + cd examples/${{ parameters.OPENEDX_RELEASE }}/minimal + ../../../bundle/dist/ddc-project config + + - uses: actions/upload-artifact@v3 + with: + name: MacOSBinary + path: ./bundle/dist/ \ No newline at end of file From d51315547e2d83a4604045d8ec0bd6f1adfe66dc Mon Sep 17 00:00:00 2001 From: serhii Date: Tue, 2 Aug 2022 18:50:30 +0100 Subject: [PATCH 078/145] Add test workflow --- .github/workflows/test.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 30cb8387..b6414f8a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - release: [ juniper,koa,lilac ] + OPENEDX_RELEASE: [ juniper,koa,lilac ] steps: - uses: actions/setup-python@v4 @@ -47,7 +47,7 @@ jobs: set -ex ./bundle/dist/derex ./bundle/dist/ddc-services ps - cd examples/${{ parameters.OPENEDX_RELEASE }}/minimal + cd examples/${{ matrix.OPENEDX_RELEASE }}/minimal ../../../bundle/dist/ddc-project config - uses: actions/upload-artifact@v3 @@ -68,7 +68,7 @@ jobs: set -ex ./bundle/dist/derex --help ./bundle/dist/ddc-services --help - cd examples/${{ parameters.OPENEDX_RELEASE }}/minimal + cd examples/${{ matrix.OPENEDX_RELEASE }}/minimal ../../../bundle/dist/ddc-project config - uses: actions/upload-artifact@v3 From fbb6e73950e019411d17e25112c16b2326c80193 Mon Sep 17 00:00:00 2001 From: serhii Date: Tue, 2 Aug 2022 18:52:05 +0100 Subject: [PATCH 079/145] Add test workflow --- .github/workflows/test.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b6414f8a..17a35a59 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -37,12 +37,12 @@ jobs: pip3 install --cache-dir $GITHUB_WORKSPACE/.cache/pip -U pip setuptools pip3 install --cache-dir $GITHUB_WORKSPACE/.cache/pip . - - name: Build binary with pyinstaller + - name: Build linux binary with pyinstaller run: | pip install pyinstaller make executable - - name: Test pyinstaller created binary + - name: Test pyinstaller created linux binary run: | set -ex ./bundle/dist/derex @@ -55,7 +55,7 @@ jobs: name: LinuxBinary path: ./bundle/dist/ - - name: Build binary with pyinstaller + - name: Build macOS binary with pyinstaller run: | pip install pyinstaller scrypt # The Openssl version on MacOS 10.14 does not support scrypt @@ -63,7 +63,7 @@ jobs: echo -e "\nimport scrypt" >> bundle/executable.py make executable - - name: Test pyinstaller created binary + - name: Test pyinstaller created macOS binary run: | set -ex ./bundle/dist/derex --help From f362f8d933d48f6f22d24a31e9593b357a3a7253 Mon Sep 17 00:00:00 2001 From: serhii Date: Tue, 2 Aug 2022 18:53:10 +0100 Subject: [PATCH 080/145] Add test workflow --- .github/workflows/test.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 17a35a59..221de96b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -14,6 +14,8 @@ jobs: OPENEDX_RELEASE: [ juniper,koa,lilac ] steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 with: python-version: '3.8' From 5270f14f932b9101989ab07b8bd1e234451bc5d2 Mon Sep 17 00:00:00 2001 From: serhii Date: Tue, 2 Aug 2022 19:02:48 +0100 Subject: [PATCH 081/145] Add test workflow --- .github/workflows/test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 221de96b..eb9369cf 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -52,7 +52,7 @@ jobs: cd examples/${{ matrix.OPENEDX_RELEASE }}/minimal ../../../bundle/dist/ddc-project config - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v2.3.1 with: name: LinuxBinary path: ./bundle/dist/ @@ -73,7 +73,7 @@ jobs: cd examples/${{ matrix.OPENEDX_RELEASE }}/minimal ../../../bundle/dist/ddc-project config - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v2.3.1 with: name: MacOSBinary path: ./bundle/dist/ \ No newline at end of file From ba8c173f6d652ed889dc3319518f94115d8e8623 Mon Sep 17 00:00:00 2001 From: serhii Date: Tue, 2 Aug 2022 19:08:36 +0100 Subject: [PATCH 082/145] Add test workflow --- .github/workflows/test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index eb9369cf..2f43481b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -52,7 +52,7 @@ jobs: cd examples/${{ matrix.OPENEDX_RELEASE }}/minimal ../../../bundle/dist/ddc-project config - - uses: actions/upload-artifact@v2.3.1 + - uses: actions/upload-artifact@v2.2.4 with: name: LinuxBinary path: ./bundle/dist/ @@ -73,7 +73,7 @@ jobs: cd examples/${{ matrix.OPENEDX_RELEASE }}/minimal ../../../bundle/dist/ddc-project config - - uses: actions/upload-artifact@v2.3.1 + - uses: actions/upload-artifact@v2.2.4 with: name: MacOSBinary path: ./bundle/dist/ \ No newline at end of file From 37b5cbf47c48feaee5cb4f48a5e7fdbe01a78298 Mon Sep 17 00:00:00 2001 From: serhii Date: Tue, 2 Aug 2022 19:25:06 +0100 Subject: [PATCH 083/145] Add test workflow --- .github/workflows/test.yml | 54 +++++++++++++++++++++++++++++++++++++- 1 file changed, 53 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 2f43481b..97544a0e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -9,6 +9,7 @@ env: jobs: test: runs-on: ubuntu-latest + timeout-minutes: 60 strategy: matrix: OPENEDX_RELEASE: [ juniper,koa,lilac ] @@ -76,4 +77,55 @@ jobs: - uses: actions/upload-artifact@v2.2.4 with: name: MacOSBinary - path: ./bundle/dist/ \ No newline at end of file + path: ./bundle/dist/ + + - name: Run python tests + run: | + set -ex + set -o pipefail + pip3 --cache-dir $GITHUB_WORKSPACE/.cache/pip install scrypt + cd tests + pytest -m "not slowtest" | grep -v codecoveragetool=Cobertura + + - uses: actions/upload-artifact@v2.2.4 + with: + name: fasttests_coverage + path: $GITHUB_WORKSPACE/tests/.coverage + + - name: Docker images cache + if: steps.cache-sentinel.outputs.cache-hit != 'true' + uses: actions/cache@v3 + with: + path: $IMAGE_CACHE_PATH + key: BASE_SEED=$CACHE_KEY_BASE | ${{ matrix.OPENEDX_RELEASE }} | $CACHE_KEY_IMAGES + restore-keys: BASE_SEED=$CACHE_KEY_BASE | ${{ matrix.OPENEDX_RELEASE }} + + - name: Load images + if: steps.cache-sentinel.outputs.cache-hit != 'true' + run: | + [ -d $IMAGE_CACHE_PATH ] || exit 0 + ls -l $IMAGE_CACHE_PATH + docker images + set -euxo pipefail + cat $IMAGE_CACHE_PATH/edx-${{ matrix.OPENEDX_RELEASE }}.tar.xz | unxz | docker load + docker images + + - name: Provision and test services + run: | + ddc-services config + ddc-services pull + set -ex + export DEREX_ADMIN_SERVICES=False + ddc-services up -d + # Give it some seconds to boot + sleep 15 + derex reset-mailslurper + set -o pipefail + cd tests + rm -r $GITHUB_WORKSPACE/tests/.coverage + pytest -m "slowtest" | grep -v codecoveragetool=Cobertura + + - uses: actions/upload-artifact@v2.2.4 + with: + name: slowtests_coverage + path: $GITHUB_WORKSPACE/tests/.coverage \ No newline at end of file From 4ff9f33c940e58bee8a5abba55ce00c001c4bdde Mon Sep 17 00:00:00 2001 From: serhii Date: Tue, 2 Aug 2022 19:30:26 +0100 Subject: [PATCH 084/145] Add test workflow --- .github/workflows/test.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 97544a0e..811635ab 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -117,7 +117,6 @@ jobs: set -ex export DEREX_ADMIN_SERVICES=False ddc-services up -d - # Give it some seconds to boot sleep 15 derex reset-mailslurper set -o pipefail From 61941a4d341838ae32884eddc032d53e298db01a Mon Sep 17 00:00:00 2001 From: serhii Date: Tue, 2 Aug 2022 19:37:10 +0100 Subject: [PATCH 085/145] Add test workflow --- .github/workflows/test.yml | 40 +++++++++++++++++++++++++++++++++++--- 1 file changed, 37 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 811635ab..bcf56a13 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -7,7 +7,7 @@ env: AS_PYTHON_PACKAGE: false jobs: - test: + RunPytests: runs-on: ubuntu-latest timeout-minutes: 60 strategy: @@ -92,6 +92,37 @@ jobs: name: fasttests_coverage path: $GITHUB_WORKSPACE/tests/.coverage + RunSlowPytests: + runs-on: ubuntu-latest + timeout-minutes: 60 + strategy: + matrix: + OPENEDX_RELEASE: [ juniper,koa,lilac ] + + steps: + - uses: actions/setup-python@v4 + with: + python-version: '3.8' + + - name: Cache pip packages + uses: actions/cache@v3 + with: + path: $GITHUB_WORKSPACE/.cache/pip + key: pipcache | requirements_dev.txt + restore-keys: pipcache + + - name: Install derex.runner + if: env.AS_PYTHON_PACKAGE == 'false' && env.NEEDS_BUILD != 'false' + run: | + pip3 install --cache-dir $GITHUB_WORKSPACE/.cache/pip -U pip setuptools + pip3 install --cache-dir $GITHUB_WORKSPACE/.cache/pip -r requirements_dev.txt -e . + + - name: Install derex.runner as python package + if: env.AS_PYTHON_PACKAGE != 'false' && env.NEEDS_BUILD != 'false' + run: | + pip3 install --cache-dir $GITHUB_WORKSPACE/.cache/pip -U pip setuptools + pip3 install --cache-dir $GITHUB_WORKSPACE/.cache/pip . + - name: Docker images cache if: steps.cache-sentinel.outputs.cache-hit != 'true' uses: actions/cache@v3 @@ -110,7 +141,7 @@ jobs: cat $IMAGE_CACHE_PATH/edx-${{ matrix.OPENEDX_RELEASE }}.tar.xz | unxz | docker load docker images - - name: Provision and test services + - name: Provision services run: | ddc-services config ddc-services pull @@ -119,9 +150,12 @@ jobs: ddc-services up -d sleep 15 derex reset-mailslurper + + - name: Run python tests + run: | + set -ex set -o pipefail cd tests - rm -r $GITHUB_WORKSPACE/tests/.coverage pytest -m "slowtest" | grep -v codecoveragetool=Cobertura - uses: actions/upload-artifact@v2.2.4 From d1605aec88983a8ae9a59d77f836bf76e6c7ed8d Mon Sep 17 00:00:00 2001 From: serhii Date: Tue, 2 Aug 2022 19:43:54 +0100 Subject: [PATCH 086/145] Add test workflow --- .github/workflows/test.yml | 37 ++++++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index bcf56a13..c3d046b5 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -11,6 +11,7 @@ jobs: runs-on: ubuntu-latest timeout-minutes: 60 strategy: + fail-fast: false matrix: OPENEDX_RELEASE: [ juniper,koa,lilac ] @@ -96,10 +97,13 @@ jobs: runs-on: ubuntu-latest timeout-minutes: 60 strategy: + fail-fast: false matrix: OPENEDX_RELEASE: [ juniper,koa,lilac ] steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 with: python-version: '3.8' @@ -161,4 +165,35 @@ jobs: - uses: actions/upload-artifact@v2.2.4 with: name: slowtests_coverage - path: $GITHUB_WORKSPACE/tests/.coverage \ No newline at end of file + path: $GITHUB_WORKSPACE/tests/.coverage + + CombineCoverage: + runs-on: ubuntu-latest + timeout-minutes: 10 + needs: [RunPytests,RunSlowPytests] + + steps: + - uses: actions/checkout@v3 + + - uses: actions/setup-python@v4 + with: + python-version: '3.8' + + - name: Cache pip packages + uses: actions/cache@v3 + with: + path: $GITHUB_WORKSPACE/.cache/pip + key: pipcache | requirements_dev.txt + restore-keys: pipcache + + - name: Install derex.runner + if: env.AS_PYTHON_PACKAGE == 'false' && env.NEEDS_BUILD != 'false' + run: | + pip3 install --cache-dir $GITHUB_WORKSPACE/.cache/pip -U pip setuptools + pip3 install --cache-dir $GITHUB_WORKSPACE/.cache/pip -r requirements_dev.txt -e . + + - name: Install derex.runner as python package + if: env.AS_PYTHON_PACKAGE != 'false' && env.NEEDS_BUILD != 'false' + run: | + pip3 install --cache-dir $GITHUB_WORKSPACE/.cache/pip -U pip setuptools + pip3 install --cache-dir $GITHUB_WORKSPACE/.cache/pip . \ No newline at end of file From ded302d29eb00db872e043740a06ab811c4f91ad Mon Sep 17 00:00:00 2001 From: serhii Date: Tue, 2 Aug 2022 19:46:02 +0100 Subject: [PATCH 087/145] Add test workflow --- .github/workflows/test.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c3d046b5..8c624c35 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -3,8 +3,13 @@ on: push env: - PYTEST_ADDOPTS: --cov=derex --cov-report xml --cov-report html --cov-report term --cov-report term-missing --cov-branch --black + CACHE_KEY_BASE: 22 # Increment this value to reset the images cache + CACHE_KEY_FILES: ${{ github.workspace }}/docker-definition + CACHE_KEY_IMAGES: BASE_SEED=$CACHE_KEY_BASE | $CACHE_KEY_FILES + IMAGE_CACHE_PATH: ${{ github.workspace }}/image_cache + SENTINEL_CACHE_PATH: ${{ github.workspace }}/sentinel_cache AS_PYTHON_PACKAGE: false + PYTEST_ADDOPTS: --cov=derex --cov-report xml --cov-report html --cov-report term --cov-report term-missing --cov-branch --black jobs: RunPytests: From 81d06b4154897b40ec8ea0cc530eceb59db23933 Mon Sep 17 00:00:00 2001 From: serhii Date: Tue, 2 Aug 2022 20:01:02 +0100 Subject: [PATCH 088/145] Add test workflow --- .github/workflows/test.yml | 38 ++++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 8c624c35..cfebe84d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -30,21 +30,21 @@ jobs: - name: Cache pip packages uses: actions/cache@v3 with: - path: $GITHUB_WORKSPACE/.cache/pip + path: ${{ github.workspace }}/.cache/pip key: pipcache | requirements_dev.txt restore-keys: pipcache - name: Install derex.runner if: env.AS_PYTHON_PACKAGE == 'false' && env.NEEDS_BUILD != 'false' run: | - pip3 install --cache-dir $GITHUB_WORKSPACE/.cache/pip -U pip setuptools - pip3 install --cache-dir $GITHUB_WORKSPACE/.cache/pip -r requirements_dev.txt -e . + pip3 install --cache-dir ${{ github.workspace }}/.cache/pip -U pip setuptools + pip3 install --cache-dir ${{ github.workspace }}/.cache/pip -r requirements_dev.txt -e . - name: Install derex.runner as python package if: env.AS_PYTHON_PACKAGE != 'false' && env.NEEDS_BUILD != 'false' run: | - pip3 install --cache-dir $GITHUB_WORKSPACE/.cache/pip -U pip setuptools - pip3 install --cache-dir $GITHUB_WORKSPACE/.cache/pip . + pip3 install --cache-dir ${{ github.workspace }}/.cache/pip -U pip setuptools + pip3 install --cache-dir ${{ github.workspace }}/.cache/pip . - name: Build linux binary with pyinstaller run: | @@ -89,14 +89,14 @@ jobs: run: | set -ex set -o pipefail - pip3 --cache-dir $GITHUB_WORKSPACE/.cache/pip install scrypt + pip3 --cache-dir ${{ github.workspace }}/.cache/pip install scrypt cd tests pytest -m "not slowtest" | grep -v codecoveragetool=Cobertura - uses: actions/upload-artifact@v2.2.4 with: name: fasttests_coverage - path: $GITHUB_WORKSPACE/tests/.coverage + path: ${{ github.workspace }}/tests/.coverage RunSlowPytests: runs-on: ubuntu-latest @@ -116,21 +116,21 @@ jobs: - name: Cache pip packages uses: actions/cache@v3 with: - path: $GITHUB_WORKSPACE/.cache/pip + path: ${{ github.workspace }}/.cache/pip key: pipcache | requirements_dev.txt restore-keys: pipcache - name: Install derex.runner if: env.AS_PYTHON_PACKAGE == 'false' && env.NEEDS_BUILD != 'false' run: | - pip3 install --cache-dir $GITHUB_WORKSPACE/.cache/pip -U pip setuptools - pip3 install --cache-dir $GITHUB_WORKSPACE/.cache/pip -r requirements_dev.txt -e . + pip3 install --cache-dir ${{ github.workspace }}/.cache/pip -U pip setuptools + pip3 install --cache-dir ${{ github.workspace }}/.cache/pip -r requirements_dev.txt -e . - name: Install derex.runner as python package if: env.AS_PYTHON_PACKAGE != 'false' && env.NEEDS_BUILD != 'false' run: | - pip3 install --cache-dir $GITHUB_WORKSPACE/.cache/pip -U pip setuptools - pip3 install --cache-dir $GITHUB_WORKSPACE/.cache/pip . + pip3 install --cache-dir ${{ github.workspace }}/.cache/pip -U pip setuptools + pip3 install --cache-dir ${{ github.workspace }}/.cache/pip . - name: Docker images cache if: steps.cache-sentinel.outputs.cache-hit != 'true' @@ -170,7 +170,7 @@ jobs: - uses: actions/upload-artifact@v2.2.4 with: name: slowtests_coverage - path: $GITHUB_WORKSPACE/tests/.coverage + path: ${{ github.workspace }}/tests/.coverage CombineCoverage: runs-on: ubuntu-latest @@ -187,18 +187,20 @@ jobs: - name: Cache pip packages uses: actions/cache@v3 with: - path: $GITHUB_WORKSPACE/.cache/pip + path: ${{ github.workspace }}/.cache/pip key: pipcache | requirements_dev.txt restore-keys: pipcache - name: Install derex.runner if: env.AS_PYTHON_PACKAGE == 'false' && env.NEEDS_BUILD != 'false' run: | - pip3 install --cache-dir $GITHUB_WORKSPACE/.cache/pip -U pip setuptools - pip3 install --cache-dir $GITHUB_WORKSPACE/.cache/pip -r requirements_dev.txt -e . + pip3 install --cache-dir ${{ github.workspace }}/.cache/pip -U pip setuptools + pip3 install --cache-dir ${{ github.workspace }}/.cache/pip -r requirements_dev.txt -e . - name: Install derex.runner as python package if: env.AS_PYTHON_PACKAGE != 'false' && env.NEEDS_BUILD != 'false' run: | - pip3 install --cache-dir $GITHUB_WORKSPACE/.cache/pip -U pip setuptools - pip3 install --cache-dir $GITHUB_WORKSPACE/.cache/pip . \ No newline at end of file + pip3 install --cache-dir ${{ github.workspace }}/.cache/pip -U pip setuptools + pip3 install --cache-dir ${{ github.workspace }}/.cache/pip . + + - uses: actions/download-artifact@v3 From 6a76a6699eecd858333642ff363b9e2f7f622573 Mon Sep 17 00:00:00 2001 From: serhii Date: Tue, 2 Aug 2022 20:15:42 +0100 Subject: [PATCH 089/145] Add test workflow --- .github/workflows/test.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index cfebe84d..f951afbd 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -65,6 +65,7 @@ jobs: path: ./bundle/dist/ - name: Build macOS binary with pyinstaller + if: always() run: | pip install pyinstaller scrypt # The Openssl version on MacOS 10.14 does not support scrypt @@ -73,6 +74,7 @@ jobs: make executable - name: Test pyinstaller created macOS binary + if: always() run: | set -ex ./bundle/dist/derex --help @@ -81,11 +83,13 @@ jobs: ../../../bundle/dist/ddc-project config - uses: actions/upload-artifact@v2.2.4 + if: always() with: name: MacOSBinary path: ./bundle/dist/ - name: Run python tests + if: always() run: | set -ex set -o pipefail @@ -94,6 +98,7 @@ jobs: pytest -m "not slowtest" | grep -v codecoveragetool=Cobertura - uses: actions/upload-artifact@v2.2.4 + if: always() with: name: fasttests_coverage path: ${{ github.workspace }}/tests/.coverage From 7bbc75bb8f9d90a6b25b6978c135d1dca276c1e9 Mon Sep 17 00:00:00 2001 From: serhii Date: Tue, 2 Aug 2022 20:29:15 +0100 Subject: [PATCH 090/145] Add test workflow --- .github/workflows/test.yml | 38 +++++++++++++++++++++++++++++++++----- 1 file changed, 33 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f951afbd..74e36b3b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -63,9 +63,9 @@ jobs: with: name: LinuxBinary path: ./bundle/dist/ + continue-on-error: true - name: Build macOS binary with pyinstaller - if: always() run: | pip install pyinstaller scrypt # The Openssl version on MacOS 10.14 does not support scrypt @@ -74,7 +74,6 @@ jobs: make executable - name: Test pyinstaller created macOS binary - if: always() run: | set -ex ./bundle/dist/derex --help @@ -83,13 +82,12 @@ jobs: ../../../bundle/dist/ddc-project config - uses: actions/upload-artifact@v2.2.4 - if: always() with: name: MacOSBinary path: ./bundle/dist/ + continue-on-error: true - name: Run python tests - if: always() run: | set -ex set -o pipefail @@ -98,10 +96,10 @@ jobs: pytest -m "not slowtest" | grep -v codecoveragetool=Cobertura - uses: actions/upload-artifact@v2.2.4 - if: always() with: name: fasttests_coverage path: ${{ github.workspace }}/tests/.coverage + continue-on-error: true RunSlowPytests: runs-on: ubuntu-latest @@ -176,6 +174,7 @@ jobs: with: name: slowtests_coverage path: ${{ github.workspace }}/tests/.coverage + continue-on-error: true CombineCoverage: runs-on: ubuntu-latest @@ -209,3 +208,32 @@ jobs: pip3 install --cache-dir ${{ github.workspace }}/.cache/pip . - uses: actions/download-artifact@v3 + + - name: Cache npm packages + uses: actions/cache@v3 + with: + path: $GITHUB_WORKSPACE/.cache/npm + key: npmcache2 + + - name: Fix coverage result and publish it + if: always() + run: | + set -ex + cp ${{ github.workspace }}/slowtests_coverage/.coverage tests/.coverage.slow + cp ${{ github.workspace }}/fasttests_coverage/.coverage tests/.coverage.fast + cd tests + coverage combine + coverage html + coverage xml + cd .. + # We installed the package with pip, and coverage reports the full absolute path. + # We cut to derex/runner/etc/etc + DEREX_RUNNER_PATH=`cd tests;python -c "from pathlib import Path; import derex.runner;print(Path(derex.runner.__file__).parent.parent.parent)"` + echo Replacing ${DEREX_RUNNER_PATH} in tests/htmlcov/*.html + sudo npm config set cache ${{ github.workspace }}/.cache/npm --global + npm install juice + # Azure pipelines strips style sheets but leaves styles in place. + # juice can embed the styles in the HTML for us and present a much better + # view in the coverage results tab. + for filename in tests/htmlcov/*.html; do $(npm bin)/juice $filename $filename; done + codecoverage.publish codecoveragetool=Cobertura;summaryfile=${PWD}/tests/coverage.xml;reportdirectory=${PWD}/tests/htmlcov; From fee9560cfceb11578b79cb4742bf20eb432e6065 Mon Sep 17 00:00:00 2001 From: serhii Date: Tue, 2 Aug 2022 20:40:19 +0100 Subject: [PATCH 091/145] Add test workflow --- .github/workflows/test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 74e36b3b..eabce58a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -208,6 +208,7 @@ jobs: pip3 install --cache-dir ${{ github.workspace }}/.cache/pip . - uses: actions/download-artifact@v3 + continue-on-error: true - name: Cache npm packages uses: actions/cache@v3 From 38cf8435c69e5ef20a1164552d5d2f37abf917d8 Mon Sep 17 00:00:00 2001 From: serhii Date: Tue, 2 Aug 2022 20:57:46 +0100 Subject: [PATCH 092/145] Add test workflow --- .github/workflows/test.yml | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index eabce58a..d942f174 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -11,10 +11,36 @@ env: AS_PYTHON_PACKAGE: false PYTEST_ADDOPTS: --cov=derex --cov-report xml --cov-report html --cov-report term --cov-report term-missing --cov-branch --black + jobs: + CheckDocsAndPreCommit: + runs-on: ubuntu-latest + timeout-minutes: 10 + + steps: + - uses: actions/checkout@v3 + + - uses: actions/setup-python@v4 + with: + python-version: '3.8' + + - name: Cache pip packages + uses: actions/cache@v3 + with: + path: ${{ github.workspace }}/.cache/pip + key: pipcache | requirements_dev.txt + restore-keys: pipcache + + - name: Compile docs + run: make docs + + - name: Check pre-commit hooks + run: pre-commit -a + RunPytests: runs-on: ubuntu-latest timeout-minutes: 60 + needs: [ CheckDocsAndPreCommit ] strategy: fail-fast: false matrix: @@ -104,6 +130,7 @@ jobs: RunSlowPytests: runs-on: ubuntu-latest timeout-minutes: 60 + needs: [ CheckDocsAndPreCommit ] strategy: fail-fast: false matrix: @@ -208,6 +235,11 @@ jobs: pip3 install --cache-dir ${{ github.workspace }}/.cache/pip . - uses: actions/download-artifact@v3 + with: + name: + - fasttests_coverage + - slowtests_coverage + continue-on-error: true - name: Cache npm packages From 83a82cf691945b6445b71804504ef29771f89bd7 Mon Sep 17 00:00:00 2001 From: serhii Date: Tue, 2 Aug 2022 20:58:42 +0100 Subject: [PATCH 093/145] Add test workflow --- .github/workflows/test.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d942f174..ac852fdd 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -236,11 +236,11 @@ jobs: - uses: actions/download-artifact@v3 with: - name: - - fasttests_coverage - - slowtests_coverage + name: fasttests_coverage - continue-on-error: true + - uses: actions/download-artifact@v3 + with: + name: slowtests_coverage - name: Cache npm packages uses: actions/cache@v3 From 5c328ebf49caf44b17d83c152d3fbc0882a56ef0 Mon Sep 17 00:00:00 2001 From: serhii Date: Tue, 2 Aug 2022 21:00:10 +0100 Subject: [PATCH 094/145] Add test workflow --- .github/workflows/test.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ac852fdd..ad5079e4 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -31,6 +31,18 @@ jobs: key: pipcache | requirements_dev.txt restore-keys: pipcache + - name: Install derex.runner + if: env.AS_PYTHON_PACKAGE == 'false' && env.NEEDS_BUILD != 'false' + run: | + pip3 install --cache-dir ${{ github.workspace }}/.cache/pip -U pip setuptools + pip3 install --cache-dir ${{ github.workspace }}/.cache/pip -r requirements_dev.txt -e . + + - name: Install derex.runner as python package + if: env.AS_PYTHON_PACKAGE != 'false' && env.NEEDS_BUILD != 'false' + run: | + pip3 install --cache-dir ${{ github.workspace }}/.cache/pip -U pip setuptools + pip3 install --cache-dir ${{ github.workspace }}/.cache/pip . + - name: Compile docs run: make docs From e64678307a671b8f3df89f4a632411838b74c880 Mon Sep 17 00:00:00 2001 From: serhii Date: Tue, 2 Aug 2022 21:02:47 +0100 Subject: [PATCH 095/145] Add test workflow --- .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 ad5079e4..a1e464bc 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -47,7 +47,7 @@ jobs: run: make docs - name: Check pre-commit hooks - run: pre-commit -a + run: pre-commit run -a RunPytests: runs-on: ubuntu-latest From c9844c3a6c6bc8966a42e38e3a70b49fe237111e Mon Sep 17 00:00:00 2001 From: serhii Date: Tue, 2 Aug 2022 21:06:47 +0100 Subject: [PATCH 096/145] Add test workflow --- .github/workflows/build.yml | 8 +++----- .github/workflows/test.yml | 24 +++++++++++------------- 2 files changed, 14 insertions(+), 18 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3addae33..f1cec822 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,6 +1,5 @@ name: Build -on: - public +on: public env: CACHE_KEY_BASE: 22 # Increment this value to reset the images cache @@ -85,7 +84,6 @@ jobs: # it only in a build of the same commit, after tests are passed git rev-parse --verify HEAD > $SENTINEL_CACHE_PATH/built_version - - name: Replace default docker with upsream docker and create build context if: env.NEEDS_BUILD != 'false' run: | @@ -102,7 +100,7 @@ jobs: - uses: actions/setup-python@v4 with: - python-version: '3.8' + python-version: "3.8" - name: Cache pip packages uses: actions/cache@v3 @@ -176,4 +174,4 @@ jobs: uses: actions/cache@v3 with: path: $(SENTINEL_CACHE_PATH) - key: SENTINEL=1 | $DOCKER_IMAGES_SLUG | $CACHE_KEY_IMAGES \ No newline at end of file + key: SENTINEL=1 | $DOCKER_IMAGES_SLUG | $CACHE_KEY_IMAGES diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a1e464bc..0686ca3b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,6 +1,5 @@ name: Build -on: - push +on: push env: CACHE_KEY_BASE: 22 # Increment this value to reset the images cache @@ -11,7 +10,6 @@ env: AS_PYTHON_PACKAGE: false PYTEST_ADDOPTS: --cov=derex --cov-report xml --cov-report html --cov-report term --cov-report term-missing --cov-branch --black - jobs: CheckDocsAndPreCommit: runs-on: ubuntu-latest @@ -22,7 +20,7 @@ jobs: - uses: actions/setup-python@v4 with: - python-version: '3.8' + python-version: "3.8" - name: Cache pip packages uses: actions/cache@v3 @@ -52,18 +50,18 @@ jobs: RunPytests: runs-on: ubuntu-latest timeout-minutes: 60 - needs: [ CheckDocsAndPreCommit ] + needs: [CheckDocsAndPreCommit] strategy: fail-fast: false matrix: - OPENEDX_RELEASE: [ juniper,koa,lilac ] + OPENEDX_RELEASE: [juniper, koa, lilac] steps: - uses: actions/checkout@v3 - uses: actions/setup-python@v4 with: - python-version: '3.8' + python-version: "3.8" - name: Cache pip packages uses: actions/cache@v3 @@ -132,7 +130,7 @@ jobs: pip3 --cache-dir ${{ github.workspace }}/.cache/pip install scrypt cd tests pytest -m "not slowtest" | grep -v codecoveragetool=Cobertura - + - uses: actions/upload-artifact@v2.2.4 with: name: fasttests_coverage @@ -142,18 +140,18 @@ jobs: RunSlowPytests: runs-on: ubuntu-latest timeout-minutes: 60 - needs: [ CheckDocsAndPreCommit ] + needs: [CheckDocsAndPreCommit] strategy: fail-fast: false matrix: - OPENEDX_RELEASE: [ juniper,koa,lilac ] + OPENEDX_RELEASE: [juniper, koa, lilac] steps: - uses: actions/checkout@v3 - uses: actions/setup-python@v4 with: - python-version: '3.8' + python-version: "3.8" - name: Cache pip packages uses: actions/cache@v3 @@ -218,14 +216,14 @@ jobs: CombineCoverage: runs-on: ubuntu-latest timeout-minutes: 10 - needs: [RunPytests,RunSlowPytests] + needs: [RunPytests, RunSlowPytests] steps: - uses: actions/checkout@v3 - uses: actions/setup-python@v4 with: - python-version: '3.8' + python-version: "3.8" - name: Cache pip packages uses: actions/cache@v3 From 56cdef93df3bf482e8838f6a14d70c252781d912 Mon Sep 17 00:00:00 2001 From: serhii Date: Tue, 2 Aug 2022 21:34:53 +0100 Subject: [PATCH 097/145] Add test workflow --- .github/workflows/test.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 0686ca3b..3f1c7d7c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -13,7 +13,7 @@ env: jobs: CheckDocsAndPreCommit: runs-on: ubuntu-latest - timeout-minutes: 10 + timeout-minutes: 5 steps: - uses: actions/checkout@v3 @@ -262,8 +262,8 @@ jobs: if: always() run: | set -ex - cp ${{ github.workspace }}/slowtests_coverage/.coverage tests/.coverage.slow - cp ${{ github.workspace }}/fasttests_coverage/.coverage tests/.coverage.fast + cp ${{ github.workspace }}/.coverage tests/.coverage.slow + cp ${{ github.workspace }}/.coverage tests/.coverage.fast cd tests coverage combine coverage html From 29a4b14906842b26b8a6d42fd630a47894c99152 Mon Sep 17 00:00:00 2001 From: serhii Date: Wed, 3 Aug 2022 12:08:15 +0100 Subject: [PATCH 098/145] Code coverage report --- .github/workflows/test.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 3f1c7d7c..73fff8ad 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -279,4 +279,8 @@ jobs: # juice can embed the styles in the HTML for us and present a much better # view in the coverage results tab. for filename in tests/htmlcov/*.html; do $(npm bin)/juice $filename $filename; done - codecoverage.publish codecoveragetool=Cobertura;summaryfile=${PWD}/tests/coverage.xml;reportdirectory=${PWD}/tests/htmlcov; + + - name: Code coverage summary report + uses: irongut/CodeCoverageSummary@v1.3.0 + with: + filename: coverage.xml \ No newline at end of file From 1eeb1ea21bbc71493ec8d2933485d059c54e6868 Mon Sep 17 00:00:00 2001 From: serhii Date: Wed, 3 Aug 2022 12:10:37 +0100 Subject: [PATCH 099/145] Code coverage report --- .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 73fff8ad..d15bac7f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -283,4 +283,4 @@ jobs: - name: Code coverage summary report uses: irongut/CodeCoverageSummary@v1.3.0 with: - filename: coverage.xml \ No newline at end of file + filename: coverage.xml From 2737913450774c93924c6ad00cf0cb965c5c7d61 Mon Sep 17 00:00:00 2001 From: serhii Date: Wed, 3 Aug 2022 12:25:58 +0100 Subject: [PATCH 100/145] Code coverage report --- .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 d15bac7f..2bd7e020 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -283,4 +283,4 @@ jobs: - name: Code coverage summary report uses: irongut/CodeCoverageSummary@v1.3.0 with: - filename: coverage.xml + filename: ${{ github.workspace }}/tests/coverage.xml From ca84485c919026b475024a0ef190b18d950fc4e3 Mon Sep 17 00:00:00 2001 From: serhii Date: Wed, 3 Aug 2022 12:43:14 +0100 Subject: [PATCH 101/145] Code coverage report --- .github/workflows/test.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 2bd7e020..015a66ab 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -279,6 +279,10 @@ jobs: # juice can embed the styles in the HTML for us and present a much better # view in the coverage results tab. for filename in tests/htmlcov/*.html; do $(npm bin)/juice $filename $filename; done + ls -la + ls -la ${{ github.workspace }} + ls -la ${{ github.workspace }}/tests/ + ls -la ${{ github.workspace }}/tests/htmlcov/ - name: Code coverage summary report uses: irongut/CodeCoverageSummary@v1.3.0 From 7e526bc1f1dce8ac354d66e1898c8a831c73e799 Mon Sep 17 00:00:00 2001 From: serhii Date: Wed, 3 Aug 2022 12:59:24 +0100 Subject: [PATCH 102/145] Code coverage report --- .github/workflows/test.yml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 015a66ab..22610e64 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -279,12 +279,8 @@ jobs: # juice can embed the styles in the HTML for us and present a much better # view in the coverage results tab. for filename in tests/htmlcov/*.html; do $(npm bin)/juice $filename $filename; done - ls -la - ls -la ${{ github.workspace }} - ls -la ${{ github.workspace }}/tests/ - ls -la ${{ github.workspace }}/tests/htmlcov/ - name: Code coverage summary report uses: irongut/CodeCoverageSummary@v1.3.0 with: - filename: ${{ github.workspace }}/tests/coverage.xml + filename: ${{ github.workspace }}/tests/htmlcov/coverage.xml From efddf6386c28a17159b99b064845e9a570123ed5 Mon Sep 17 00:00:00 2001 From: serhii Date: Wed, 3 Aug 2022 13:30:28 +0100 Subject: [PATCH 103/145] Code coverage report --- .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 22610e64..7044c9ee 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -283,4 +283,4 @@ jobs: - name: Code coverage summary report uses: irongut/CodeCoverageSummary@v1.3.0 with: - filename: ${{ github.workspace }}/tests/htmlcov/coverage.xml + filename: ${{ github.workspace }}/tests/htmlcov/coverage From b999e5413237f0ba7aee28e3c12af5a3c5838309 Mon Sep 17 00:00:00 2001 From: serhii Date: Wed, 3 Aug 2022 13:44:56 +0100 Subject: [PATCH 104/145] Code coverage report --- .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 7044c9ee..14d21495 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -283,4 +283,4 @@ jobs: - name: Code coverage summary report uses: irongut/CodeCoverageSummary@v1.3.0 with: - filename: ${{ github.workspace }}/tests/htmlcov/coverage + filename: ${{ github.workspace }}/tests/htmlcov/.coverage From f8badfd8eec251e6688b00d1feb9565cda8ae335 Mon Sep 17 00:00:00 2001 From: serhii Date: Wed, 3 Aug 2022 14:10:56 +0100 Subject: [PATCH 105/145] Code coverage report --- .github/workflows/test.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 14d21495..955e0766 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -279,8 +279,13 @@ jobs: # juice can embed the styles in the HTML for us and present a much better # view in the coverage results tab. for filename in tests/htmlcov/*.html; do $(npm bin)/juice $filename $filename; done + pwd + ls -la + ls -la ${{ github.workspace }} + ls -la ${{ github.workspace }}/tests/ + ls -la ${{ github.workspace }}/tests/tests/ - name: Code coverage summary report uses: irongut/CodeCoverageSummary@v1.3.0 with: - filename: ${{ github.workspace }}/tests/htmlcov/.coverage + filename: ${{ github.workspace }}/tests/tests/coverage.xml From 7c818eb496ae58b3b0576a3dc81352ad0cdda6d5 Mon Sep 17 00:00:00 2001 From: serhii Date: Wed, 3 Aug 2022 14:24:49 +0100 Subject: [PATCH 106/145] Code coverage report --- .github/workflows/test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 955e0766..abcb7261 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -283,9 +283,9 @@ jobs: ls -la ls -la ${{ github.workspace }} ls -la ${{ github.workspace }}/tests/ - ls -la ${{ github.workspace }}/tests/tests/ + ls -la ${{ github.workspace }}/tests/htmlcov/tests/ - name: Code coverage summary report uses: irongut/CodeCoverageSummary@v1.3.0 with: - filename: ${{ github.workspace }}/tests/tests/coverage.xml + filename: ${{ github.workspace }}/tests/htmlcov/tests/coverage.xml From f007b9933efc3565242fa83ae6e3b12e370843bf Mon Sep 17 00:00:00 2001 From: serhii Date: Wed, 3 Aug 2022 14:37:07 +0100 Subject: [PATCH 107/145] Code coverage report --- .github/workflows/test.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index abcb7261..5953fe51 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -283,9 +283,8 @@ jobs: ls -la ls -la ${{ github.workspace }} ls -la ${{ github.workspace }}/tests/ - ls -la ${{ github.workspace }}/tests/htmlcov/tests/ - name: Code coverage summary report uses: irongut/CodeCoverageSummary@v1.3.0 with: - filename: ${{ github.workspace }}/tests/htmlcov/tests/coverage.xml + filename: ${{ github.workspace }}/tests/coverage.xml From c49e7c0030170f9d624cb732d1e99157e4b44902 Mon Sep 17 00:00:00 2001 From: serhii Date: Wed, 3 Aug 2022 15:03:05 +0100 Subject: [PATCH 108/145] Code coverage report --- .github/workflows/test.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 5953fe51..a46067d3 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -279,12 +279,10 @@ jobs: # juice can embed the styles in the HTML for us and present a much better # view in the coverage results tab. for filename in tests/htmlcov/*.html; do $(npm bin)/juice $filename $filename; done - pwd - ls -la - ls -la ${{ github.workspace }} ls -la ${{ github.workspace }}/tests/ + cp tests/coverage.xml ${{ github.workspace }} - name: Code coverage summary report uses: irongut/CodeCoverageSummary@v1.3.0 with: - filename: ${{ github.workspace }}/tests/coverage.xml + filename: coverage.xml From 3603dbb956a3a20a1108b9c88fd963116948a301 Mon Sep 17 00:00:00 2001 From: serhii Date: Wed, 3 Aug 2022 15:17:14 +0100 Subject: [PATCH 109/145] Code coverage report --- .github/workflows/test.yml | 44 +++++++++++++++++++++++++++++++++----- 1 file changed, 39 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a46067d3..2c03f593 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -47,9 +47,9 @@ jobs: - name: Check pre-commit hooks run: pre-commit run -a - RunPytests: + BuildBinaries: runs-on: ubuntu-latest - timeout-minutes: 60 + timeout-minutes: 20 needs: [CheckDocsAndPreCommit] strategy: fail-fast: false @@ -123,6 +123,41 @@ jobs: path: ./bundle/dist/ continue-on-error: true + RunPytests: + runs-on: ubuntu-latest + timeout-minutes: 20 + needs: [BuildBinaries] + strategy: + fail-fast: false + matrix: + OPENEDX_RELEASE: [juniper, koa, lilac] + + steps: + - uses: actions/checkout@v3 + + - uses: actions/setup-python@v4 + with: + python-version: "3.8" + + - name: Cache pip packages + uses: actions/cache@v3 + with: + path: ${{ github.workspace }}/.cache/pip + key: pipcache | requirements_dev.txt + restore-keys: pipcache + + - name: Install derex.runner + if: env.AS_PYTHON_PACKAGE == 'false' && env.NEEDS_BUILD != 'false' + run: | + pip3 install --cache-dir ${{ github.workspace }}/.cache/pip -U pip setuptools + pip3 install --cache-dir ${{ github.workspace }}/.cache/pip -r requirements_dev.txt -e . + + - name: Install derex.runner as python package + if: env.AS_PYTHON_PACKAGE != 'false' && env.NEEDS_BUILD != 'false' + run: | + pip3 install --cache-dir ${{ github.workspace }}/.cache/pip -U pip setuptools + pip3 install --cache-dir ${{ github.workspace }}/.cache/pip . + - name: Run python tests run: | set -ex @@ -139,8 +174,8 @@ jobs: RunSlowPytests: runs-on: ubuntu-latest - timeout-minutes: 60 - needs: [CheckDocsAndPreCommit] + timeout-minutes: 20 + needs: [RunPytests] strategy: fail-fast: false matrix: @@ -279,7 +314,6 @@ jobs: # juice can embed the styles in the HTML for us and present a much better # view in the coverage results tab. for filename in tests/htmlcov/*.html; do $(npm bin)/juice $filename $filename; done - ls -la ${{ github.workspace }}/tests/ cp tests/coverage.xml ${{ github.workspace }} - name: Code coverage summary report From d25f1320b2214b1c9d9341e4ac70476af7830bd7 Mon Sep 17 00:00:00 2001 From: serhii Date: Wed, 3 Aug 2022 15:18:49 +0100 Subject: [PATCH 110/145] Code coverage report --- .github/workflows/test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 2c03f593..f517ada6 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -126,7 +126,7 @@ jobs: RunPytests: runs-on: ubuntu-latest timeout-minutes: 20 - needs: [BuildBinaries] + needs: [CheckDocsAndPreCommit] strategy: fail-fast: false matrix: @@ -175,7 +175,7 @@ jobs: RunSlowPytests: runs-on: ubuntu-latest timeout-minutes: 20 - needs: [RunPytests] + needs: [CheckDocsAndPreCommit] strategy: fail-fast: false matrix: From 38fa7136ebc44fe9c0b8edbd0c9815513f455516 Mon Sep 17 00:00:00 2001 From: serhii Date: Wed, 3 Aug 2022 15:28:41 +0100 Subject: [PATCH 111/145] Code coverage report --- .github/workflows/test.yml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f517ada6..d4bd9cdb 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -248,6 +248,19 @@ jobs: path: ${{ github.workspace }}/tests/.coverage continue-on-error: true + TestProject: + runs-on: ubuntu-latest + timeout-minutes: 30 + needs: [ RunPytests, RunSlowPytests ] + strategy: + fail-fast: false + matrix: + OPENEDX_RELEASE: [ juniper, koa, lilac ] + TYPE: [ minimal, complete ] + + steps: + - uses: actions/checkout@v3 + CombineCoverage: runs-on: ubuntu-latest timeout-minutes: 10 From d8ca509c8dc948d528e72a0680da31e608db50af Mon Sep 17 00:00:00 2001 From: serhii Date: Wed, 3 Aug 2022 15:31:11 +0100 Subject: [PATCH 112/145] Code coverage report --- .github/workflows/test.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d4bd9cdb..e588ad10 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -251,12 +251,12 @@ jobs: TestProject: runs-on: ubuntu-latest timeout-minutes: 30 - needs: [ RunPytests, RunSlowPytests ] + needs: [RunPytests, RunSlowPytests] strategy: fail-fast: false matrix: - OPENEDX_RELEASE: [ juniper, koa, lilac ] - TYPE: [ minimal, complete ] + OPENEDX_RELEASE: [juniper, koa, lilac] + TYPE: [minimal, complete] steps: - uses: actions/checkout@v3 From d4f99e9515cd9ad3c244255965a3df2870e3faab Mon Sep 17 00:00:00 2001 From: serhii Date: Wed, 3 Aug 2022 16:12:49 +0100 Subject: [PATCH 113/145] Added project tests --- .github/workflows/build.yml | 9 +-- .github/workflows/test.yml | 151 +++++++++++++++++++++++++++--------- 2 files changed, 115 insertions(+), 45 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f1cec822..1a904cef 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -7,7 +7,6 @@ env: CACHE_KEY_IMAGES: BASE_SEED=$CACHE_KEY_BASE | $CACHE_KEY_FILES IMAGE_CACHE_PATH: ${{ github.workspace }}/image_cache SENTINEL_CACHE_PATH: ${{ github.workspace }}/sentinel_cache - AS_PYTHON_PACKAGE: false jobs: juniper: @@ -110,17 +109,11 @@ jobs: restore-keys: pipcache - name: Install derex.runner - if: env.AS_PYTHON_PACKAGE == 'false' && env.NEEDS_BUILD != 'false' + if: env.NEEDS_BUILD != 'false' run: | pip3 install --cache-dir $GITHUB_WORKSPACE/.cache/pip -U pip setuptools pip3 install --cache-dir $GITHUB_WORKSPACE/.cache/pip -r requirements_dev.txt -e . - - name: Install derex.runner as python package - if: env.AS_PYTHON_PACKAGE != 'false' && env.NEEDS_BUILD != 'false' - run: | - pip3 install --cache-dir $GITHUB_WORKSPACE/.cache/pip -U pip setuptools - pip3 install --cache-dir $GITHUB_WORKSPACE/.cache/pip . - - name: Build nostatic image if: env.NEEDS_BUILD != 'false' run: derex build openedx --docker-opts "${CACHE_FROM_OPTS} --cache-to=type=inline -o type=docker" --target=nostatic $DOCKER_IMAGES_SLUG diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e588ad10..e27c0c11 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -7,8 +7,8 @@ env: CACHE_KEY_IMAGES: BASE_SEED=$CACHE_KEY_BASE | $CACHE_KEY_FILES IMAGE_CACHE_PATH: ${{ github.workspace }}/image_cache SENTINEL_CACHE_PATH: ${{ github.workspace }}/sentinel_cache - AS_PYTHON_PACKAGE: false PYTEST_ADDOPTS: --cov=derex --cov-report xml --cov-report html --cov-report term --cov-report term-missing --cov-branch --black + CURL: curl --retry-connrefused --connect-timeout 30 --retry 5 --retry-delay 5 -f jobs: CheckDocsAndPreCommit: @@ -30,17 +30,11 @@ jobs: restore-keys: pipcache - name: Install derex.runner - if: env.AS_PYTHON_PACKAGE == 'false' && env.NEEDS_BUILD != 'false' + if: env.NEEDS_BUILD != 'false' run: | pip3 install --cache-dir ${{ github.workspace }}/.cache/pip -U pip setuptools pip3 install --cache-dir ${{ github.workspace }}/.cache/pip -r requirements_dev.txt -e . - - name: Install derex.runner as python package - if: env.AS_PYTHON_PACKAGE != 'false' && env.NEEDS_BUILD != 'false' - run: | - pip3 install --cache-dir ${{ github.workspace }}/.cache/pip -U pip setuptools - pip3 install --cache-dir ${{ github.workspace }}/.cache/pip . - - name: Compile docs run: make docs @@ -71,17 +65,11 @@ jobs: restore-keys: pipcache - name: Install derex.runner - if: env.AS_PYTHON_PACKAGE == 'false' && env.NEEDS_BUILD != 'false' + if: env.NEEDS_BUILD != 'false' run: | pip3 install --cache-dir ${{ github.workspace }}/.cache/pip -U pip setuptools pip3 install --cache-dir ${{ github.workspace }}/.cache/pip -r requirements_dev.txt -e . - - name: Install derex.runner as python package - if: env.AS_PYTHON_PACKAGE != 'false' && env.NEEDS_BUILD != 'false' - run: | - pip3 install --cache-dir ${{ github.workspace }}/.cache/pip -U pip setuptools - pip3 install --cache-dir ${{ github.workspace }}/.cache/pip . - - name: Build linux binary with pyinstaller run: | pip install pyinstaller @@ -147,17 +135,11 @@ jobs: restore-keys: pipcache - name: Install derex.runner - if: env.AS_PYTHON_PACKAGE == 'false' && env.NEEDS_BUILD != 'false' + if: env.NEEDS_BUILD != 'false' run: | pip3 install --cache-dir ${{ github.workspace }}/.cache/pip -U pip setuptools pip3 install --cache-dir ${{ github.workspace }}/.cache/pip -r requirements_dev.txt -e . - - name: Install derex.runner as python package - if: env.AS_PYTHON_PACKAGE != 'false' && env.NEEDS_BUILD != 'false' - run: | - pip3 install --cache-dir ${{ github.workspace }}/.cache/pip -U pip setuptools - pip3 install --cache-dir ${{ github.workspace }}/.cache/pip . - - name: Run python tests run: | set -ex @@ -196,17 +178,11 @@ jobs: restore-keys: pipcache - name: Install derex.runner - if: env.AS_PYTHON_PACKAGE == 'false' && env.NEEDS_BUILD != 'false' + if: env.NEEDS_BUILD != 'false' run: | pip3 install --cache-dir ${{ github.workspace }}/.cache/pip -U pip setuptools pip3 install --cache-dir ${{ github.workspace }}/.cache/pip -r requirements_dev.txt -e . - - name: Install derex.runner as python package - if: env.AS_PYTHON_PACKAGE != 'false' && env.NEEDS_BUILD != 'false' - run: | - pip3 install --cache-dir ${{ github.workspace }}/.cache/pip -U pip setuptools - pip3 install --cache-dir ${{ github.workspace }}/.cache/pip . - - name: Docker images cache if: steps.cache-sentinel.outputs.cache-hit != 'true' uses: actions/cache@v3 @@ -256,11 +232,118 @@ jobs: fail-fast: false matrix: OPENEDX_RELEASE: [juniper, koa, lilac] - TYPE: [minimal, complete] + PROJECT_TYPE: [minimal, complete] + env: + PROJECT_TYPE: ${{ matrix.PROJECT_TYPE }} + PROJECT_PATH: examples/${{ matrix.OPENEDX_RELEASE }}/${{ matrix.PROJECT_TYPE }} + PROJECT_NAME: ${{ matrix.OPENEDX_RELEASE }}-${{ matrix.PROJECT_TYPE }} steps: - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + with: + python-version: "3.8" + + - name: Cache pip packages + uses: actions/cache@v3 + with: + path: ${{ github.workspace }}/.cache/pip + key: pipcache | requirements_dev.txt + restore-keys: pipcache + + - name: Install derex.runner as python package + if: env.NEEDS_BUILD != 'false' + run: | + pip3 install --cache-dir ${{ github.workspace }}/.cache/pip -U pip setuptools + pip3 install --cache-dir ${{ github.workspace }}/.cache/pip . + + - name: Docker images cache + if: steps.cache-sentinel.outputs.cache-hit != 'true' + uses: actions/cache@v3 + with: + path: $IMAGE_CACHE_PATH + key: BASE_SEED=$CACHE_KEY_BASE | ${{ matrix.OPENEDX_RELEASE }} | $CACHE_KEY_IMAGES + restore-keys: BASE_SEED=$CACHE_KEY_BASE | ${{ matrix.OPENEDX_RELEASE }} + + - name: Load images + if: steps.cache-sentinel.outputs.cache-hit != 'true' + run: | + [ -d $IMAGE_CACHE_PATH ] || exit 0 + ls -l $IMAGE_CACHE_PATH + docker images + set -euxo pipefail + cat $IMAGE_CACHE_PATH/edx-${{ matrix.OPENEDX_RELEASE }}.tar.xz | unxz | docker load + docker images + + - name: Provision services + run: | + ddc-services config + ddc-services pull + set -ex + export DEREX_ADMIN_SERVICES=False + ddc-services up -d + sleep 15 + derex reset-mailslurper + + - name: Provision project + run: cd $PROJECT_PATH; ddc-project config + + - name: Build project final image + if: ${{ matrix.PROJECT_TYPE == 'complete' }} + run: cd $PROJECT_PATH && derex build project + + - name: Prime Mysql DB + run: | + set -ex + cd $PROJECT_PATH + derex mysql reset --force + + - name: Prime MinIO bucket + run: | + set -ex + cd $PROJECT_PATH + derex minio-update-key + derex create-bucket --no-tty + + - name: Prime Rabbitmq + run: | + set -ex + cd cd $PROJECT_PATH + derex reset-rabbitmq + + - name: Add hosts to /etc/hosts + run: echo 127.0.0.1 localhost studio.$PROJECT_NAME.localhost $PROJECT_NAME.localhost | sudo tee -a /etc/hosts + + - name: Show LMS/CMS logs + run: cd $PROJECT_PATH; ddc-project logs lms cms + + - name: Set production settings + if: ${{ matrix.PROJECT_TYPE == 'complete' }} + run: cd $PROJECT_PATH && derex settings production + + - name: Compile theme + if: ${{ matrix.PROJECT_TYPE == 'complete' }} + run: cd $PROJECT_PATH && derex compile-theme + + - name: Test image with dive + run: | + set -ex + cd $PROJECT_PATH + docker images + + # This should not be needed, but for some reason Azure does not tag the image + docker tag $(docker images -q|head -n1) $PROJECT_NAME/openedx-themes + docker images + + echo Installing dive + wget -q https://github.com/wagoodman/dive/releases/download/v0.9.2/dive_0.9.2_linux_amd64.deb + DEBIAN_FRONTEND=noninteractive sudo -E apt-get install -y ./dive_0.9.2_linux_amd64.deb + + echo Analyzing image + dive --ci $PROJECT_NAME/openedx-themes + #echo "Skipping image analysis" + CombineCoverage: runs-on: ubuntu-latest timeout-minutes: 10 @@ -281,17 +364,11 @@ jobs: restore-keys: pipcache - name: Install derex.runner - if: env.AS_PYTHON_PACKAGE == 'false' && env.NEEDS_BUILD != 'false' + if: env.NEEDS_BUILD != 'false' run: | pip3 install --cache-dir ${{ github.workspace }}/.cache/pip -U pip setuptools pip3 install --cache-dir ${{ github.workspace }}/.cache/pip -r requirements_dev.txt -e . - - name: Install derex.runner as python package - if: env.AS_PYTHON_PACKAGE != 'false' && env.NEEDS_BUILD != 'false' - run: | - pip3 install --cache-dir ${{ github.workspace }}/.cache/pip -U pip setuptools - pip3 install --cache-dir ${{ github.workspace }}/.cache/pip . - - uses: actions/download-artifact@v3 with: name: fasttests_coverage From 31bec2947a44b9f697f5da64c1adf6379471bcf0 Mon Sep 17 00:00:00 2001 From: serhii Date: Wed, 3 Aug 2022 16:15:19 +0100 Subject: [PATCH 114/145] Added project tests --- .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 e27c0c11..939b7f72 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -227,7 +227,7 @@ jobs: TestProject: runs-on: ubuntu-latest timeout-minutes: 30 - needs: [RunPytests, RunSlowPytests] + needs: [CheckDocsAndPreCommit] strategy: fail-fast: false matrix: From e1c86fe6ca98b15da19eb3e28ffb95b50448463f Mon Sep 17 00:00:00 2001 From: serhii Date: Wed, 3 Aug 2022 16:20:57 +0100 Subject: [PATCH 115/145] Added project tests --- .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 939b7f72..d8a2d5aa 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -309,7 +309,7 @@ jobs: - name: Prime Rabbitmq run: | set -ex - cd cd $PROJECT_PATH + cd $PROJECT_PATH derex reset-rabbitmq - name: Add hosts to /etc/hosts From 2bab8db325adb0dd8f3cb73097621492fbcc3173 Mon Sep 17 00:00:00 2001 From: serhii Date: Wed, 3 Aug 2022 16:48:47 +0100 Subject: [PATCH 116/145] Added project tests --- .github/workflows/test.yml | 132 ++++++++++++-- azure-pipelines/provision_project.yml | 72 -------- azure-pipelines/provision_services.yml | 20 --- azure-pipelines/run_project_tests.yml | 129 -------------- azure-pipelines/test.yml | 233 ------------------------- azure-pipelines/test_project.yml | 18 -- azure-pipelines/test_pyinstaller.yml | 50 ------ 7 files changed, 122 insertions(+), 532 deletions(-) delete mode 100644 azure-pipelines/provision_project.yml delete mode 100644 azure-pipelines/provision_services.yml delete mode 100644 azure-pipelines/run_project_tests.yml delete mode 100644 azure-pipelines/test.yml delete mode 100644 azure-pipelines/test_project.yml delete mode 100644 azure-pipelines/test_pyinstaller.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d8a2d5aa..b5a516c6 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -331,18 +331,130 @@ jobs: set -ex cd $PROJECT_PATH docker images - - # This should not be needed, but for some reason Azure does not tag the image - docker tag $(docker images -q|head -n1) $PROJECT_NAME/openedx-themes - docker images - - echo Installing dive wget -q https://github.com/wagoodman/dive/releases/download/v0.9.2/dive_0.9.2_linux_amd64.deb DEBIAN_FRONTEND=noninteractive sudo -E apt-get install -y ./dive_0.9.2_linux_amd64.deb + #dive --ci $PROJECT_NAME/openedx-themes + echo "Skipping image analysis" + + - name: Start project services in debug runmode + run: | + set -ex + cd $PROJECT_PATH + ddc-project up -d + sleep 5 # Give it time to start up + + - name: Show logs (debug runmode) + run: | + cd $PROJECT_PATH + ddc-project config + ddc-project logs + + - name: Test project fixtures + if: ${{ matrix.PROJECT_TYPE == 'complete' }} + run: | + set -ex + cd $PROJECT_PATH + # Run a command to get the current database name. First run it with all output enabled + # so that in case of errors in the pipeline we have info about what went wrong + ddc-project exec -T lms sh -c 'echo '"'"'from django.conf import settings; print(settings.DATABASES["default"]["NAME"])'"'"' |./manage.py lms shell' + # ...and then the actual run + DATABASE_NAME=$(ddc-project exec -T lms sh -c 'echo '"'"'from django.conf import settings; print(settings.DATABASES["default"]["NAME"])'"'"' |./manage.py lms shell 2> /dev/null' 2> /dev/null) + ddc-services exec -T mysql mysql -h localhost --protocol tcp -u root -p$(derex debug print-secret mysql) ${DATABASE_NAME} -e "SELECT * from auth_user WHERE username='derex.runner'"|grep derex.runner + + - name: Curl the LMS (debug runmode) + run: $CURL http://$PROJECT_NAME.localhost + + - name: Curl the LMS example plugin view (debug runmode) + if: ${{ matrix.PROJECT_TYPE == 'complete' }} + run: $CURL http://$PROJECT_NAME.localhost/example_view + + - name: Curl the CMS (debug runmode) + run: $CURL http://studio.$PROJECT_NAME.localhost + + - name: Start project services in production runmode + run: | + set -ex + cd $PROJECT_PATH + derex runmode production --force + ddc-project up -d + sleep 5 # Give it time to start up - echo Analyzing image - dive --ci $PROJECT_NAME/openedx-themes - #echo "Skipping image analysis" + - name: Show logs (production runmode) + run: | + cd $PROJECT_PATH + ddc-project config + ddc-project logs + + - name: Curl the LMS (production runmode) + run: $CURL http://$PROJECT_NAME.localhost/ || (sleep 10; $CURL http://$PROJECT_NAME.localhost/) + + - name: Curl the LMS example plugin view (production runmode) + if: ${{ matrix.PROJECT_TYPE == 'complete' }} + run: $CURL http://$PROJECT_NAME.localhost/example_view + + - name: Curl the CMS (production runmode) + if: ${{ matrix.PROJECT_TYPE == 'complete' }} + run: $CURL http://studio.$PROJECT_NAME.localhost/ || (sleep 10; $CURL http://studio.$PROJECT_NAME.localhost/) + + - name: Curl the LMS CSS and make sure our theme CSS is in + if: ${{ matrix.PROJECT_TYPE == 'complete' }} + run: | + set -ex + $CURL http://$PROJECT_NAME.localhost/|grep static/demo-theme/css/lms-main-v1.css + $CURL http://$PROJECT_NAME.localhost/static/demo-theme/css/lms-main-v1.css | grep this_is_a_customized_theme -q + + - name: Check flower + run: | + set -x + cd $PROJECT_PATH + echo 127.0.0.1 localhost flower.$PROJECT_NAME.localhost | sudo tee -a /etc/hosts + while ! (ddc-project logs cms_worker|grep ready); do sleep 1; done + while ! (ddc-project logs lms_worker|grep ready); do sleep 1; done + curl -m10 --retry-connrefused --connect-timeout 30 --retry 5 --retry-delay 5 http://flower.$PROJECT_NAME.localhost/dashboard?json=1|grep celery@openedx.lms + curl -m10 --retry-connrefused --connect-timeout 30 --retry 5 --retry-delay 5 http://flower.$PROJECT_NAME.localhost/dashboard?json=1|grep celery@openedx.cms + + - name: Check celerybeat + if: ${{ matrix.PROJECT_TYPE == 'complete' }} + run: | + # This test is relying on the djcelery fixtures which should + # have been loaded into the database when priming mysql + set -ex + cd $PROJECT_PATH + CELERYBEAT_RESULT=$(ddc-project logs lms_worker | grep "Scheduler: Sending due task debug" -c) + WORKER_RESULT=$(ddc-project logs lms_worker | grep "pong" -c) + if [ $CELERYBEAT_RESULT -gt 0 ] && [ $WORKER_RESULT -gt 0 ]; then + exit 0 + fi + exit 1 + + - name: Run project e2e tests + if: ${{ matrix.PROJECT_TYPE == 'complete' }} + run: | + set -ex + cd $PROJECT_PATH/e2e && npm ci && cd .. + export HTTP_PROXY=http://127.0.0.1:80 + derex test e2e + + - name: Show services and project logs + run: | + ddc-services logs + cd $PROJECT_PATH; ddc-project logs + + - name: Publish Cypress tests screenshots folder + if: ${{ matrix.PROJECT_TYPE == 'complete' }} + uses: actions/upload-artifact@v2.2.4 + with: + name: $PROJECT_NAME-e2e-screenshots + path: ${{ github.workspace }}/$PROJECT_PATH/e2e/cypress/screenshots + continue-on-error: true + + - name: Publish Cypress tests videos folder + if: ${{ matrix.PROJECT_TYPE == 'complete' }} + uses: actions/upload-artifact@v2.2.4 + with: + name: $PROJECT_NAME-e2e-videos + path: ${{ github.workspace }}/$PROJECT_PATH/e2e/cypress/videos + continue-on-error: true CombineCoverage: runs-on: ubuntu-latest @@ -383,7 +495,7 @@ jobs: path: $GITHUB_WORKSPACE/.cache/npm key: npmcache2 - - name: Fix coverage result and publish it + - name: Fix coverage result if: always() run: | set -ex diff --git a/azure-pipelines/provision_project.yml b/azure-pipelines/provision_project.yml deleted file mode 100644 index 34a01a87..00000000 --- a/azure-pipelines/provision_project.yml +++ /dev/null @@ -1,72 +0,0 @@ -parameters: - - name: PROJECT_TYPE - type: string - - name: PROJECT_PATH - type: string - - name: PROJECT_NAME - type: string - -steps: - - script: | - cd ${{ parameters.PROJECT_PATH }}; ddc-project config - condition: always() - displayName: "Show ddc-project config" - - - script: cd ${{ parameters.PROJECT_PATH }} && derex build project - condition: eq('${{ parameters.PROJECT_TYPE }}', 'complete') - displayName: Build project final image - - - script: | - set -ex - cd ${{ parameters.PROJECT_PATH }} - derex mysql reset --force - displayName: "Prime Mysql DB" - - - script: | - set -ex - cd ${{ parameters.PROJECT_PATH }} - derex minio-update-key - derex create-bucket --no-tty - displayName: "Prime MinIO bucket" - - - script: | - set -ex - cd ${{ parameters.PROJECT_PATH }} - derex reset-rabbitmq - displayName: "Prime Rabbitmq" - - - script: echo 127.0.0.1 localhost studio.${{ parameters.PROJECT_NAME }}.localhost ${{ parameters.PROJECT_NAME }}.localhost | sudo tee -a /etc/hosts - displayName: Add studio.${{ parameters.PROJECT_NAME }}.localhost and ${{ parameters.PROJECT_NAME }}.localhost to /etc/hosts - - - script: cd ${{ parameters.PROJECT_PATH }}; ddc-project logs lms cms - condition: always() - displayName: Show LMS/CMS logs - - - script: cd ${{ parameters.PROJECT_PATH }} && derex settings production - condition: eq('${{ parameters.PROJECT_TYPE }}', 'complete') - displayName: Set production settings - - - script: cd ${{ parameters.PROJECT_PATH }} && derex compile-theme - condition: eq('${{ parameters.PROJECT_TYPE }}', 'complete') - displayName: Compile theme - - # XXX: Work to have an efficient docker image and re-enable dive checks - - script: | - set -ex - cd ${{ parameters.PROJECT_PATH }} - docker images - - # This should not be needed, but for some reason Azure does not tag the image - docker tag $(docker images -q|head -n1) ${{ parameters.PROJECT_NAME }}/openedx-themes - docker images - - echo Installing dive - wget -q https://github.com/wagoodman/dive/releases/download/v0.9.2/dive_0.9.2_linux_amd64.deb - DEBIAN_FRONTEND=noninteractive sudo -E apt-get install -y ./dive_0.9.2_linux_amd64.deb - - echo Analyzing image - # dive --ci ${{ parameters.PROJECT_NAME }}/openedx-themes - echo "Skipping image analysis" - condition: always() - displayName: Test the ${{ parameters.PROJECT_NAME }} image with dive - timeoutInMinutes: 40 diff --git a/azure-pipelines/provision_services.yml b/azure-pipelines/provision_services.yml deleted file mode 100644 index 0748a7ca..00000000 --- a/azure-pipelines/provision_services.yml +++ /dev/null @@ -1,20 +0,0 @@ -steps: - - script: ddc-services config - condition: always() - displayName: "Show ddc-services config" - - - script: ddc-services pull - displayName: "Pull edX services images" - - - script: | - set -ex - export DEREX_ADMIN_SERVICES=False - ddc-services up -d - # Give it some seconds to boot - sleep 15 - displayName: "Start services docker containers" - - - script: | - set -ex - derex reset-mailslurper - displayName: "Prime Mailslurper database" diff --git a/azure-pipelines/run_project_tests.yml b/azure-pipelines/run_project_tests.yml deleted file mode 100644 index 8184dfb5..00000000 --- a/azure-pipelines/run_project_tests.yml +++ /dev/null @@ -1,129 +0,0 @@ -parameters: - - name: PROJECT_TYPE - type: string - - name: PROJECT_PATH - type: string - - name: PROJECT_NAME - type: string - -steps: - - script: | - set -ex - cd ${{ parameters.PROJECT_PATH }} - ddc-project up -d - sleep 5 # Give it time to start up - displayName: "Start project services in debug runmode" - - - script: | - cd ${{ parameters.PROJECT_PATH }} - ddc-project config - ddc-project logs - condition: always() - displayName: "Show logs (debug runmode)" - - - script: | - set -ex - cd ${{ parameters.PROJECT_PATH }} - # Run a command to get the current database name. First run it with all output enabled - # so that in case of errors in the pipeline we have info about what went wrong - ddc-project exec -T lms sh -c 'echo '"'"'from django.conf import settings; print(settings.DATABASES["default"]["NAME"])'"'"' |./manage.py lms shell' - # ...and then the actual run - DATABASE_NAME=$(ddc-project exec -T lms sh -c 'echo '"'"'from django.conf import settings; print(settings.DATABASES["default"]["NAME"])'"'"' |./manage.py lms shell 2> /dev/null' 2> /dev/null) - ddc-services exec -T mysql mysql -h localhost --protocol tcp -u root -p$(derex debug print-secret mysql) ${DATABASE_NAME} -e "SELECT * from auth_user WHERE username='derex.runner'"|grep derex.runner - condition: eq('${{ parameters.PROJECT_TYPE }}', 'complete') - displayName: "Test ${{ parameters.PROJECT_NAME }} project fixtures" - - - script: $(CURL) http://${{ parameters.PROJECT_NAME }}.localhost - displayName: Curl the LMS (debug runmode) - - - script: $(CURL) http://${{ parameters.PROJECT_NAME }}.localhost/example_view - displayName: Curl the LMS example plugin view (debug runmode) - condition: eq('${{ parameters.PROJECT_TYPE }}', 'complete') - - - script: $(CURL) http://studio.${{ parameters.PROJECT_NAME }}.localhost - displayName: Curl the CMS (debug runmode) - - - script: | - set -ex - cd ${{ parameters.PROJECT_PATH }} - derex runmode production --force - ddc-project up -d - sleep 5 # Give it time to start up - displayName: "Start project services in production runmode" - - - script: | - cd ${{ parameters.PROJECT_PATH }} - ddc-project config - ddc-project logs - condition: always() - displayName: "Show logs (production runmode)" - - - script: | - $(CURL) http://${{ parameters.PROJECT_NAME }}.localhost/ || (sleep 10; $(CURL) http://${{ parameters.PROJECT_NAME }}.localhost/) - displayName: "Curl the LMS (production runmode)" - - - script: $(CURL) http://${{ parameters.PROJECT_NAME }}.localhost/example_view - displayName: "Curl the LMS example plugin view (production runmode)" - condition: eq('${{ parameters.PROJECT_TYPE }}', 'complete') - - - script: $(CURL) http://studio.${{ parameters.PROJECT_NAME }}.localhost/ || (sleep 10; $(CURL) http://studio.${{ parameters.PROJECT_NAME }}.localhost/) - displayName: "Curl the CMS (production runmode)" - - - script: | - set -ex - $(CURL) http://${{ parameters.PROJECT_NAME }}.localhost/|grep static/demo-theme/css/lms-main-v1.css - $(CURL) http://${{ parameters.PROJECT_NAME }}.localhost/static/demo-theme/css/lms-main-v1.css | grep this_is_a_customized_theme -q - condition: eq('${{ parameters.PROJECT_TYPE }}', 'complete') - displayName: "Curl the LMS CSS and make sure our theme CSS is in" - - - script: | - set -x - cd ${{ parameters.PROJECT_PATH }} - echo 127.0.0.1 localhost flower.${{ parameters.PROJECT_NAME }}.localhost | sudo tee -a /etc/hosts - while ! (ddc-project logs cms_worker|grep ready); do sleep 1; done - while ! (ddc-project logs lms_worker|grep ready); do sleep 1; done - curl -m10 --retry-connrefused --connect-timeout 30 --retry 5 --retry-delay 5 http://flower.${{ parameters.PROJECT_NAME }}.localhost/dashboard?json=1|grep celery@openedx.lms - curl -m10 --retry-connrefused --connect-timeout 30 --retry 5 --retry-delay 5 http://flower.${{ parameters.PROJECT_NAME }}.localhost/dashboard?json=1|grep celery@openedx.cms - displayName: "Check flower" - - - script: | - # This test is relying on the djcelery fixtures which should - # have been loaded into the database when priming mysql - set -ex - cd ${{ parameters.PROJECT_PATH }} - CELERYBEAT_RESULT=$(ddc-project logs lms_worker | grep "Scheduler: Sending due task debug" -c) - WORKER_RESULT=$(ddc-project logs lms_worker | grep "pong" -c) - if [ $CELERYBEAT_RESULT -gt 0 ] && [ $WORKER_RESULT -gt 0 ]; then - exit 0 - fi - exit 1 - condition: eq('${{ parameters.PROJECT_TYPE }}', 'complete') - displayName: "Check celerybeat" - - - script: | - set -ex - cd ${{ parameters.PROJECT_PATH }}/e2e && npm ci && cd .. - export HTTP_PROXY=http://127.0.0.1:80 - derex test e2e - condition: eq('${{ parameters.PROJECT_TYPE }}', 'complete') - displayName: "Run project e2e tests" - - - script: | - ddc-services logs - cd ${{ parameters.PROJECT_PATH }}; ddc-project logs - condition: always() - displayName: "Show services and project logs" - - - task: PublishBuildArtifacts@1 - inputs: - pathToPublish: $(System.DefaultWorkingDirectory)/${{ parameters.PROJECT_PATH }}/e2e/cypress/screenshots - artifactName: ${{ parameters.PROJECT_NAME }}-e2e-screenshots - condition: and(always(), eq('${{ parameters.PROJECT_TYPE }}', 'complete')) - displayName: "Publish Cypress tests screenshots folder" - - - task: PublishBuildArtifacts@1 - inputs: - pathToPublish: $(System.DefaultWorkingDirectory)/${{ parameters.PROJECT_PATH }}/e2e/cypress/videos - artifactName: ${{ parameters.PROJECT_NAME }}-e2e-videos - condition: and(always(), eq('${{ parameters.PROJECT_TYPE }}', 'complete')) - displayName: "Publish Cypress tests videos folder" diff --git a/azure-pipelines/test.yml b/azure-pipelines/test.yml deleted file mode 100644 index 88af487d..00000000 --- a/azure-pipelines/test.yml +++ /dev/null @@ -1,233 +0,0 @@ -stages: - - stage: Test - variables: - PYTEST_ADDOPTS: --cov=derex --cov-report xml --cov-report html --cov-report term --cov-report term-missing --cov-branch --black - jobs: - - job: PyInstallerBuildLinux - pool: - vmImage: $(UBUNTU_VERSION) - steps: - - template: prepare.yml - - template: test_pyinstaller.yml - parameters: - OS: ubuntu - OPENEDX_RELEASE: juniper - - template: test_pyinstaller.yml - parameters: - OS: ubuntu - OPENEDX_RELEASE: koa - - template: test_pyinstaller.yml - parameters: - OS: ubuntu - OPENEDX_RELEASE: lilac - - - job: PyInstallerBuildMacOs - pool: - vmImage: "macOS-10.15" - steps: - - template: prepare.yml - - template: test_pyinstaller.yml - parameters: - OS: macos - OPENEDX_RELEASE: juniper - - template: test_pyinstaller.yml - parameters: - OS: macos - OPENEDX_RELEASE: koa - - template: test_pyinstaller.yml - parameters: - OS: macos - OPENEDX_RELEASE: lilac - - - job: RunPytests - timeoutInMinutes: 40 - pool: - vmImage: $(UBUNTU_VERSION) - steps: - - template: prepare.yml - - - script: | - set -ex - set -o pipefail - pip3 --cache-dir $(Pipeline.Workspace)/.cache/pip install scrypt - cd tests - pytest -m "not slowtest" | grep -v codecoveragetool=Cobertura - displayName: "Run python tests" - - - publish: $(System.DefaultWorkingDirectory)/tests/.coverage - artifact: fasttests_coverage - - - job: RunSlowPytests - timeoutInMinutes: 40 - pool: - vmImage: $(UBUNTU_VERSION) - steps: - - template: prepare.yml - - template: load_images.yml - parameters: - DOCKER_IMAGES_SLUG: juniper - - template: load_images.yml - parameters: - DOCKER_IMAGES_SLUG: koa - - template: load_images.yml - parameters: - DOCKER_IMAGES_SLUG: lilac - - template: provision_services.yml - - - script: | - set -ex - set -o pipefail - cd tests - pytest -m "slowtest" | grep -v codecoveragetool=Cobertura - displayName: "Run python tests" - - - publish: $(System.DefaultWorkingDirectory)/tests/.coverage - artifact: slowtests_coverage - - - job: CombineCoverage - dependsOn: - - RunPytests - - RunSlowPytests - pool: - vmImage: $(UBUNTU_VERSION) - steps: - - template: prepare.yml - - - download: current - - - task: Cache@2 - inputs: - key: npmcache2 - path: $(Pipeline.Workspace)/.cache/npm - displayName: Cache npm packages - - - script: | - set -ex - cp $(Pipeline.Workspace)/slowtests_coverage/.coverage tests/.coverage.slow - cp $(Pipeline.Workspace)/fasttests_coverage/.coverage tests/.coverage.fast - cd tests - coverage combine - coverage html - coverage xml - cd .. - # We installed the package with pip, and coverage reports the full absolute path. - # We cut to derex/runner/etc/etc - DEREX_RUNNER_PATH=`cd tests;python -c "from pathlib import Path; import derex.runner;print(Path(derex.runner.__file__).parent.parent.parent)"` - echo Replacing ${DEREX_RUNNER_PATH} in tests/htmlcov/*.html - sudo npm config set cache $(Pipeline.Workspace)/.cache/npm --global - npm install juice - # Azure pipelines strips style sheets but leaves styles in place. - # juice can embed the styles in the HTML for us and present a much better - # view in the coverage results tab. - for filename in tests/htmlcov/*.html; do $(npm bin)/juice $filename $filename; done - echo "##vso[codecoverage.publish codecoveragetool=Cobertura;summaryfile=${PWD}/tests/coverage.xml;reportdirectory=${PWD}/tests/htmlcov;]" - displayName: Fix coverage result and publish it - condition: succeededOrFailed() - - - job: TestJuniperMinimalProject - timeoutInMinutes: 40 - pool: - vmImage: $(UBUNTU_VERSION) - variables: - CURL: curl --retry-connrefused --connect-timeout 30 --retry 5 --retry-delay 5 -f - steps: - - template: prepare.yml - parameters: - AS_PYTHON_PACKAGE: True - - template: load_images.yml - parameters: - DOCKER_IMAGES_SLUG: juniper - - template: test_project.yml - parameters: - OPENEDX_RELEASE: juniper - PROJECT_TYPE: minimal - - - job: TestJuniperCompleteProject - timeoutInMinutes: 60 - pool: - vmImage: $(UBUNTU_VERSION) - variables: - CURL: curl --retry-connrefused --connect-timeout 30 --retry 5 --retry-delay 5 -f - steps: - - template: prepare.yml - parameters: - AS_PYTHON_PACKAGE: True - - template: load_images.yml - parameters: - DOCKER_IMAGES_SLUG: juniper - - template: test_project.yml - parameters: - OPENEDX_RELEASE: juniper - PROJECT_TYPE: complete - - - job: TestKoaMinimalProject - timeoutInMinutes: 40 - pool: - vmImage: $(UBUNTU_VERSION) - variables: - CURL: curl --retry-connrefused --connect-timeout 30 --retry 5 --retry-delay 5 -f - steps: - - template: prepare.yml - parameters: - AS_PYTHON_PACKAGE: True - - template: load_images.yml - parameters: - DOCKER_IMAGES_SLUG: koa - - template: test_project.yml - parameters: - OPENEDX_RELEASE: koa - PROJECT_TYPE: minimal - - - job: TestKoaCompleteProject - timeoutInMinutes: 60 - pool: - vmImage: $(UBUNTU_VERSION) - variables: - CURL: curl --retry-connrefused --connect-timeout 30 --retry 5 --retry-delay 5 -f - steps: - - template: prepare.yml - parameters: - AS_PYTHON_PACKAGE: True - - template: load_images.yml - parameters: - DOCKER_IMAGES_SLUG: koa - - template: test_project.yml - parameters: - OPENEDX_RELEASE: koa - PROJECT_TYPE: complete - - - job: TestLilacMinimalProject - timeoutInMinutes: 40 - pool: - vmImage: $(UBUNTU_VERSION) - variables: - CURL: curl --retry-connrefused --connect-timeout 30 --retry 5 --retry-delay 5 -f - steps: - - template: prepare.yml - parameters: - AS_PYTHON_PACKAGE: True - - template: load_images.yml - parameters: - DOCKER_IMAGES_SLUG: lilac - - template: test_project.yml - parameters: - OPENEDX_RELEASE: lilac - PROJECT_TYPE: minimal - - - job: CheckDocs - timeoutInMinutes: 5 - pool: - vmImage: $(UBUNTU_VERSION) - steps: - - template: prepare.yml - - script: make docs - displayName: "Compile docs" - - - job: CheckPreCommit - timeoutInMinutes: 5 - pool: - vmImage: $(UBUNTU_VERSION) - steps: - - template: prepare.yml - - script: pre-commit run -a - displayName: "Check pre commit hooks" diff --git a/azure-pipelines/test_project.yml b/azure-pipelines/test_project.yml deleted file mode 100644 index c5656f2b..00000000 --- a/azure-pipelines/test_project.yml +++ /dev/null @@ -1,18 +0,0 @@ -parameters: - - name: OPENEDX_RELEASE - type: string - - name: PROJECT_TYPE - type: string - -steps: - - template: provision_services.yml - - template: provision_project.yml - parameters: - PROJECT_TYPE: ${{ parameters.PROJECT_TYPE }} - PROJECT_PATH: ${{ format('examples/{0}/{1}', parameters.OPENEDX_RELEASE, parameters.PROJECT_TYPE) }} - PROJECT_NAME: ${{ format('{0}-{1}', parameters.OPENEDX_RELEASE, parameters.PROJECT_TYPE) }} - - template: run_project_tests.yml - parameters: - PROJECT_TYPE: ${{ parameters.PROJECT_TYPE }} - PROJECT_PATH: ${{ format('examples/{0}/{1}', parameters.OPENEDX_RELEASE, parameters.PROJECT_TYPE) }} - PROJECT_NAME: ${{ format('{0}-{1}', parameters.OPENEDX_RELEASE, parameters.PROJECT_TYPE) }} diff --git a/azure-pipelines/test_pyinstaller.yml b/azure-pipelines/test_pyinstaller.yml deleted file mode 100644 index 18b6f94f..00000000 --- a/azure-pipelines/test_pyinstaller.yml +++ /dev/null @@ -1,50 +0,0 @@ -parameters: - - name: OS - type: string - - name: OPENEDX_RELEASE - type: string - -steps: - - ${{ if eq(parameters.OS, 'ubuntu') }}: - - script: | - pip install pyinstaller - make executable - displayName: "Build binary with pyinstaller" - - - script: | - set -ex - ./bundle/dist/derex - ./bundle/dist/ddc-services ps - cd examples/${{ parameters.OPENEDX_RELEASE }}/minimal - ../../../bundle/dist/ddc-project config - displayName: "Test pyinstaller created binary" - - - task: PublishBuildArtifacts@1 - inputs: - pathToPublish: ./bundle/dist/ - artifactName: LinuxBinary - - - ${{ if eq(parameters.OS, 'macos') }}: - - script: | - pip install pyinstaller scrypt - # The Openssl version on MacOS 10.14 does not support scrypt - # so we pip install it and leave a trace to pyinstaller to pick it up - echo -e "\nimport scrypt" >> bundle/executable.py - make executable - displayName: "Build binary with pyinstaller" - - # Currently Azure Pipelines doesn't support Docker on MacOS - # so we can't really test the binary - - script: | - #set -ex - ./bundle/dist/derex --help - ./bundle/dist/ddc-services --help - cd examples/${{ parameters.OPENEDX_RELEASE }}/minimal - # ../../../bundle/dist/ddc-project config - true - displayName: "Test pyinstaller created binary" - - - task: PublishBuildArtifacts@1 - inputs: - pathToPublish: ./bundle/dist/ - artifactName: MacOSBinary From 84f918e19e9501f381f6b2586626f94a6befc37b Mon Sep 17 00:00:00 2001 From: serhii Date: Mon, 8 Aug 2022 22:07:07 +0100 Subject: [PATCH 117/145] Add push workflow --- .github/workflows/push.yaml | 68 +++++++++++++++++++++++++++++++++++++ .github/workflows/test.yml | 1 + 2 files changed, 69 insertions(+) create mode 100644 .github/workflows/push.yaml diff --git a/.github/workflows/push.yaml b/.github/workflows/push.yaml new file mode 100644 index 00000000..a4155958 --- /dev/null +++ b/.github/workflows/push.yaml @@ -0,0 +1,68 @@ +name: Push +on: push + +env: + CACHE_KEY_BASE: 22 # Increment this value to reset the images cache + CACHE_KEY_FILES: ${{ github.workspace }}/docker-definition + CACHE_KEY_IMAGES: BASE_SEED=$CACHE_KEY_BASE | $CACHE_KEY_FILES + IMAGE_CACHE_PATH: ${{ github.workspace }}/image_cache + SENTINEL_CACHE_PATH: ${{ github.workspace }}/sentinel_cache + +jobs: + Push: + runs-on: ubuntu-latest + timeout-minutes: 20 + needs: [TestProject] + strategy: + fail-fast: false + matrix: + OPENEDX_RELEASE: [juniper, koa, lilac] + + steps: + - uses: actions/checkout@v3 + + - name: Docker images sentinel cache + id: cache-sentinel + uses: actions/cache@v3 + with: + path: $SENTINEL_CACHE_PATH + key: SENTINEL=1 | ${{ matrix.OPENEDX_RELEASE }} | $CACHE_KEY_IMAGES + + - name: Set needs_push pipeline variable + run: | + IMAGE="derex/openedx-${{ matrix.OPENEDX_RELEASE }}-dev:$(grep __version__ derex/runner/__init__.py |sed 's/[^"]*"//;s/"//')" + echo Checking presence of ${IMAGE} on docker registry + docker manifest inspect ${IMAGE} || { echo "NEEDS_PUSH=true" >> $GITHUB_ENV; echo Image not found: pushing ; } + + - name: Log into docker registry + if: env.NEEDS_PUSH != 'false' + run: docker login -u ${DOCKER_USERNAME} -p ${DOCKER_PASSWORD} + env: + DOCKER_USERNAME: $(DOCKER_USERNAME) + DOCKER_PASSWORD: $(DOCKER_PASSWORD) + + - name: Docker images cache + if: steps.cache-sentinel.outputs.cache-hit != 'true' + uses: actions/cache@v3 + with: + path: $IMAGE_CACHE_PATH + key: BASE_SEED=$CACHE_KEY_BASE | ${{ matrix.OPENEDX_RELEASE }} | $CACHE_KEY_IMAGES + restore-keys: BASE_SEED=$CACHE_KEY_BASE | ${{ matrix.OPENEDX_RELEASE }} + + - name: Load images + if: steps.cache-sentinel.outputs.cache-hit != 'true' + run: | + [ -d $IMAGE_CACHE_PATH ] || exit 0 + ls -l $IMAGE_CACHE_PATH + docker images + set -euxo pipefail + cat $IMAGE_CACHE_PATH/edx-${{ matrix.OPENEDX_RELEASE }}.tar.xz | unxz | docker load + docker images + + - name: Push dev image + if: env.NEEDS_PUSH != 'false' + run: docker push derex/openedx-${{ matrix.OPENEDX_RELEASE }}-dev:$(grep __version__ derex/runner/__init__.py |sed 's/[^"]*"//;s/"//') + + - name: Push nostatic image + if: env.NEEDS_PUSH != 'false' + run: docker push derex/openedx-${{ matrix.OPENEDX_RELEASE }}-nostatic:$(grep __version__ derex/runner/__init__.py |sed 's/[^"]*"//;s/"//') \ No newline at end of file diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b5a516c6..be0857dd 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -14,6 +14,7 @@ jobs: CheckDocsAndPreCommit: runs-on: ubuntu-latest timeout-minutes: 5 + needs: [juniper,koa,lilac] steps: - uses: actions/checkout@v3 From 91dc90630482ed17641834d17694646da184615c Mon Sep 17 00:00:00 2001 From: serhii Date: Mon, 8 Aug 2022 22:09:34 +0100 Subject: [PATCH 118/145] Set target branches for build --- .github/workflows/push.yaml | 6 ++++- azure-pipelines/push.yml | 33 ------------------------- azure-pipelines/push_single_version.yml | 33 ------------------------- 3 files changed, 5 insertions(+), 67 deletions(-) delete mode 100644 azure-pipelines/push.yml delete mode 100644 azure-pipelines/push_single_version.yml diff --git a/.github/workflows/push.yaml b/.github/workflows/push.yaml index a4155958..5efc8fa5 100644 --- a/.github/workflows/push.yaml +++ b/.github/workflows/push.yaml @@ -1,5 +1,9 @@ name: Push -on: push +on: + push: + branches: + - master + - build env: CACHE_KEY_BASE: 22 # Increment this value to reset the images cache diff --git a/azure-pipelines/push.yml b/azure-pipelines/push.yml deleted file mode 100644 index 3ca2a210..00000000 --- a/azure-pipelines/push.yml +++ /dev/null @@ -1,33 +0,0 @@ -stages: - - stage: Push - # Check if pushing is needed only on `master` and `build` branches - condition: and(succeeded(), or(eq(variables['Build.SourceBranch'], 'refs/heads/master'), eq(variables['Build.SourceBranch'], 'refs/heads/build') )) - variables: - - group: Docker credentials - jobs: - - job: juniper - pool: - vmImage: $(UBUNTU_VERSION) - variables: - - name: DOCKER_IMAGES_SLUG - value: juniper - steps: - - template: push_single_version.yml - - - job: koa - pool: - vmImage: $(UBUNTU_VERSION) - variables: - - name: DOCKER_IMAGES_SLUG - value: koa - steps: - - template: push_single_version.yml - - - job: lilac - pool: - vmImage: $(UBUNTU_VERSION) - variables: - - name: DOCKER_IMAGES_SLUG - value: lilac - steps: - - template: push_single_version.yml diff --git a/azure-pipelines/push_single_version.yml b/azure-pipelines/push_single_version.yml deleted file mode 100644 index 4fc08c74..00000000 --- a/azure-pipelines/push_single_version.yml +++ /dev/null @@ -1,33 +0,0 @@ -steps: - - task: Cache@2 - inputs: - key: SENTINEL=1 | $(DOCKER_IMAGES_SLUG) | $(CACHE_KEY_IMAGES) - path: $(SENTINEL_CACHE_PATH) - cacheHitVar: "ImagesSentinelHit" - displayName: "Docker images sentinel cache" - - - script: | - IMAGE="derex/openedx-$(DOCKER_IMAGES_SLUG)-dev:$(grep __version__ derex/runner/__init__.py |sed 's/[^"]*"//;s/"//')" - echo Checking presence of ${IMAGE} on docker registry - docker manifest inspect ${IMAGE} || { echo '##vso[task.setvariable variable=needs_push]true'; echo Image not found: pushing ; } - displayName: "Set needs_push pipeline variable" - - - script: docker login -u ${DOCKER_USERNAME} -p ${DOCKER_PASSWORD} - displayName: "Log into docker registry" - condition: ne(variables.needs_push, 'false') - env: - DOCKER_USERNAME: $(DOCKER_USERNAME) - DOCKER_PASSWORD: $(DOCKER_PASSWORD) - - - template: load_images.yml - parameters: - DOCKER_IMAGES_SLUG: $(DOCKER_IMAGES_SLUG) - CONDITION: "ne(variables.needs_push, 'false')" - - - script: docker push derex/openedx-$(DOCKER_IMAGES_SLUG)-dev:$(grep __version__ derex/runner/__init__.py |sed 's/[^"]*"//;s/"//') - condition: ne(variables.needs_push, 'false') - displayName: "Push $(DOCKER_IMAGES_SLUG) dev image" - - - script: docker push derex/openedx-$(DOCKER_IMAGES_SLUG)-nostatic:$(grep __version__ derex/runner/__init__.py |sed 's/[^"]*"//;s/"//') - condition: ne(variables.needs_push, 'false') - displayName: "Push $(DOCKER_IMAGES_SLUG) nostatic image" From 3dc95ba9fc86a8ffb20530669d3808537e825e2c Mon Sep 17 00:00:00 2001 From: serhii Date: Mon, 8 Aug 2022 22:09:53 +0100 Subject: [PATCH 119/145] Set target branches for build --- .github/workflows/test.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index be0857dd..b5a516c6 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -14,7 +14,6 @@ jobs: CheckDocsAndPreCommit: runs-on: ubuntu-latest timeout-minutes: 5 - needs: [juniper,koa,lilac] steps: - uses: actions/checkout@v3 From 0fec29e43f93aef2e6f00cdc09fa8f92d570de5a Mon Sep 17 00:00:00 2001 From: serhii Date: Mon, 8 Aug 2022 22:15:21 +0100 Subject: [PATCH 120/145] Set workflow sequence --- .github/workflows/build.yml | 13 ++++++++++++- .github/workflows/push.yaml | 5 ++++- .github/workflows/test.yml | 19 +++++++++++++++++-- 3 files changed, 33 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1a904cef..34aa7573 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,5 +1,5 @@ name: Build -on: public +on: push env: CACHE_KEY_BASE: 22 # Increment this value to reset the images cache @@ -168,3 +168,14 @@ jobs: with: path: $(SENTINEL_CACHE_PATH) key: SENTINEL=1 | $DOCKER_IMAGES_SLUG | $CACHE_KEY_IMAGES + + on-success: + runs-on: ubuntu-latest + if: ${{ github.event.workflow_run.conclusion == 'success' }} + steps: + - run: echo 'Workflow passed' + on-failure: + runs-on: ubuntu-latest + if: ${{ github.event.workflow_run.conclusion == 'failure' }} + steps: + - run: echo 'Workflow failed' \ No newline at end of file diff --git a/.github/workflows/push.yaml b/.github/workflows/push.yaml index 5efc8fa5..bdd0e96c 100644 --- a/.github/workflows/push.yaml +++ b/.github/workflows/push.yaml @@ -1,6 +1,9 @@ name: Push on: - push: + workflow_run: + workflows: ["Test"] + types: + - completed branches: - master - build diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b5a516c6..d6a182b1 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,5 +1,9 @@ -name: Build -on: push +name: Test +on: + workflow_run: + workflows: ["Build"] + types: + - completed env: CACHE_KEY_BASE: 22 # Increment this value to reset the images cache @@ -522,3 +526,14 @@ jobs: uses: irongut/CodeCoverageSummary@v1.3.0 with: filename: coverage.xml + + on-success: + runs-on: ubuntu-latest + if: ${{ github.event.workflow_run.conclusion == 'success' }} + steps: + - run: echo 'Workflow passed' + on-failure: + runs-on: ubuntu-latest + if: ${{ github.event.workflow_run.conclusion == 'failure' }} + steps: + - run: echo 'Workflow failed' \ No newline at end of file From cf30ded441b7f88593a498fd1cdf5f026bdddf98 Mon Sep 17 00:00:00 2001 From: serhii Date: Mon, 8 Aug 2022 22:38:26 +0100 Subject: [PATCH 121/145] Test full pipeline --- .github/workflows/build.yml | 233 ++++++++++++++++++------------------ azure-pipelines.yml | 29 ----- 2 files changed, 118 insertions(+), 144 deletions(-) delete mode 100644 azure-pipelines.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 34aa7573..78761731 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,5 +1,8 @@ name: Build -on: push +on: + - push + - schedule: + - cron: '30 06 * * *' env: CACHE_KEY_BASE: 22 # Increment this value to reset the images cache @@ -24,120 +27,120 @@ jobs: path: $SENTINEL_CACHE_PATH key: SENTINEL=1 | $DOCKER_IMAGES_SLUG | $CACHE_KEY_IMAGES - - name: Docker images cache - if: steps.cache-sentinel.outputs.cache-hit != 'true' - uses: actions/cache@v3 - with: - path: $IMAGE_CACHE_PATH - key: BASE_SEED=$CACHE_KEY_BASE | $DOCKER_IMAGES_SLUG | $CACHE_KEY_IMAGES - restore-keys: BASE_SEED=$CACHE_KEY_BASE | $DOCKER_IMAGES_SLUG - - - name: Load images - if: steps.cache-sentinel.outputs.cache-hit != 'true' - run: | - [ -d $IMAGE_CACHE_PATH ] || exit 0 - ls -l $IMAGE_CACHE_PATH - docker images - set -euxo pipefail - cat $IMAGE_CACHE_PATH/edx-$DOCKER_IMAGES_SLUG.tar.xz | unxz | docker load - docker images - - - name: Set needs_build pipeline variable - if: steps.cache-sentinel.outputs.cache-hit != 'true' - run: echo "NEEDS_BUILD=true" >> $GITHUB_ENV - - - name: Remove Haskell compiler and cached apt archives to save disk space - if: env.NEEDS_BUILD != 'false' - run: df -h; time sudo rm -rf /var/cache/apt/archives /opt/ghc; df -h - - - name: Prepare Transifex credentials - if: env.NEEDS_BUILD != 'false' - run: | - if [ "$TRANSIFEX_USERNAME" == '$(TRANSIFEX_USERNAME)' ] || [ "$TRANSIFEX_PASSWORD" == '$(TRANSIFEX_PASSWORD)' ]; then - echo "Transifex credentials unset. Building without translations." - exit 0 - fi - printf '[https://www.transifex.com]\nhostname=https://www.transifex.com\nusername=%s\npassword=%s\n' "${TRANSIFEX_USERNAME}" "${TRANSIFEX_PASSWORD}" > $HOME/.transifexrc - ls -l $GITHUB_WORKSPACE/.transifexrc - env: - TRANSIFEX_USERNAME: $(TRANSIFEX_USERNAME) - TRANSIFEX_PASSWORD: $(TRANSIFEX_PASSWORD) - - - name: Setup docker images cache - if: env.NEEDS_BUILD != 'false' - run: | - images=$(docker images|grep -v ''|grep derex|awk '{print $1 ":" $2}') - CACHE_FROM_OPTS="" - if [ -d $IMAGE_CACHE_PATH ]; then - echo "Will use cached layers from images $images" - for image in $images; do - CACHE_FROM_OPTS="${CACHE_FROM_OPTS} --cache-from=$image" - done - else - mkdir $IMAGE_CACHE_PATH - fi - echo "CACHE_FROM_OPTS=$CACHE_FROM_OPTS" >> $GITHUB_ENV - mkdir $SENTINEL_CACHE_PATH - cp -r $CACHE_KEY_FILES $SENTINEL_CACHE_PATH - # We save the sha of the repo that built this image, so that we can push - # it only in a build of the same commit, after tests are passed - git rev-parse --verify HEAD > $SENTINEL_CACHE_PATH/built_version - - - name: Replace default docker with upsream docker and create build context - if: env.NEEDS_BUILD != 'false' - run: | - set -ex - sudo apt-get remove moby-cli -y - curl -fsSL https://get.docker.com |sudo bash - sudo mv /etc/docker/daemon.json /etc/docker/daemon.json.orig - sudo cat /etc/docker/daemon.json.orig|jq '. + {experimental: true}' |sudo tee /etc/docker/daemon.json - sudo systemctl restart docker.service - docker version - docker buildx create --use - docker images - sudo apt-get install pixz -y - - - uses: actions/setup-python@v4 - with: - python-version: "3.8" - - - name: Cache pip packages - uses: actions/cache@v3 - with: - path: $GITHUB_WORKSPACE/.cache/pip - key: pipcache | requirements_dev.txt - restore-keys: pipcache - - - name: Install derex.runner - if: env.NEEDS_BUILD != 'false' - run: | - pip3 install --cache-dir $GITHUB_WORKSPACE/.cache/pip -U pip setuptools - pip3 install --cache-dir $GITHUB_WORKSPACE/.cache/pip -r requirements_dev.txt -e . - - - name: Build nostatic image - if: env.NEEDS_BUILD != 'false' - run: derex build openedx --docker-opts "${CACHE_FROM_OPTS} --cache-to=type=inline -o type=docker" --target=nostatic $DOCKER_IMAGES_SLUG - - - name: Build dev image - if: env.NEEDS_BUILD != 'false' - run: derex build openedx --docker-opts "--cache-to=type=inline -o type=docker" --target=dev $DOCKER_IMAGES_SLUG - - - name: Check translations - if: env.NEEDS_BUILD != 'false' - run: | - docker images - derex build openedx --docker-opts "${CACHE_FROM_OPTS} --output type=docker,name={docker_image_prefix}-{target}" --target=translations $DOCKER_IMAGES_SLUG - docker images - docker run --rm derex/openedx-$DOCKER_IMAGES_SLUG-translations:$(grep __version__ derex/runner/__init__.py |sed 's/[^"]*"//;s/"//') sh -c "i18n_tool validate || (find conf|grep prob; find conf|grep prob|xargs cat; false)" || echo "Problems with translations found" - - - name: Save images - if: env.NEEDS_BUILD != 'false' - run: | - set -euxo pipefail; - docker save \ - $(derex build openedx --only-print-image-name -t nostatic $DOCKER_IMAGES_SLUG) \ - $(derex build openedx --only-print-image-name -t dev $DOCKER_IMAGES_SLUG) \ - | pixz -0 > $IMAGE_CACHE_PATH/edx-$DOCKER_IMAGES_SLUG.tar.xz +# - name: Docker images cache +# if: steps.cache-sentinel.outputs.cache-hit != 'true' +# uses: actions/cache@v3 +# with: +# path: $IMAGE_CACHE_PATH +# key: BASE_SEED=$CACHE_KEY_BASE | $DOCKER_IMAGES_SLUG | $CACHE_KEY_IMAGES +# restore-keys: BASE_SEED=$CACHE_KEY_BASE | $DOCKER_IMAGES_SLUG +# +# - name: Load images +# if: steps.cache-sentinel.outputs.cache-hit != 'true' +# run: | +# [ -d $IMAGE_CACHE_PATH ] || exit 0 +# ls -l $IMAGE_CACHE_PATH +# docker images +# set -euxo pipefail +# cat $IMAGE_CACHE_PATH/edx-$DOCKER_IMAGES_SLUG.tar.xz | unxz | docker load +# docker images +# +# - name: Set needs_build pipeline variable +# if: steps.cache-sentinel.outputs.cache-hit != 'true' +# run: echo "NEEDS_BUILD=true" >> $GITHUB_ENV +# +# - name: Remove Haskell compiler and cached apt archives to save disk space +# if: env.NEEDS_BUILD != 'false' +# run: df -h; time sudo rm -rf /var/cache/apt/archives /opt/ghc; df -h +# +# - name: Prepare Transifex credentials +# if: env.NEEDS_BUILD != 'false' +# run: | +# if [ "$TRANSIFEX_USERNAME" == '$(TRANSIFEX_USERNAME)' ] || [ "$TRANSIFEX_PASSWORD" == '$(TRANSIFEX_PASSWORD)' ]; then +# echo "Transifex credentials unset. Building without translations." +# exit 0 +# fi +# printf '[https://www.transifex.com]\nhostname=https://www.transifex.com\nusername=%s\npassword=%s\n' "${TRANSIFEX_USERNAME}" "${TRANSIFEX_PASSWORD}" > $HOME/.transifexrc +# ls -l $GITHUB_WORKSPACE/.transifexrc +# env: +# TRANSIFEX_USERNAME: $(TRANSIFEX_USERNAME) +# TRANSIFEX_PASSWORD: $(TRANSIFEX_PASSWORD) +# +# - name: Setup docker images cache +# if: env.NEEDS_BUILD != 'false' +# run: | +# images=$(docker images|grep -v ''|grep derex|awk '{print $1 ":" $2}') +# CACHE_FROM_OPTS="" +# if [ -d $IMAGE_CACHE_PATH ]; then +# echo "Will use cached layers from images $images" +# for image in $images; do +# CACHE_FROM_OPTS="${CACHE_FROM_OPTS} --cache-from=$image" +# done +# else +# mkdir $IMAGE_CACHE_PATH +# fi +# echo "CACHE_FROM_OPTS=$CACHE_FROM_OPTS" >> $GITHUB_ENV +# mkdir $SENTINEL_CACHE_PATH +# cp -r $CACHE_KEY_FILES $SENTINEL_CACHE_PATH +# # We save the sha of the repo that built this image, so that we can push +# # it only in a build of the same commit, after tests are passed +# git rev-parse --verify HEAD > $SENTINEL_CACHE_PATH/built_version +# +# - name: Replace default docker with upsream docker and create build context +# if: env.NEEDS_BUILD != 'false' +# run: | +# set -ex +# sudo apt-get remove moby-cli -y +# curl -fsSL https://get.docker.com |sudo bash +# sudo mv /etc/docker/daemon.json /etc/docker/daemon.json.orig +# sudo cat /etc/docker/daemon.json.orig|jq '. + {experimental: true}' |sudo tee /etc/docker/daemon.json +# sudo systemctl restart docker.service +# docker version +# docker buildx create --use +# docker images +# sudo apt-get install pixz -y +# +# - uses: actions/setup-python@v4 +# with: +# python-version: "3.8" +# +# - name: Cache pip packages +# uses: actions/cache@v3 +# with: +# path: $GITHUB_WORKSPACE/.cache/pip +# key: pipcache | requirements_dev.txt +# restore-keys: pipcache +# +# - name: Install derex.runner +# if: env.NEEDS_BUILD != 'false' +# run: | +# pip3 install --cache-dir $GITHUB_WORKSPACE/.cache/pip -U pip setuptools +# pip3 install --cache-dir $GITHUB_WORKSPACE/.cache/pip -r requirements_dev.txt -e . +# +# - name: Build nostatic image +# if: env.NEEDS_BUILD != 'false' +# run: derex build openedx --docker-opts "${CACHE_FROM_OPTS} --cache-to=type=inline -o type=docker" --target=nostatic $DOCKER_IMAGES_SLUG +# +# - name: Build dev image +# if: env.NEEDS_BUILD != 'false' +# run: derex build openedx --docker-opts "--cache-to=type=inline -o type=docker" --target=dev $DOCKER_IMAGES_SLUG +# +# - name: Check translations +# if: env.NEEDS_BUILD != 'false' +# run: | +# docker images +# derex build openedx --docker-opts "${CACHE_FROM_OPTS} --output type=docker,name={docker_image_prefix}-{target}" --target=translations $DOCKER_IMAGES_SLUG +# docker images +# docker run --rm derex/openedx-$DOCKER_IMAGES_SLUG-translations:$(grep __version__ derex/runner/__init__.py |sed 's/[^"]*"//;s/"//') sh -c "i18n_tool validate || (find conf|grep prob; find conf|grep prob|xargs cat; false)" || echo "Problems with translations found" +# +# - name: Save images +# if: env.NEEDS_BUILD != 'false' +# run: | +# set -euxo pipefail; +# docker save \ +# $(derex build openedx --only-print-image-name -t nostatic $DOCKER_IMAGES_SLUG) \ +# $(derex build openedx --only-print-image-name -t dev $DOCKER_IMAGES_SLUG) \ +# | pixz -0 > $IMAGE_CACHE_PATH/edx-$DOCKER_IMAGES_SLUG.tar.xz koa: runs-on: ubuntu-latest diff --git a/azure-pipelines.yml b/azure-pipelines.yml deleted file mode 100644 index 082f5f4f..00000000 --- a/azure-pipelines.yml +++ /dev/null @@ -1,29 +0,0 @@ -schedules: - - cron: "30 06 * * *" - displayName: Daily build - branches: - include: - - master - always: true - -stages: - - template: azure-pipelines/juniper.yml - - template: azure-pipelines/test.yml - - template: azure-pipelines/push.yml - -variables: - - name: CACHE_KEY_BASE # Increment this value to reset the images cache - value: 22 - - name: CACHE_KEY_FILES - value: $(System.DefaultWorkingDirectory)/docker-definition/**/* - - name: CACHE_KEY_IMAGES - value: BASE_SEED=$(CACHE_KEY_BASE) | $(CACHE_KEY_FILES) - - name: IMAGE_CACHE_PATH - value: $(Pipeline.Workspace)/image_cache - - name: SENTINEL_CACHE_PATH - value: $(Pipeline.Workspace)/sentinel_cache - - name: UBUNTU_VERSION - value: ubuntu-latest - - - name: needs_build - value: "false" From 31f33eed95323ef6543e31881095c018ae3eba67 Mon Sep 17 00:00:00 2001 From: serhii Date: Mon, 8 Aug 2022 22:39:01 +0100 Subject: [PATCH 122/145] Test full pipeline --- .github/workflows/build.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 78761731..f679fe7d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,8 +1,8 @@ name: Build on: - - push - - schedule: - - cron: '30 06 * * *' + push + schedule: + - cron: '30 06 * * *' env: CACHE_KEY_BASE: 22 # Increment this value to reset the images cache From 3a79b5f98b976d507ac61d6f092e4bf88c163408 Mon Sep 17 00:00:00 2001 From: serhii Date: Mon, 8 Aug 2022 22:40:28 +0100 Subject: [PATCH 123/145] Test full pipeline --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f679fe7d..e2e95df1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,6 +1,6 @@ name: Build on: - push + push: schedule: - cron: '30 06 * * *' From 5f2a7df5fc31e61a9c19b262a4171fff1bd34ee7 Mon Sep 17 00:00:00 2001 From: serhii Date: Mon, 8 Aug 2022 22:45:40 +0100 Subject: [PATCH 124/145] Test full pipeline --- .github/workflows/build.yml | 13 +------------ .github/workflows/push.yaml | 2 +- .github/workflows/test.yml | 13 +------------ 3 files changed, 3 insertions(+), 25 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e2e95df1..987fc27b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -170,15 +170,4 @@ jobs: uses: actions/cache@v3 with: path: $(SENTINEL_CACHE_PATH) - key: SENTINEL=1 | $DOCKER_IMAGES_SLUG | $CACHE_KEY_IMAGES - - on-success: - runs-on: ubuntu-latest - if: ${{ github.event.workflow_run.conclusion == 'success' }} - steps: - - run: echo 'Workflow passed' - on-failure: - runs-on: ubuntu-latest - if: ${{ github.event.workflow_run.conclusion == 'failure' }} - steps: - - run: echo 'Workflow failed' \ No newline at end of file + key: SENTINEL=1 | $DOCKER_IMAGES_SLUG | $CACHE_KEY_IMAGES \ No newline at end of file diff --git a/.github/workflows/push.yaml b/.github/workflows/push.yaml index bdd0e96c..6019e96e 100644 --- a/.github/workflows/push.yaml +++ b/.github/workflows/push.yaml @@ -3,7 +3,7 @@ on: workflow_run: workflows: ["Test"] types: - - completed + - requested branches: - master - build diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d6a182b1..4700ed63 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -3,7 +3,7 @@ on: workflow_run: workflows: ["Build"] types: - - completed + - requested env: CACHE_KEY_BASE: 22 # Increment this value to reset the images cache @@ -526,14 +526,3 @@ jobs: uses: irongut/CodeCoverageSummary@v1.3.0 with: filename: coverage.xml - - on-success: - runs-on: ubuntu-latest - if: ${{ github.event.workflow_run.conclusion == 'success' }} - steps: - - run: echo 'Workflow passed' - on-failure: - runs-on: ubuntu-latest - if: ${{ github.event.workflow_run.conclusion == 'failure' }} - steps: - - run: echo 'Workflow failed' \ No newline at end of file From 9e23625445c693c4c715ad6b342b038c293fe5a1 Mon Sep 17 00:00:00 2001 From: serhii Date: Mon, 8 Aug 2022 22:48:56 +0100 Subject: [PATCH 125/145] Test full pipeline --- .github/workflows/push.yaml | 2 +- .github/workflows/test.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/push.yaml b/.github/workflows/push.yaml index 6019e96e..ec153824 100644 --- a/.github/workflows/push.yaml +++ b/.github/workflows/push.yaml @@ -1,7 +1,7 @@ name: Push on: workflow_run: - workflows: ["Test"] + workflows: [Test] types: - requested branches: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 4700ed63..a8fc126a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,7 +1,7 @@ name: Test on: workflow_run: - workflows: ["Build"] + workflows: [Build] types: - requested From 915dd1d4a13a9caa6ea35cd730543aa08e7635e0 Mon Sep 17 00:00:00 2001 From: serhii Date: Mon, 8 Aug 2022 22:50:30 +0100 Subject: [PATCH 126/145] Test full pipeline --- .github/workflows/build.yml | 232 ++++++++++++++++++------------------ .github/workflows/push.yaml | 2 +- .github/workflows/test.yml | 6 +- 3 files changed, 120 insertions(+), 120 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 987fc27b..ba17a693 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -2,7 +2,7 @@ name: Build on: push: schedule: - - cron: '30 06 * * *' + - cron: "30 06 * * *" env: CACHE_KEY_BASE: 22 # Increment this value to reset the images cache @@ -27,120 +27,120 @@ jobs: path: $SENTINEL_CACHE_PATH key: SENTINEL=1 | $DOCKER_IMAGES_SLUG | $CACHE_KEY_IMAGES -# - name: Docker images cache -# if: steps.cache-sentinel.outputs.cache-hit != 'true' -# uses: actions/cache@v3 -# with: -# path: $IMAGE_CACHE_PATH -# key: BASE_SEED=$CACHE_KEY_BASE | $DOCKER_IMAGES_SLUG | $CACHE_KEY_IMAGES -# restore-keys: BASE_SEED=$CACHE_KEY_BASE | $DOCKER_IMAGES_SLUG -# -# - name: Load images -# if: steps.cache-sentinel.outputs.cache-hit != 'true' -# run: | -# [ -d $IMAGE_CACHE_PATH ] || exit 0 -# ls -l $IMAGE_CACHE_PATH -# docker images -# set -euxo pipefail -# cat $IMAGE_CACHE_PATH/edx-$DOCKER_IMAGES_SLUG.tar.xz | unxz | docker load -# docker images -# -# - name: Set needs_build pipeline variable -# if: steps.cache-sentinel.outputs.cache-hit != 'true' -# run: echo "NEEDS_BUILD=true" >> $GITHUB_ENV -# -# - name: Remove Haskell compiler and cached apt archives to save disk space -# if: env.NEEDS_BUILD != 'false' -# run: df -h; time sudo rm -rf /var/cache/apt/archives /opt/ghc; df -h -# -# - name: Prepare Transifex credentials -# if: env.NEEDS_BUILD != 'false' -# run: | -# if [ "$TRANSIFEX_USERNAME" == '$(TRANSIFEX_USERNAME)' ] || [ "$TRANSIFEX_PASSWORD" == '$(TRANSIFEX_PASSWORD)' ]; then -# echo "Transifex credentials unset. Building without translations." -# exit 0 -# fi -# printf '[https://www.transifex.com]\nhostname=https://www.transifex.com\nusername=%s\npassword=%s\n' "${TRANSIFEX_USERNAME}" "${TRANSIFEX_PASSWORD}" > $HOME/.transifexrc -# ls -l $GITHUB_WORKSPACE/.transifexrc -# env: -# TRANSIFEX_USERNAME: $(TRANSIFEX_USERNAME) -# TRANSIFEX_PASSWORD: $(TRANSIFEX_PASSWORD) -# -# - name: Setup docker images cache -# if: env.NEEDS_BUILD != 'false' -# run: | -# images=$(docker images|grep -v ''|grep derex|awk '{print $1 ":" $2}') -# CACHE_FROM_OPTS="" -# if [ -d $IMAGE_CACHE_PATH ]; then -# echo "Will use cached layers from images $images" -# for image in $images; do -# CACHE_FROM_OPTS="${CACHE_FROM_OPTS} --cache-from=$image" -# done -# else -# mkdir $IMAGE_CACHE_PATH -# fi -# echo "CACHE_FROM_OPTS=$CACHE_FROM_OPTS" >> $GITHUB_ENV -# mkdir $SENTINEL_CACHE_PATH -# cp -r $CACHE_KEY_FILES $SENTINEL_CACHE_PATH -# # We save the sha of the repo that built this image, so that we can push -# # it only in a build of the same commit, after tests are passed -# git rev-parse --verify HEAD > $SENTINEL_CACHE_PATH/built_version -# -# - name: Replace default docker with upsream docker and create build context -# if: env.NEEDS_BUILD != 'false' -# run: | -# set -ex -# sudo apt-get remove moby-cli -y -# curl -fsSL https://get.docker.com |sudo bash -# sudo mv /etc/docker/daemon.json /etc/docker/daemon.json.orig -# sudo cat /etc/docker/daemon.json.orig|jq '. + {experimental: true}' |sudo tee /etc/docker/daemon.json -# sudo systemctl restart docker.service -# docker version -# docker buildx create --use -# docker images -# sudo apt-get install pixz -y -# -# - uses: actions/setup-python@v4 -# with: -# python-version: "3.8" -# -# - name: Cache pip packages -# uses: actions/cache@v3 -# with: -# path: $GITHUB_WORKSPACE/.cache/pip -# key: pipcache | requirements_dev.txt -# restore-keys: pipcache -# -# - name: Install derex.runner -# if: env.NEEDS_BUILD != 'false' -# run: | -# pip3 install --cache-dir $GITHUB_WORKSPACE/.cache/pip -U pip setuptools -# pip3 install --cache-dir $GITHUB_WORKSPACE/.cache/pip -r requirements_dev.txt -e . -# -# - name: Build nostatic image -# if: env.NEEDS_BUILD != 'false' -# run: derex build openedx --docker-opts "${CACHE_FROM_OPTS} --cache-to=type=inline -o type=docker" --target=nostatic $DOCKER_IMAGES_SLUG -# -# - name: Build dev image -# if: env.NEEDS_BUILD != 'false' -# run: derex build openedx --docker-opts "--cache-to=type=inline -o type=docker" --target=dev $DOCKER_IMAGES_SLUG -# -# - name: Check translations -# if: env.NEEDS_BUILD != 'false' -# run: | -# docker images -# derex build openedx --docker-opts "${CACHE_FROM_OPTS} --output type=docker,name={docker_image_prefix}-{target}" --target=translations $DOCKER_IMAGES_SLUG -# docker images -# docker run --rm derex/openedx-$DOCKER_IMAGES_SLUG-translations:$(grep __version__ derex/runner/__init__.py |sed 's/[^"]*"//;s/"//') sh -c "i18n_tool validate || (find conf|grep prob; find conf|grep prob|xargs cat; false)" || echo "Problems with translations found" -# -# - name: Save images -# if: env.NEEDS_BUILD != 'false' -# run: | -# set -euxo pipefail; -# docker save \ -# $(derex build openedx --only-print-image-name -t nostatic $DOCKER_IMAGES_SLUG) \ -# $(derex build openedx --only-print-image-name -t dev $DOCKER_IMAGES_SLUG) \ -# | pixz -0 > $IMAGE_CACHE_PATH/edx-$DOCKER_IMAGES_SLUG.tar.xz + # - name: Docker images cache + # if: steps.cache-sentinel.outputs.cache-hit != 'true' + # uses: actions/cache@v3 + # with: + # path: $IMAGE_CACHE_PATH + # key: BASE_SEED=$CACHE_KEY_BASE | $DOCKER_IMAGES_SLUG | $CACHE_KEY_IMAGES + # restore-keys: BASE_SEED=$CACHE_KEY_BASE | $DOCKER_IMAGES_SLUG + # + # - name: Load images + # if: steps.cache-sentinel.outputs.cache-hit != 'true' + # run: | + # [ -d $IMAGE_CACHE_PATH ] || exit 0 + # ls -l $IMAGE_CACHE_PATH + # docker images + # set -euxo pipefail + # cat $IMAGE_CACHE_PATH/edx-$DOCKER_IMAGES_SLUG.tar.xz | unxz | docker load + # docker images + # + # - name: Set needs_build pipeline variable + # if: steps.cache-sentinel.outputs.cache-hit != 'true' + # run: echo "NEEDS_BUILD=true" >> $GITHUB_ENV + # + # - name: Remove Haskell compiler and cached apt archives to save disk space + # if: env.NEEDS_BUILD != 'false' + # run: df -h; time sudo rm -rf /var/cache/apt/archives /opt/ghc; df -h + # + # - name: Prepare Transifex credentials + # if: env.NEEDS_BUILD != 'false' + # run: | + # if [ "$TRANSIFEX_USERNAME" == '$(TRANSIFEX_USERNAME)' ] || [ "$TRANSIFEX_PASSWORD" == '$(TRANSIFEX_PASSWORD)' ]; then + # echo "Transifex credentials unset. Building without translations." + # exit 0 + # fi + # printf '[https://www.transifex.com]\nhostname=https://www.transifex.com\nusername=%s\npassword=%s\n' "${TRANSIFEX_USERNAME}" "${TRANSIFEX_PASSWORD}" > $HOME/.transifexrc + # ls -l $GITHUB_WORKSPACE/.transifexrc + # env: + # TRANSIFEX_USERNAME: $(TRANSIFEX_USERNAME) + # TRANSIFEX_PASSWORD: $(TRANSIFEX_PASSWORD) + # + # - name: Setup docker images cache + # if: env.NEEDS_BUILD != 'false' + # run: | + # images=$(docker images|grep -v ''|grep derex|awk '{print $1 ":" $2}') + # CACHE_FROM_OPTS="" + # if [ -d $IMAGE_CACHE_PATH ]; then + # echo "Will use cached layers from images $images" + # for image in $images; do + # CACHE_FROM_OPTS="${CACHE_FROM_OPTS} --cache-from=$image" + # done + # else + # mkdir $IMAGE_CACHE_PATH + # fi + # echo "CACHE_FROM_OPTS=$CACHE_FROM_OPTS" >> $GITHUB_ENV + # mkdir $SENTINEL_CACHE_PATH + # cp -r $CACHE_KEY_FILES $SENTINEL_CACHE_PATH + # # We save the sha of the repo that built this image, so that we can push + # # it only in a build of the same commit, after tests are passed + # git rev-parse --verify HEAD > $SENTINEL_CACHE_PATH/built_version + # + # - name: Replace default docker with upsream docker and create build context + # if: env.NEEDS_BUILD != 'false' + # run: | + # set -ex + # sudo apt-get remove moby-cli -y + # curl -fsSL https://get.docker.com |sudo bash + # sudo mv /etc/docker/daemon.json /etc/docker/daemon.json.orig + # sudo cat /etc/docker/daemon.json.orig|jq '. + {experimental: true}' |sudo tee /etc/docker/daemon.json + # sudo systemctl restart docker.service + # docker version + # docker buildx create --use + # docker images + # sudo apt-get install pixz -y + # + # - uses: actions/setup-python@v4 + # with: + # python-version: "3.8" + # + # - name: Cache pip packages + # uses: actions/cache@v3 + # with: + # path: $GITHUB_WORKSPACE/.cache/pip + # key: pipcache | requirements_dev.txt + # restore-keys: pipcache + # + # - name: Install derex.runner + # if: env.NEEDS_BUILD != 'false' + # run: | + # pip3 install --cache-dir $GITHUB_WORKSPACE/.cache/pip -U pip setuptools + # pip3 install --cache-dir $GITHUB_WORKSPACE/.cache/pip -r requirements_dev.txt -e . + # + # - name: Build nostatic image + # if: env.NEEDS_BUILD != 'false' + # run: derex build openedx --docker-opts "${CACHE_FROM_OPTS} --cache-to=type=inline -o type=docker" --target=nostatic $DOCKER_IMAGES_SLUG + # + # - name: Build dev image + # if: env.NEEDS_BUILD != 'false' + # run: derex build openedx --docker-opts "--cache-to=type=inline -o type=docker" --target=dev $DOCKER_IMAGES_SLUG + # + # - name: Check translations + # if: env.NEEDS_BUILD != 'false' + # run: | + # docker images + # derex build openedx --docker-opts "${CACHE_FROM_OPTS} --output type=docker,name={docker_image_prefix}-{target}" --target=translations $DOCKER_IMAGES_SLUG + # docker images + # docker run --rm derex/openedx-$DOCKER_IMAGES_SLUG-translations:$(grep __version__ derex/runner/__init__.py |sed 's/[^"]*"//;s/"//') sh -c "i18n_tool validate || (find conf|grep prob; find conf|grep prob|xargs cat; false)" || echo "Problems with translations found" + # + # - name: Save images + # if: env.NEEDS_BUILD != 'false' + # run: | + # set -euxo pipefail; + # docker save \ + # $(derex build openedx --only-print-image-name -t nostatic $DOCKER_IMAGES_SLUG) \ + # $(derex build openedx --only-print-image-name -t dev $DOCKER_IMAGES_SLUG) \ + # | pixz -0 > $IMAGE_CACHE_PATH/edx-$DOCKER_IMAGES_SLUG.tar.xz koa: runs-on: ubuntu-latest @@ -170,4 +170,4 @@ jobs: uses: actions/cache@v3 with: path: $(SENTINEL_CACHE_PATH) - key: SENTINEL=1 | $DOCKER_IMAGES_SLUG | $CACHE_KEY_IMAGES \ No newline at end of file + key: SENTINEL=1 | $DOCKER_IMAGES_SLUG | $CACHE_KEY_IMAGES diff --git a/.github/workflows/push.yaml b/.github/workflows/push.yaml index ec153824..2db90bfd 100644 --- a/.github/workflows/push.yaml +++ b/.github/workflows/push.yaml @@ -72,4 +72,4 @@ jobs: - name: Push nostatic image if: env.NEEDS_PUSH != 'false' - run: docker push derex/openedx-${{ matrix.OPENEDX_RELEASE }}-nostatic:$(grep __version__ derex/runner/__init__.py |sed 's/[^"]*"//;s/"//') \ No newline at end of file + run: docker push derex/openedx-${{ matrix.OPENEDX_RELEASE }}-nostatic:$(grep __version__ derex/runner/__init__.py |sed 's/[^"]*"//;s/"//') diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a8fc126a..933a3dc4 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,9 +1,9 @@ name: Test on: workflow_run: - workflows: [Build] - types: - - requested + workflows: [Build] + types: + - requested env: CACHE_KEY_BASE: 22 # Increment this value to reset the images cache From 2c0351bb36ed81e4834860b60d907d35dc357887 Mon Sep 17 00:00:00 2001 From: serhii Date: Mon, 8 Aug 2022 22:52:52 +0100 Subject: [PATCH 127/145] Test full pipeline --- .github/workflows/push.yaml | 3 +-- .github/workflows/test.yml | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/push.yaml b/.github/workflows/push.yaml index 2db90bfd..4647d5a0 100644 --- a/.github/workflows/push.yaml +++ b/.github/workflows/push.yaml @@ -2,8 +2,7 @@ name: Push on: workflow_run: workflows: [Test] - types: - - requested + types: [requested] branches: - master - build diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 933a3dc4..283a6f7f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -2,8 +2,7 @@ name: Test on: workflow_run: workflows: [Build] - types: - - requested + types: [requested] env: CACHE_KEY_BASE: 22 # Increment this value to reset the images cache From 3a16bf04e8250f8e7b15f545f0365215ed129341 Mon Sep 17 00:00:00 2001 From: serhii Date: Mon, 8 Aug 2022 22:53:49 +0100 Subject: [PATCH 128/145] Test full pipeline --- .github/workflows/push.yaml | 2 +- .github/workflows/test.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/push.yaml b/.github/workflows/push.yaml index 4647d5a0..713ba9d5 100644 --- a/.github/workflows/push.yaml +++ b/.github/workflows/push.yaml @@ -1,7 +1,7 @@ name: Push on: workflow_run: - workflows: [Test] + workflows: ["Test"] types: [requested] branches: - master diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 283a6f7f..11bd3ad7 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,7 +1,7 @@ name: Test on: workflow_run: - workflows: [Build] + workflows: ["Build"] types: [requested] env: From b8679c319fb106c9f882eb37ae09fa1b9d6bba04 Mon Sep 17 00:00:00 2001 From: serhii Date: Mon, 8 Aug 2022 22:55:01 +0100 Subject: [PATCH 129/145] Test full pipeline --- .github/workflows/push.yaml | 1 + .github/workflows/test.yml | 1 + 2 files changed, 2 insertions(+) diff --git a/.github/workflows/push.yaml b/.github/workflows/push.yaml index 713ba9d5..d68e04d7 100644 --- a/.github/workflows/push.yaml +++ b/.github/workflows/push.yaml @@ -1,5 +1,6 @@ name: Push on: + push: workflow_run: workflows: ["Test"] types: [requested] diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 11bd3ad7..cd6cedd5 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,5 +1,6 @@ name: Test on: + push: workflow_run: workflows: ["Build"] types: [requested] From 0f859d03703fdb9f82450e2ab09f37af689c710b Mon Sep 17 00:00:00 2001 From: serhii Date: Mon, 8 Aug 2022 22:56:43 +0100 Subject: [PATCH 130/145] Test full pipeline --- .github/workflows/push.yaml | 15 ++++++++++++++- .github/workflows/test.yml | 15 ++++++++++++++- 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/.github/workflows/push.yaml b/.github/workflows/push.yaml index d68e04d7..38da821d 100644 --- a/.github/workflows/push.yaml +++ b/.github/workflows/push.yaml @@ -3,10 +3,12 @@ on: push: workflow_run: workflows: ["Test"] - types: [requested] + types: [completed] branches: - master - build + schedule: + - cron: "30 06 * * *" env: CACHE_KEY_BASE: 22 # Increment this value to reset the images cache @@ -73,3 +75,14 @@ jobs: - name: Push nostatic image if: env.NEEDS_PUSH != 'false' run: docker push derex/openedx-${{ matrix.OPENEDX_RELEASE }}-nostatic:$(grep __version__ derex/runner/__init__.py |sed 's/[^"]*"//;s/"//') + + on-success: + runs-on: ubuntu-latest + if: ${{ github.event.workflow_run.conclusion == 'success' }} + steps: + - run: echo 'The triggering workflow passed' + on-failure: + runs-on: ubuntu-latest + if: ${{ github.event.workflow_run.conclusion == 'failure' }} + steps: + - run: echo 'The triggering workflow failed' \ No newline at end of file diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index cd6cedd5..45b34683 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -3,7 +3,9 @@ on: push: workflow_run: workflows: ["Build"] - types: [requested] + types: [completed] + schedule: + - cron: "30 06 * * *" env: CACHE_KEY_BASE: 22 # Increment this value to reset the images cache @@ -526,3 +528,14 @@ jobs: uses: irongut/CodeCoverageSummary@v1.3.0 with: filename: coverage.xml + + on-success: + runs-on: ubuntu-latest + if: ${{ github.event.workflow_run.conclusion == 'success' }} + steps: + - run: echo 'The triggering workflow passed' + on-failure: + runs-on: ubuntu-latest + if: ${{ github.event.workflow_run.conclusion == 'failure' }} + steps: + - run: echo 'The triggering workflow failed' \ No newline at end of file From 90e5f3efe9e9fdec210422068b760aba3ede29e0 Mon Sep 17 00:00:00 2001 From: serhii Date: Mon, 8 Aug 2022 22:58:30 +0100 Subject: [PATCH 131/145] Test full pipeline --- .github/workflows/push.yaml | 3 +-- .github/workflows/test.yml | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/push.yaml b/.github/workflows/push.yaml index 38da821d..4ad718b9 100644 --- a/.github/workflows/push.yaml +++ b/.github/workflows/push.yaml @@ -21,7 +21,6 @@ jobs: Push: runs-on: ubuntu-latest timeout-minutes: 20 - needs: [TestProject] strategy: fail-fast: false matrix: @@ -85,4 +84,4 @@ jobs: runs-on: ubuntu-latest if: ${{ github.event.workflow_run.conclusion == 'failure' }} steps: - - run: echo 'The triggering workflow failed' \ No newline at end of file + - run: echo 'The triggering workflow failed' diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 45b34683..3f32fa0a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -538,4 +538,4 @@ jobs: runs-on: ubuntu-latest if: ${{ github.event.workflow_run.conclusion == 'failure' }} steps: - - run: echo 'The triggering workflow failed' \ No newline at end of file + - run: echo 'The triggering workflow failed' From f1dd840c09d4bf5b92082330bf1494d97c9f9b34 Mon Sep 17 00:00:00 2001 From: serhii Date: Mon, 8 Aug 2022 23:00:00 +0100 Subject: [PATCH 132/145] Test full pipeline --- .github/workflows/push.yaml | 3 --- .github/workflows/test.yml | 3 --- 2 files changed, 6 deletions(-) diff --git a/.github/workflows/push.yaml b/.github/workflows/push.yaml index 4ad718b9..fe22e86c 100644 --- a/.github/workflows/push.yaml +++ b/.github/workflows/push.yaml @@ -1,14 +1,11 @@ name: Push on: - push: workflow_run: workflows: ["Test"] types: [completed] branches: - master - build - schedule: - - cron: "30 06 * * *" env: CACHE_KEY_BASE: 22 # Increment this value to reset the images cache diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 3f32fa0a..91fdc13a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,11 +1,8 @@ name: Test on: - push: workflow_run: workflows: ["Build"] types: [completed] - schedule: - - cron: "30 06 * * *" env: CACHE_KEY_BASE: 22 # Increment this value to reset the images cache From 6d8caa78828411de2a6fff3b9aa4d82d5777a81b Mon Sep 17 00:00:00 2001 From: serhii Date: Mon, 8 Aug 2022 23:02:39 +0100 Subject: [PATCH 133/145] Test full pipeline --- .github/workflows/push.yaml | 12 +----------- .github/workflows/test.yml | 18 ++++++------------ 2 files changed, 7 insertions(+), 23 deletions(-) diff --git a/.github/workflows/push.yaml b/.github/workflows/push.yaml index fe22e86c..c6a190fd 100644 --- a/.github/workflows/push.yaml +++ b/.github/workflows/push.yaml @@ -18,6 +18,7 @@ jobs: Push: runs-on: ubuntu-latest timeout-minutes: 20 + if: ${{ github.event.workflow_run.conclusion == 'success' }} strategy: fail-fast: false matrix: @@ -71,14 +72,3 @@ jobs: - name: Push nostatic image if: env.NEEDS_PUSH != 'false' run: docker push derex/openedx-${{ matrix.OPENEDX_RELEASE }}-nostatic:$(grep __version__ derex/runner/__init__.py |sed 's/[^"]*"//;s/"//') - - on-success: - runs-on: ubuntu-latest - if: ${{ github.event.workflow_run.conclusion == 'success' }} - steps: - - run: echo 'The triggering workflow passed' - on-failure: - runs-on: ubuntu-latest - if: ${{ github.event.workflow_run.conclusion == 'failure' }} - steps: - - run: echo 'The triggering workflow failed' diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 91fdc13a..07fa2b3d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -17,7 +17,7 @@ jobs: CheckDocsAndPreCommit: runs-on: ubuntu-latest timeout-minutes: 5 - + if: ${{ github.event.workflow_run.conclusion == 'success' }} steps: - uses: actions/checkout@v3 @@ -47,6 +47,7 @@ jobs: BuildBinaries: runs-on: ubuntu-latest timeout-minutes: 20 + if: ${{ github.event.workflow_run.conclusion == 'success' }} needs: [CheckDocsAndPreCommit] strategy: fail-fast: false @@ -117,6 +118,7 @@ jobs: RunPytests: runs-on: ubuntu-latest timeout-minutes: 20 + if: ${{ github.event.workflow_run.conclusion == 'success' }} needs: [CheckDocsAndPreCommit] strategy: fail-fast: false @@ -160,6 +162,7 @@ jobs: RunSlowPytests: runs-on: ubuntu-latest timeout-minutes: 20 + if: ${{ github.event.workflow_run.conclusion == 'success' }} needs: [CheckDocsAndPreCommit] strategy: fail-fast: false @@ -230,6 +233,7 @@ jobs: TestProject: runs-on: ubuntu-latest timeout-minutes: 30 + if: ${{ github.event.workflow_run.conclusion == 'success' }} needs: [CheckDocsAndPreCommit] strategy: fail-fast: false @@ -462,6 +466,7 @@ jobs: CombineCoverage: runs-on: ubuntu-latest timeout-minutes: 10 + if: ${{ github.event.workflow_run.conclusion == 'success' }} needs: [RunPytests, RunSlowPytests] steps: @@ -525,14 +530,3 @@ jobs: uses: irongut/CodeCoverageSummary@v1.3.0 with: filename: coverage.xml - - on-success: - runs-on: ubuntu-latest - if: ${{ github.event.workflow_run.conclusion == 'success' }} - steps: - - run: echo 'The triggering workflow passed' - on-failure: - runs-on: ubuntu-latest - if: ${{ github.event.workflow_run.conclusion == 'failure' }} - steps: - - run: echo 'The triggering workflow failed' From 6a7a491828ff535e66493a3df7e3bd836b7cfb2b Mon Sep 17 00:00:00 2001 From: serhii Date: Tue, 16 Aug 2022 16:46:47 +0100 Subject: [PATCH 134/145] Added separate workflow on push --- .github/workflows/build.yml | 4 ---- .github/workflows/on_push.yml | 18 ++++++++++++++++++ .github/workflows/push.yaml | 7 ------- .github/workflows/test.yml | 4 ---- 4 files changed, 18 insertions(+), 15 deletions(-) create mode 100644 .github/workflows/on_push.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ba17a693..ef4ef72a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,8 +1,4 @@ name: Build -on: - push: - schedule: - - cron: "30 06 * * *" env: CACHE_KEY_BASE: 22 # Increment this value to reset the images cache diff --git a/.github/workflows/on_push.yml b/.github/workflows/on_push.yml new file mode 100644 index 00000000..637bc797 --- /dev/null +++ b/.github/workflows/on_push.yml @@ -0,0 +1,18 @@ +name: on_push + +on: + push + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + build: + uses: .github/workflows/build.yml + + test: + uses: .github/workflows/build.yml + + push: + uses: .github/workflows/push.yml \ No newline at end of file diff --git a/.github/workflows/push.yaml b/.github/workflows/push.yaml index c6a190fd..8fcb076e 100644 --- a/.github/workflows/push.yaml +++ b/.github/workflows/push.yaml @@ -1,11 +1,4 @@ name: Push -on: - workflow_run: - workflows: ["Test"] - types: [completed] - branches: - - master - - build env: CACHE_KEY_BASE: 22 # Increment this value to reset the images cache diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 07fa2b3d..0c097495 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,8 +1,4 @@ name: Test -on: - workflow_run: - workflows: ["Build"] - types: [completed] env: CACHE_KEY_BASE: 22 # Increment this value to reset the images cache From 17882a70339af38ff234632525e108b191cc287f Mon Sep 17 00:00:00 2001 From: serhii Date: Tue, 16 Aug 2022 16:48:25 +0100 Subject: [PATCH 135/145] Added separate workflow on push --- .github/workflows/on_push.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/on_push.yml b/.github/workflows/on_push.yml index 637bc797..72794133 100644 --- a/.github/workflows/on_push.yml +++ b/.github/workflows/on_push.yml @@ -9,10 +9,10 @@ concurrency: jobs: build: - uses: .github/workflows/build.yml + uses: .github/workflows/build.yml@migrate_to_github_actions test: - uses: .github/workflows/build.yml + uses: .github/workflows/build.yml@migrate_to_github_actions push: - uses: .github/workflows/push.yml \ No newline at end of file + uses: .github/workflows/push.yml@migrate_to_github_actions \ No newline at end of file From fd27565c8c713572f41a3ec89e2631afc836b104 Mon Sep 17 00:00:00 2001 From: serhii Date: Tue, 16 Aug 2022 16:49:28 +0100 Subject: [PATCH 136/145] Added separate workflow on push --- .github/workflows/build.yml | 3 +++ .github/workflows/push.yaml | 3 +++ .github/workflows/test.yml | 3 +++ 3 files changed, 9 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ef4ef72a..3c8bca2a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,5 +1,8 @@ name: Build +on: + push + env: CACHE_KEY_BASE: 22 # Increment this value to reset the images cache CACHE_KEY_FILES: ${{ github.workspace }}/docker-definition diff --git a/.github/workflows/push.yaml b/.github/workflows/push.yaml index 8fcb076e..8c9eebe2 100644 --- a/.github/workflows/push.yaml +++ b/.github/workflows/push.yaml @@ -1,5 +1,8 @@ name: Push +on: + push + env: CACHE_KEY_BASE: 22 # Increment this value to reset the images cache CACHE_KEY_FILES: ${{ github.workspace }}/docker-definition diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 0c097495..946d6a13 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,5 +1,8 @@ name: Test +on: + push + env: CACHE_KEY_BASE: 22 # Increment this value to reset the images cache CACHE_KEY_FILES: ${{ github.workspace }}/docker-definition From 04095053571e323faa1c3118bb440ad79212e342 Mon Sep 17 00:00:00 2001 From: serhii Date: Tue, 16 Aug 2022 16:50:35 +0100 Subject: [PATCH 137/145] Added separate workflow on push --- .github/workflows/on_push.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/on_push.yml b/.github/workflows/on_push.yml index 72794133..637bc797 100644 --- a/.github/workflows/on_push.yml +++ b/.github/workflows/on_push.yml @@ -9,10 +9,10 @@ concurrency: jobs: build: - uses: .github/workflows/build.yml@migrate_to_github_actions + uses: .github/workflows/build.yml test: - uses: .github/workflows/build.yml@migrate_to_github_actions + uses: .github/workflows/build.yml push: - uses: .github/workflows/push.yml@migrate_to_github_actions \ No newline at end of file + uses: .github/workflows/push.yml \ No newline at end of file From 7e359e65e753955134f84a05a78a404832093815 Mon Sep 17 00:00:00 2001 From: serhii Date: Tue, 16 Aug 2022 16:51:36 +0100 Subject: [PATCH 138/145] Added separate workflow on push --- .github/workflows/on_push.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/on_push.yml b/.github/workflows/on_push.yml index 637bc797..16f5b3d0 100644 --- a/.github/workflows/on_push.yml +++ b/.github/workflows/on_push.yml @@ -9,10 +9,10 @@ concurrency: jobs: build: - uses: .github/workflows/build.yml + uses: ./.github/workflows/build.yml test: - uses: .github/workflows/build.yml + uses: ./.github/workflows/build.yml push: - uses: .github/workflows/push.yml \ No newline at end of file + uses: ./.github/workflows/push.yml \ No newline at end of file From 40da16b22250220c4c9844179612951ffb06d4b0 Mon Sep 17 00:00:00 2001 From: serhii Date: Tue, 16 Aug 2022 16:52:39 +0100 Subject: [PATCH 139/145] Added separate workflow on push --- .github/workflows/on_push.yml | 2 +- .github/workflows/{push.yaml => push.yml} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename .github/workflows/{push.yaml => push.yml} (100%) diff --git a/.github/workflows/on_push.yml b/.github/workflows/on_push.yml index 16f5b3d0..3b3ef2db 100644 --- a/.github/workflows/on_push.yml +++ b/.github/workflows/on_push.yml @@ -12,7 +12,7 @@ jobs: uses: ./.github/workflows/build.yml test: - uses: ./.github/workflows/build.yml + uses: ./.github/workflows/test.yml push: uses: ./.github/workflows/push.yml \ No newline at end of file diff --git a/.github/workflows/push.yaml b/.github/workflows/push.yml similarity index 100% rename from .github/workflows/push.yaml rename to .github/workflows/push.yml From 67bd14ad35d56a522adc4890bed5a451c9955180 Mon Sep 17 00:00:00 2001 From: serhii Date: Tue, 16 Aug 2022 16:55:30 +0100 Subject: [PATCH 140/145] Added separate workflow on push --- .github/workflows/build.yml | 2 +- .github/workflows/push.yml | 2 +- .github/workflows/test.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3c8bca2a..2c8d3340 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,7 +1,7 @@ name: Build on: - push + workflow_call: env: CACHE_KEY_BASE: 22 # Increment this value to reset the images cache diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 8c9eebe2..16264afc 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -1,7 +1,7 @@ name: Push on: - push + workflow_call: env: CACHE_KEY_BASE: 22 # Increment this value to reset the images cache diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 946d6a13..a1524921 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,7 +1,7 @@ name: Test on: - push + workflow_call: env: CACHE_KEY_BASE: 22 # Increment this value to reset the images cache From ec2f58255a3ddeeb62c572a09f8b0bb0a005445c Mon Sep 17 00:00:00 2001 From: serhii Date: Tue, 16 Aug 2022 16:56:40 +0100 Subject: [PATCH 141/145] Added separate workflow on push --- .github/workflows/on_push.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/on_push.yml b/.github/workflows/on_push.yml index 3b3ef2db..f0f996e3 100644 --- a/.github/workflows/on_push.yml +++ b/.github/workflows/on_push.yml @@ -3,10 +3,6 @@ name: on_push on: push -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - jobs: build: uses: ./.github/workflows/build.yml From ae64702930b80327e7473cc292e4188fa01ac7dc Mon Sep 17 00:00:00 2001 From: serhii Date: Tue, 16 Aug 2022 16:57:57 +0100 Subject: [PATCH 142/145] Added separate workflow on push --- .github/workflows/on_push.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/on_push.yml b/.github/workflows/on_push.yml index f0f996e3..3560369c 100644 --- a/.github/workflows/on_push.yml +++ b/.github/workflows/on_push.yml @@ -9,6 +9,8 @@ jobs: test: uses: ./.github/workflows/test.yml + needs: [build] push: - uses: ./.github/workflows/push.yml \ No newline at end of file + uses: ./.github/workflows/push.yml + needs: [build, test] \ No newline at end of file From 88beeadec459ca130f9f9ac4e8dc079b7ebbfed9 Mon Sep 17 00:00:00 2001 From: serhii Date: Tue, 16 Aug 2022 17:00:54 +0100 Subject: [PATCH 143/145] Added separate workflow on push --- .github/workflows/push.yml | 1 - .github/workflows/test.yml | 6 ------ 2 files changed, 7 deletions(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 16264afc..b9f67e13 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -14,7 +14,6 @@ jobs: Push: runs-on: ubuntu-latest timeout-minutes: 20 - if: ${{ github.event.workflow_run.conclusion == 'success' }} strategy: fail-fast: false matrix: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a1524921..e9cbe6c0 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -16,7 +16,6 @@ jobs: CheckDocsAndPreCommit: runs-on: ubuntu-latest timeout-minutes: 5 - if: ${{ github.event.workflow_run.conclusion == 'success' }} steps: - uses: actions/checkout@v3 @@ -46,7 +45,6 @@ jobs: BuildBinaries: runs-on: ubuntu-latest timeout-minutes: 20 - if: ${{ github.event.workflow_run.conclusion == 'success' }} needs: [CheckDocsAndPreCommit] strategy: fail-fast: false @@ -117,7 +115,6 @@ jobs: RunPytests: runs-on: ubuntu-latest timeout-minutes: 20 - if: ${{ github.event.workflow_run.conclusion == 'success' }} needs: [CheckDocsAndPreCommit] strategy: fail-fast: false @@ -161,7 +158,6 @@ jobs: RunSlowPytests: runs-on: ubuntu-latest timeout-minutes: 20 - if: ${{ github.event.workflow_run.conclusion == 'success' }} needs: [CheckDocsAndPreCommit] strategy: fail-fast: false @@ -232,7 +228,6 @@ jobs: TestProject: runs-on: ubuntu-latest timeout-minutes: 30 - if: ${{ github.event.workflow_run.conclusion == 'success' }} needs: [CheckDocsAndPreCommit] strategy: fail-fast: false @@ -465,7 +460,6 @@ jobs: CombineCoverage: runs-on: ubuntu-latest timeout-minutes: 10 - if: ${{ github.event.workflow_run.conclusion == 'success' }} needs: [RunPytests, RunSlowPytests] steps: From 367fb8e7a0e60af761a73630b0ad32f4e60c1be6 Mon Sep 17 00:00:00 2001 From: serhii Date: Tue, 16 Aug 2022 17:06:29 +0100 Subject: [PATCH 144/145] Added separate workflow on push --- .github/workflows/build.yml | 458 +++++++++++++++++++++++++--------- .github/workflows/on_push.yml | 9 +- 2 files changed, 350 insertions(+), 117 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2c8d3340..9f38116f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -26,120 +26,120 @@ jobs: path: $SENTINEL_CACHE_PATH key: SENTINEL=1 | $DOCKER_IMAGES_SLUG | $CACHE_KEY_IMAGES - # - name: Docker images cache - # if: steps.cache-sentinel.outputs.cache-hit != 'true' - # uses: actions/cache@v3 - # with: - # path: $IMAGE_CACHE_PATH - # key: BASE_SEED=$CACHE_KEY_BASE | $DOCKER_IMAGES_SLUG | $CACHE_KEY_IMAGES - # restore-keys: BASE_SEED=$CACHE_KEY_BASE | $DOCKER_IMAGES_SLUG - # - # - name: Load images - # if: steps.cache-sentinel.outputs.cache-hit != 'true' - # run: | - # [ -d $IMAGE_CACHE_PATH ] || exit 0 - # ls -l $IMAGE_CACHE_PATH - # docker images - # set -euxo pipefail - # cat $IMAGE_CACHE_PATH/edx-$DOCKER_IMAGES_SLUG.tar.xz | unxz | docker load - # docker images - # - # - name: Set needs_build pipeline variable - # if: steps.cache-sentinel.outputs.cache-hit != 'true' - # run: echo "NEEDS_BUILD=true" >> $GITHUB_ENV - # - # - name: Remove Haskell compiler and cached apt archives to save disk space - # if: env.NEEDS_BUILD != 'false' - # run: df -h; time sudo rm -rf /var/cache/apt/archives /opt/ghc; df -h - # - # - name: Prepare Transifex credentials - # if: env.NEEDS_BUILD != 'false' - # run: | - # if [ "$TRANSIFEX_USERNAME" == '$(TRANSIFEX_USERNAME)' ] || [ "$TRANSIFEX_PASSWORD" == '$(TRANSIFEX_PASSWORD)' ]; then - # echo "Transifex credentials unset. Building without translations." - # exit 0 - # fi - # printf '[https://www.transifex.com]\nhostname=https://www.transifex.com\nusername=%s\npassword=%s\n' "${TRANSIFEX_USERNAME}" "${TRANSIFEX_PASSWORD}" > $HOME/.transifexrc - # ls -l $GITHUB_WORKSPACE/.transifexrc - # env: - # TRANSIFEX_USERNAME: $(TRANSIFEX_USERNAME) - # TRANSIFEX_PASSWORD: $(TRANSIFEX_PASSWORD) - # - # - name: Setup docker images cache - # if: env.NEEDS_BUILD != 'false' - # run: | - # images=$(docker images|grep -v ''|grep derex|awk '{print $1 ":" $2}') - # CACHE_FROM_OPTS="" - # if [ -d $IMAGE_CACHE_PATH ]; then - # echo "Will use cached layers from images $images" - # for image in $images; do - # CACHE_FROM_OPTS="${CACHE_FROM_OPTS} --cache-from=$image" - # done - # else - # mkdir $IMAGE_CACHE_PATH - # fi - # echo "CACHE_FROM_OPTS=$CACHE_FROM_OPTS" >> $GITHUB_ENV - # mkdir $SENTINEL_CACHE_PATH - # cp -r $CACHE_KEY_FILES $SENTINEL_CACHE_PATH - # # We save the sha of the repo that built this image, so that we can push - # # it only in a build of the same commit, after tests are passed - # git rev-parse --verify HEAD > $SENTINEL_CACHE_PATH/built_version - # - # - name: Replace default docker with upsream docker and create build context - # if: env.NEEDS_BUILD != 'false' - # run: | - # set -ex - # sudo apt-get remove moby-cli -y - # curl -fsSL https://get.docker.com |sudo bash - # sudo mv /etc/docker/daemon.json /etc/docker/daemon.json.orig - # sudo cat /etc/docker/daemon.json.orig|jq '. + {experimental: true}' |sudo tee /etc/docker/daemon.json - # sudo systemctl restart docker.service - # docker version - # docker buildx create --use - # docker images - # sudo apt-get install pixz -y - # - # - uses: actions/setup-python@v4 - # with: - # python-version: "3.8" - # - # - name: Cache pip packages - # uses: actions/cache@v3 - # with: - # path: $GITHUB_WORKSPACE/.cache/pip - # key: pipcache | requirements_dev.txt - # restore-keys: pipcache - # - # - name: Install derex.runner - # if: env.NEEDS_BUILD != 'false' - # run: | - # pip3 install --cache-dir $GITHUB_WORKSPACE/.cache/pip -U pip setuptools - # pip3 install --cache-dir $GITHUB_WORKSPACE/.cache/pip -r requirements_dev.txt -e . - # - # - name: Build nostatic image - # if: env.NEEDS_BUILD != 'false' - # run: derex build openedx --docker-opts "${CACHE_FROM_OPTS} --cache-to=type=inline -o type=docker" --target=nostatic $DOCKER_IMAGES_SLUG - # - # - name: Build dev image - # if: env.NEEDS_BUILD != 'false' - # run: derex build openedx --docker-opts "--cache-to=type=inline -o type=docker" --target=dev $DOCKER_IMAGES_SLUG - # - # - name: Check translations - # if: env.NEEDS_BUILD != 'false' - # run: | - # docker images - # derex build openedx --docker-opts "${CACHE_FROM_OPTS} --output type=docker,name={docker_image_prefix}-{target}" --target=translations $DOCKER_IMAGES_SLUG - # docker images - # docker run --rm derex/openedx-$DOCKER_IMAGES_SLUG-translations:$(grep __version__ derex/runner/__init__.py |sed 's/[^"]*"//;s/"//') sh -c "i18n_tool validate || (find conf|grep prob; find conf|grep prob|xargs cat; false)" || echo "Problems with translations found" - # - # - name: Save images - # if: env.NEEDS_BUILD != 'false' - # run: | - # set -euxo pipefail; - # docker save \ - # $(derex build openedx --only-print-image-name -t nostatic $DOCKER_IMAGES_SLUG) \ - # $(derex build openedx --only-print-image-name -t dev $DOCKER_IMAGES_SLUG) \ - # | pixz -0 > $IMAGE_CACHE_PATH/edx-$DOCKER_IMAGES_SLUG.tar.xz + - name: Docker images cache + if: steps.cache-sentinel.outputs.cache-hit != 'true' + uses: actions/cache@v3 + with: + path: $IMAGE_CACHE_PATH + key: BASE_SEED=$CACHE_KEY_BASE | $DOCKER_IMAGES_SLUG | $CACHE_KEY_IMAGES + restore-keys: BASE_SEED=$CACHE_KEY_BASE | $DOCKER_IMAGES_SLUG + + - name: Load images + if: steps.cache-sentinel.outputs.cache-hit != 'true' + run: | + [ -d $IMAGE_CACHE_PATH ] || exit 0 + ls -l $IMAGE_CACHE_PATH + docker images + set -euxo pipefail + cat $IMAGE_CACHE_PATH/edx-$DOCKER_IMAGES_SLUG.tar.xz | unxz | docker load + docker images + + - name: Set needs_build pipeline variable + if: steps.cache-sentinel.outputs.cache-hit != 'true' + run: echo "NEEDS_BUILD=true" >> $GITHUB_ENV + + - name: Remove Haskell compiler and cached apt archives to save disk space + if: env.NEEDS_BUILD != 'false' + run: df -h; time sudo rm -rf /var/cache/apt/archives /opt/ghc; df -h + + - name: Prepare Transifex credentials + if: env.NEEDS_BUILD != 'false' + run: | + if [ "$TRANSIFEX_USERNAME" == '$(TRANSIFEX_USERNAME)' ] || [ "$TRANSIFEX_PASSWORD" == '$(TRANSIFEX_PASSWORD)' ]; then + echo "Transifex credentials unset. Building without translations." + exit 0 + fi + printf '[https://www.transifex.com]\nhostname=https://www.transifex.com\nusername=%s\npassword=%s\n' "${TRANSIFEX_USERNAME}" "${TRANSIFEX_PASSWORD}" > $HOME/.transifexrc + ls -l $GITHUB_WORKSPACE/.transifexrc + env: + TRANSIFEX_USERNAME: $(TRANSIFEX_USERNAME) + TRANSIFEX_PASSWORD: $(TRANSIFEX_PASSWORD) + + - name: Setup docker images cache + if: env.NEEDS_BUILD != 'false' + run: | + images=$(docker images|grep -v ''|grep derex|awk '{print $1 ":" $2}') + CACHE_FROM_OPTS="" + if [ -d $IMAGE_CACHE_PATH ]; then + echo "Will use cached layers from images $images" + for image in $images; do + CACHE_FROM_OPTS="${CACHE_FROM_OPTS} --cache-from=$image" + done + else + mkdir $IMAGE_CACHE_PATH + fi + echo "CACHE_FROM_OPTS=$CACHE_FROM_OPTS" >> $GITHUB_ENV + mkdir $SENTINEL_CACHE_PATH + cp -r $CACHE_KEY_FILES $SENTINEL_CACHE_PATH + # We save the sha of the repo that built this image, so that we can push + # it only in a build of the same commit, after tests are passed + git rev-parse --verify HEAD > $SENTINEL_CACHE_PATH/built_version + + - name: Replace default docker with upsream docker and create build context + if: env.NEEDS_BUILD != 'false' + run: | + set -ex + sudo apt-get remove moby-cli -y + curl -fsSL https://get.docker.com |sudo bash + sudo mv /etc/docker/daemon.json /etc/docker/daemon.json.orig + sudo cat /etc/docker/daemon.json.orig|jq '. + {experimental: true}' |sudo tee /etc/docker/daemon.json + sudo systemctl restart docker.service + docker version + docker buildx create --use + docker images + sudo apt-get install pixz -y + + - uses: actions/setup-python@v4 + with: + python-version: "3.8" + + - name: Cache pip packages + uses: actions/cache@v3 + with: + path: $GITHUB_WORKSPACE/.cache/pip + key: pipcache | requirements_dev.txt + restore-keys: pipcache + + - name: Install derex.runner + if: env.NEEDS_BUILD != 'false' + run: | + pip3 install --cache-dir $GITHUB_WORKSPACE/.cache/pip -U pip setuptools + pip3 install --cache-dir $GITHUB_WORKSPACE/.cache/pip -r requirements_dev.txt -e . + + - name: Build nostatic image + if: env.NEEDS_BUILD != 'false' + run: derex build openedx --docker-opts "${CACHE_FROM_OPTS} --cache-to=type=inline -o type=docker" --target=nostatic $DOCKER_IMAGES_SLUG + + - name: Build dev image + if: env.NEEDS_BUILD != 'false' + run: derex build openedx --docker-opts "--cache-to=type=inline -o type=docker" --target=dev $DOCKER_IMAGES_SLUG + + - name: Check translations + if: env.NEEDS_BUILD != 'false' + run: | + docker images + derex build openedx --docker-opts "${CACHE_FROM_OPTS} --output type=docker,name={docker_image_prefix}-{target}" --target=translations $DOCKER_IMAGES_SLUG + docker images + docker run --rm derex/openedx-$DOCKER_IMAGES_SLUG-translations:$(grep __version__ derex/runner/__init__.py |sed 's/[^"]*"//;s/"//') sh -c "i18n_tool validate || (find conf|grep prob; find conf|grep prob|xargs cat; false)" || echo "Problems with translations found" + + - name: Save images + if: env.NEEDS_BUILD != 'false' + run: | + set -euxo pipefail; + docker save \ + $(derex build openedx --only-print-image-name -t nostatic $DOCKER_IMAGES_SLUG) \ + $(derex build openedx --only-print-image-name -t dev $DOCKER_IMAGES_SLUG) \ + | pixz -0 > $IMAGE_CACHE_PATH/edx-$DOCKER_IMAGES_SLUG.tar.xz koa: runs-on: ubuntu-latest @@ -156,6 +156,121 @@ jobs: path: $(SENTINEL_CACHE_PATH) key: SENTINEL=1 | $DOCKER_IMAGES_SLUG | $CACHE_KEY_IMAGES + - name: Docker images cache + if: steps.cache-sentinel.outputs.cache-hit != 'true' + uses: actions/cache@v3 + with: + path: $IMAGE_CACHE_PATH + key: BASE_SEED=$CACHE_KEY_BASE | $DOCKER_IMAGES_SLUG | $CACHE_KEY_IMAGES + restore-keys: BASE_SEED=$CACHE_KEY_BASE | $DOCKER_IMAGES_SLUG + + - name: Load images + if: steps.cache-sentinel.outputs.cache-hit != 'true' + run: | + [ -d $IMAGE_CACHE_PATH ] || exit 0 + ls -l $IMAGE_CACHE_PATH + docker images + set -euxo pipefail + cat $IMAGE_CACHE_PATH/edx-$DOCKER_IMAGES_SLUG.tar.xz | unxz | docker load + docker images + + - name: Set needs_build pipeline variable + if: steps.cache-sentinel.outputs.cache-hit != 'true' + run: echo "NEEDS_BUILD=true" >> $GITHUB_ENV + + - name: Remove Haskell compiler and cached apt archives to save disk space + if: env.NEEDS_BUILD != 'false' + run: df -h; time sudo rm -rf /var/cache/apt/archives /opt/ghc; df -h + + - name: Prepare Transifex credentials + if: env.NEEDS_BUILD != 'false' + run: | + if [ "$TRANSIFEX_USERNAME" == '$(TRANSIFEX_USERNAME)' ] || [ "$TRANSIFEX_PASSWORD" == '$(TRANSIFEX_PASSWORD)' ]; then + echo "Transifex credentials unset. Building without translations." + exit 0 + fi + printf '[https://www.transifex.com]\nhostname=https://www.transifex.com\nusername=%s\npassword=%s\n' "${TRANSIFEX_USERNAME}" "${TRANSIFEX_PASSWORD}" > $HOME/.transifexrc + ls -l $GITHUB_WORKSPACE/.transifexrc + env: + TRANSIFEX_USERNAME: $(TRANSIFEX_USERNAME) + TRANSIFEX_PASSWORD: $(TRANSIFEX_PASSWORD) + + - name: Setup docker images cache + if: env.NEEDS_BUILD != 'false' + run: | + images=$(docker images|grep -v ''|grep derex|awk '{print $1 ":" $2}') + CACHE_FROM_OPTS="" + if [ -d $IMAGE_CACHE_PATH ]; then + echo "Will use cached layers from images $images" + for image in $images; do + CACHE_FROM_OPTS="${CACHE_FROM_OPTS} --cache-from=$image" + done + else + mkdir $IMAGE_CACHE_PATH + fi + echo "CACHE_FROM_OPTS=$CACHE_FROM_OPTS" >> $GITHUB_ENV + mkdir $SENTINEL_CACHE_PATH + cp -r $CACHE_KEY_FILES $SENTINEL_CACHE_PATH + # We save the sha of the repo that built this image, so that we can push + # it only in a build of the same commit, after tests are passed + git rev-parse --verify HEAD > $SENTINEL_CACHE_PATH/built_version + + - name: Replace default docker with upsream docker and create build context + if: env.NEEDS_BUILD != 'false' + run: | + set -ex + sudo apt-get remove moby-cli -y + curl -fsSL https://get.docker.com |sudo bash + sudo mv /etc/docker/daemon.json /etc/docker/daemon.json.orig + sudo cat /etc/docker/daemon.json.orig|jq '. + {experimental: true}' |sudo tee /etc/docker/daemon.json + sudo systemctl restart docker.service + docker version + docker buildx create --use + docker images + sudo apt-get install pixz -y + + - uses: actions/setup-python@v4 + with: + python-version: "3.8" + + - name: Cache pip packages + uses: actions/cache@v3 + with: + path: $GITHUB_WORKSPACE/.cache/pip + key: pipcache | requirements_dev.txt + restore-keys: pipcache + + - name: Install derex.runner + if: env.NEEDS_BUILD != 'false' + run: | + pip3 install --cache-dir $GITHUB_WORKSPACE/.cache/pip -U pip setuptools + pip3 install --cache-dir $GITHUB_WORKSPACE/.cache/pip -r requirements_dev.txt -e . + + - name: Build nostatic image + if: env.NEEDS_BUILD != 'false' + run: derex build openedx --docker-opts "${CACHE_FROM_OPTS} --cache-to=type=inline -o type=docker" --target=nostatic $DOCKER_IMAGES_SLUG + + - name: Build dev image + if: env.NEEDS_BUILD != 'false' + run: derex build openedx --docker-opts "--cache-to=type=inline -o type=docker" --target=dev $DOCKER_IMAGES_SLUG + + - name: Check translations + if: env.NEEDS_BUILD != 'false' + run: | + docker images + derex build openedx --docker-opts "${CACHE_FROM_OPTS} --output type=docker,name={docker_image_prefix}-{target}" --target=translations $DOCKER_IMAGES_SLUG + docker images + docker run --rm derex/openedx-$DOCKER_IMAGES_SLUG-translations:$(grep __version__ derex/runner/__init__.py |sed 's/[^"]*"//;s/"//') sh -c "i18n_tool validate || (find conf|grep prob; find conf|grep prob|xargs cat; false)" || echo "Problems with translations found" + + - name: Save images + if: env.NEEDS_BUILD != 'false' + run: | + set -euxo pipefail; + docker save \ + $(derex build openedx --only-print-image-name -t nostatic $DOCKER_IMAGES_SLUG) \ + $(derex build openedx --only-print-image-name -t dev $DOCKER_IMAGES_SLUG) \ + | pixz -0 > $IMAGE_CACHE_PATH/edx-$DOCKER_IMAGES_SLUG.tar.xz + lilac: runs-on: ubuntu-latest timeout-minutes: 180 @@ -170,3 +285,118 @@ jobs: with: path: $(SENTINEL_CACHE_PATH) key: SENTINEL=1 | $DOCKER_IMAGES_SLUG | $CACHE_KEY_IMAGES + + - name: Docker images cache + if: steps.cache-sentinel.outputs.cache-hit != 'true' + uses: actions/cache@v3 + with: + path: $IMAGE_CACHE_PATH + key: BASE_SEED=$CACHE_KEY_BASE | $DOCKER_IMAGES_SLUG | $CACHE_KEY_IMAGES + restore-keys: BASE_SEED=$CACHE_KEY_BASE | $DOCKER_IMAGES_SLUG + + - name: Load images + if: steps.cache-sentinel.outputs.cache-hit != 'true' + run: | + [ -d $IMAGE_CACHE_PATH ] || exit 0 + ls -l $IMAGE_CACHE_PATH + docker images + set -euxo pipefail + cat $IMAGE_CACHE_PATH/edx-$DOCKER_IMAGES_SLUG.tar.xz | unxz | docker load + docker images + + - name: Set needs_build pipeline variable + if: steps.cache-sentinel.outputs.cache-hit != 'true' + run: echo "NEEDS_BUILD=true" >> $GITHUB_ENV + + - name: Remove Haskell compiler and cached apt archives to save disk space + if: env.NEEDS_BUILD != 'false' + run: df -h; time sudo rm -rf /var/cache/apt/archives /opt/ghc; df -h + + - name: Prepare Transifex credentials + if: env.NEEDS_BUILD != 'false' + run: | + if [ "$TRANSIFEX_USERNAME" == '$(TRANSIFEX_USERNAME)' ] || [ "$TRANSIFEX_PASSWORD" == '$(TRANSIFEX_PASSWORD)' ]; then + echo "Transifex credentials unset. Building without translations." + exit 0 + fi + printf '[https://www.transifex.com]\nhostname=https://www.transifex.com\nusername=%s\npassword=%s\n' "${TRANSIFEX_USERNAME}" "${TRANSIFEX_PASSWORD}" > $HOME/.transifexrc + ls -l $GITHUB_WORKSPACE/.transifexrc + env: + TRANSIFEX_USERNAME: $(TRANSIFEX_USERNAME) + TRANSIFEX_PASSWORD: $(TRANSIFEX_PASSWORD) + + - name: Setup docker images cache + if: env.NEEDS_BUILD != 'false' + run: | + images=$(docker images|grep -v ''|grep derex|awk '{print $1 ":" $2}') + CACHE_FROM_OPTS="" + if [ -d $IMAGE_CACHE_PATH ]; then + echo "Will use cached layers from images $images" + for image in $images; do + CACHE_FROM_OPTS="${CACHE_FROM_OPTS} --cache-from=$image" + done + else + mkdir $IMAGE_CACHE_PATH + fi + echo "CACHE_FROM_OPTS=$CACHE_FROM_OPTS" >> $GITHUB_ENV + mkdir $SENTINEL_CACHE_PATH + cp -r $CACHE_KEY_FILES $SENTINEL_CACHE_PATH + # We save the sha of the repo that built this image, so that we can push + # it only in a build of the same commit, after tests are passed + git rev-parse --verify HEAD > $SENTINEL_CACHE_PATH/built_version + + - name: Replace default docker with upsream docker and create build context + if: env.NEEDS_BUILD != 'false' + run: | + set -ex + sudo apt-get remove moby-cli -y + curl -fsSL https://get.docker.com |sudo bash + sudo mv /etc/docker/daemon.json /etc/docker/daemon.json.orig + sudo cat /etc/docker/daemon.json.orig|jq '. + {experimental: true}' |sudo tee /etc/docker/daemon.json + sudo systemctl restart docker.service + docker version + docker buildx create --use + docker images + sudo apt-get install pixz -y + + - uses: actions/setup-python@v4 + with: + python-version: "3.8" + + - name: Cache pip packages + uses: actions/cache@v3 + with: + path: $GITHUB_WORKSPACE/.cache/pip + key: pipcache | requirements_dev.txt + restore-keys: pipcache + + - name: Install derex.runner + if: env.NEEDS_BUILD != 'false' + run: | + pip3 install --cache-dir $GITHUB_WORKSPACE/.cache/pip -U pip setuptools + pip3 install --cache-dir $GITHUB_WORKSPACE/.cache/pip -r requirements_dev.txt -e . + + - name: Build nostatic image + if: env.NEEDS_BUILD != 'false' + run: derex build openedx --docker-opts "${CACHE_FROM_OPTS} --cache-to=type=inline -o type=docker" --target=nostatic $DOCKER_IMAGES_SLUG + + - name: Build dev image + if: env.NEEDS_BUILD != 'false' + run: derex build openedx --docker-opts "--cache-to=type=inline -o type=docker" --target=dev $DOCKER_IMAGES_SLUG + + - name: Check translations + if: env.NEEDS_BUILD != 'false' + run: | + docker images + derex build openedx --docker-opts "${CACHE_FROM_OPTS} --output type=docker,name={docker_image_prefix}-{target}" --target=translations $DOCKER_IMAGES_SLUG + docker images + docker run --rm derex/openedx-$DOCKER_IMAGES_SLUG-translations:$(grep __version__ derex/runner/__init__.py |sed 's/[^"]*"//;s/"//') sh -c "i18n_tool validate || (find conf|grep prob; find conf|grep prob|xargs cat; false)" || echo "Problems with translations found" + + - name: Save images + if: env.NEEDS_BUILD != 'false' + run: | + set -euxo pipefail; + docker save \ + $(derex build openedx --only-print-image-name -t nostatic $DOCKER_IMAGES_SLUG) \ + $(derex build openedx --only-print-image-name -t dev $DOCKER_IMAGES_SLUG) \ + | pixz -0 > $IMAGE_CACHE_PATH/edx-$DOCKER_IMAGES_SLUG.tar.xz diff --git a/.github/workflows/on_push.yml b/.github/workflows/on_push.yml index 3560369c..23218e92 100644 --- a/.github/workflows/on_push.yml +++ b/.github/workflows/on_push.yml @@ -1,7 +1,6 @@ name: on_push -on: - push +on: push jobs: build: @@ -13,4 +12,8 @@ jobs: push: uses: ./.github/workflows/push.yml - needs: [build, test] \ No newline at end of file + needs: [build, test] + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true \ No newline at end of file From d6be431d9b66f60f0b019d06a4061c0c79cc565a Mon Sep 17 00:00:00 2001 From: serhii Date: Tue, 16 Aug 2022 17:07:34 +0100 Subject: [PATCH 145/145] Added separate workflow on push --- .github/workflows/on_push.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/on_push.yml b/.github/workflows/on_push.yml index 23218e92..9984f301 100644 --- a/.github/workflows/on_push.yml +++ b/.github/workflows/on_push.yml @@ -16,4 +16,4 @@ jobs: concurrency: group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true \ No newline at end of file + cancel-in-progress: true