From 70cc518eafa6635fe89c749451ca8ec5ee0946be Mon Sep 17 00:00:00 2001 From: Cedd Burge Date: Fri, 4 Oct 2024 13:51:06 +0100 Subject: [PATCH 1/7] Add eco ci energy estimation to github action This also removes all the caching, so that I can re instate it later, and see what difference it makes to the energy --- .github/workflows/build-test.yml | 82 +++++++++++++++++++++++++++----- 1 file changed, 71 insertions(+), 11 deletions(-) diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index 63b730f..a8aea63 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -11,32 +11,92 @@ jobs: runs-on: ubuntu-latest steps: + - name: Initialize energy estimation + uses: green-coding-berlin/eco-ci-energy-estimation@v3 + with: + task: start-measurement + continue-on-error: true + - uses: actions/checkout@v3 + - name: Checkout repo measurement + uses: green-coding-berlin/eco-ci-energy-estimation@v3 + with: + task: get-measurement + label: "Repo checkout" + pr-comment: true + continue-on-error: true + - uses: actions/setup-node@v3 with: # Choose your Node.js version here: node-version: 14.x - # Re-use node_modules between runs until package.json or package-lock.json changes. - - name: Cache node_modules - id: cache-node_modules - uses: actions/cache@v3 + - name: Setup node measurement + uses: green-coding-berlin/eco-ci-energy-estimation@v3 with: - path: node_modules - key: node_modules-${{ hashFiles('package.json', 'package-lock.json') }} + task: get-measurement + label: "Setup node" + pr-comment: true + continue-on-error: true + + # Re-use node_modules between runs until package.json or package-lock.json changes. + # - name: Cache node_modules + # id: cache-node_modules + # uses: actions/cache@v3 + # with: + # path: node_modules + # key: node_modules-${{ hashFiles('package.json', 'package-lock.json') }} + + # - name: Cache node modules measurement + # uses: green-coding-berlin/eco-ci-energy-estimation@v3 + # with: + # task: get-measurement + # label: "Cache node modules" + # pr-comment: true + # continue-on-error: true # Re-use ~/.elm between runs until elm.json, elm-tooling.json or # review/elm.json changes. The Elm compiler saves downloaded Elm packages # to ~/.elm. - - name: Cache ~/.elm - uses: actions/cache@v3 - with: - path: ~/.elm - key: elm-${{ hashFiles('elm.json', 'review/elm.json') }} + # - name: Cache ~/.elm + # uses: actions/cache@v3 + # with: + # path: ~/.elm + # key: elm-${{ hashFiles('elm.json', 'review/elm.json') }} + + # - name: Cache .elm measurement + # uses: green-coding-berlin/eco-ci-energy-estimation@v3 + # with: + # task: get-measurement + # label: "Cache .elm" + # pr-comment: true + # continue-on-error: true - name: npm i run: npm i + - name: npm i measurement + uses: green-coding-berlin/eco-ci-energy-estimation@v3 + with: + task: get-measurement + label: "npm i" + pr-comment: true + continue-on-error: true + - name: build run: npm run check-and-build + + - name: build measurement + uses: green-coding-berlin/eco-ci-energy-estimation@v3 + with: + task: get-measurement + label: "build" + pr-comment: true + continue-on-error: true + + - name: Show Energy Results + uses: green-coding-berlin/eco-ci-energy-estimation@v3 + with: + task: display-results + continue-on-error: true From 55ff4cea68407aec533471cdda91f782e7153f62 Mon Sep 17 00:00:00 2001 From: Cedd Burge Date: Fri, 4 Oct 2024 14:13:05 +0100 Subject: [PATCH 2/7] Move pr-comment to display-results The documentation was a bit misleading on this one --- .github/workflows/build-test.yml | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index a8aea63..b1a8ef5 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -24,7 +24,6 @@ jobs: with: task: get-measurement label: "Repo checkout" - pr-comment: true continue-on-error: true - uses: actions/setup-node@v3 @@ -37,7 +36,6 @@ jobs: with: task: get-measurement label: "Setup node" - pr-comment: true continue-on-error: true # Re-use node_modules between runs until package.json or package-lock.json changes. @@ -53,7 +51,6 @@ jobs: # with: # task: get-measurement # label: "Cache node modules" - # pr-comment: true # continue-on-error: true # Re-use ~/.elm between runs until elm.json, elm-tooling.json or @@ -70,7 +67,6 @@ jobs: # with: # task: get-measurement # label: "Cache .elm" - # pr-comment: true # continue-on-error: true - name: npm i @@ -81,7 +77,6 @@ jobs: with: task: get-measurement label: "npm i" - pr-comment: true continue-on-error: true - name: build @@ -92,11 +87,11 @@ jobs: with: task: get-measurement label: "build" - pr-comment: true continue-on-error: true - name: Show Energy Results uses: green-coding-berlin/eco-ci-energy-estimation@v3 with: task: display-results + pr-comment: true continue-on-error: true From 4638de32f0600e172f97d742e7de046b8a585899 Mon Sep 17 00:00:00 2001 From: Cedd Burge Date: Fri, 4 Oct 2024 16:33:08 +0100 Subject: [PATCH 3/7] Cache node modules --- .github/workflows/build-test.yml | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index b1a8ef5..af8b7b4 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -39,19 +39,19 @@ jobs: continue-on-error: true # Re-use node_modules between runs until package.json or package-lock.json changes. - # - name: Cache node_modules - # id: cache-node_modules - # uses: actions/cache@v3 - # with: - # path: node_modules - # key: node_modules-${{ hashFiles('package.json', 'package-lock.json') }} + - name: Cache node_modules + id: cache-node_modules + uses: actions/cache@v3 + with: + path: node_modules + key: node_modules-${{ hashFiles('package.json', 'package-lock.json') }} - # - name: Cache node modules measurement - # uses: green-coding-berlin/eco-ci-energy-estimation@v3 - # with: - # task: get-measurement - # label: "Cache node modules" - # continue-on-error: true + - name: Cache node modules measurement + uses: green-coding-berlin/eco-ci-energy-estimation@v3 + with: + task: get-measurement + label: "Cache node modules" + continue-on-error: true # Re-use ~/.elm between runs until elm.json, elm-tooling.json or # review/elm.json changes. The Elm compiler saves downloaded Elm packages From 33b077d3018a0f3f90d3963ad73eb72d26c0fec5 Mon Sep 17 00:00:00 2001 From: Cedd Burge Date: Fri, 4 Oct 2024 16:51:18 +0100 Subject: [PATCH 4/7] rebuild (to use cache) From c37eca7f474d30f6e5d5ae6584cea22a7094b5b4 Mon Sep 17 00:00:00 2001 From: Cedd Burge Date: Fri, 4 Oct 2024 16:54:22 +0100 Subject: [PATCH 5/7] Cache ~./elm --- .github/workflows/build-test.yml | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index af8b7b4..3ae3b40 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -28,7 +28,6 @@ jobs: - uses: actions/setup-node@v3 with: - # Choose your Node.js version here: node-version: 14.x - name: Setup node measurement @@ -56,18 +55,18 @@ jobs: # Re-use ~/.elm between runs until elm.json, elm-tooling.json or # review/elm.json changes. The Elm compiler saves downloaded Elm packages # to ~/.elm. - # - name: Cache ~/.elm - # uses: actions/cache@v3 - # with: - # path: ~/.elm - # key: elm-${{ hashFiles('elm.json', 'review/elm.json') }} - - # - name: Cache .elm measurement - # uses: green-coding-berlin/eco-ci-energy-estimation@v3 - # with: - # task: get-measurement - # label: "Cache .elm" - # continue-on-error: true + - name: Cache ~/.elm + uses: actions/cache@v3 + with: + path: ~/.elm + key: elm-${{ hashFiles('elm.json', 'review/elm.json') }} + + - name: Cache .elm measurement + uses: green-coding-berlin/eco-ci-energy-estimation@v3 + with: + task: get-measurement + label: "Cache .elm" + continue-on-error: true - name: npm i run: npm i From a717c2ebbd3a2e99eb96bb551796aff9d8598344 Mon Sep 17 00:00:00 2001 From: Cedd Burge Date: Fri, 4 Oct 2024 17:01:25 +0100 Subject: [PATCH 6/7] rebuild (to use cache) From 0f7d64a71d644a815eefffe144fb44dcf46c605c Mon Sep 17 00:00:00 2001 From: Cedd Burge Date: Fri, 4 Oct 2024 19:54:53 +0100 Subject: [PATCH 7/7] Add energy usage badge to readme --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 7be2374..de67b5d 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # Tournament organiser + + Tournament organiser is a website that makes it easy to schedule games in a tournament. https://tournament-organiser.onrender.com/