From f1dd10e0252e814baa2da8c540cfabfd931ae297 Mon Sep 17 00:00:00 2001 From: lbonaldo Date: Fri, 13 Oct 2023 17:48:32 -0400 Subject: [PATCH 1/2] Change GH action to push to testlog repo --- .github/workflows/ci.yml | 45 ++++++++++++++++++--------------- Project.toml | 2 +- test/Logs/Electrolyzer.log | 4 --- test/Logs/MethodofMorris.log | 4 --- test/Logs/MultiStage.log | 3 --- test/Logs/PiecewiseFuel_CO2.log | 4 --- test/Logs/VREStor.log | 4 --- 7 files changed, 26 insertions(+), 40 deletions(-) delete mode 100644 test/Logs/Electrolyzer.log delete mode 100644 test/Logs/MethodofMorris.log delete mode 100644 test/Logs/MultiStage.log delete mode 100644 test/Logs/PiecewiseFuel_CO2.log delete mode 100644 test/Logs/VREStor.log diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d4509383f0..0d89eef62b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,34 +14,38 @@ jobs: fail-fast: false matrix: version: - - "1.6" + - "1.6" # LTS (64-bit Linux) - "1.7" - "1.8" - - '1' # latest stable 1.x Julia release (Linux) + - '1.9' # latest stable Julia release (Linux) os: - ubuntu-latest arch: - x64 - include: # additional tests [Julia-nightly] + include: # additional tests [Julia-nightly] (Linux) - os: ubuntu-latest version: 'nightly' arch: x64 allow_failure: true steps: - uses: actions/checkout@v3 - - name: Create a new branch for test logs + - name: Create a new branch and pull test logs from repo run: | - if [[ ${{ matrix.version }} == '1' ]]; then - git config --local user.name lbonaldo - git config --local user.email "39280783+lbonaldo@users.noreply.github.com" - git checkout -b ${GITHUB_REF#refs/heads/}-testlogs - if [ -z "$(git ls-remote --heads origin ${GITHUB_REF#refs/heads/}-testlogs)" ] ; then # if the branch doesn't exist - echo "Branch doesn't exist. Skip fetching." - else # if a branch exists, fetch it - git fetch origin ${GITHUB_REF#refs/heads/}-testlogs - git cherry-pick $(git log -n 1 origin/${GITHUB_REF#refs/heads/}-testlogs --pretty=format:"%H") - fi + git checkout -b ${GITHUB_REF#refs/heads/}-testlogs + mkdir test/Logs; cd test/Logs + git config --global init.defaultBranch main + git init + git config --local user.name GenXProject + git config --local user.email "84470580+GenXProject@users.noreply.github.com" + git remote add testlog https://$LOG_TOKEN@github.com/GenXProject/GenX-testlog.git + git pull testlog main + if [ -d Logs_v${{ matrix.version }} ]; then + mv Logs_v${{ matrix.version }}/*.log . + else + mkdir Logs_v${{ matrix.version }} fi + env: + LOG_TOKEN: ${{ secrets.LOG_TOKEN }} - uses: julia-actions/setup-julia@v1 with: version: ${{ matrix.version }} @@ -49,13 +53,14 @@ jobs: - uses: julia-actions/cache@v1 - uses: julia-actions/julia-buildpkg@v1 - uses: julia-actions/julia-runtest@v1 - - name: Commit logs and push to repo # only for 1.x versions + - name: Commit logs and push back to repo run: | - if [[ ${{ matrix.version }} == '1' ]]; then - git add -f test/Logs - git commit -m "Update test logs" - git push -f origin ${GITHUB_REF#refs/heads/}-testlogs - fi + cd ${GITHUB_WORKSPACE}/test/Logs + mv *.log Logs_v${{ matrix.version }} + git add -f Logs_v${{ matrix.version }} + git commit -m "Update test logs for Julia v${{ matrix.version }}" + git pull --rebase testlog main # pull again to avoid conflicts from other versions + git push testlog main env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - uses: julia-actions/julia-processcoverage@v1 diff --git a/Project.toml b/Project.toml index e9180b39fa..bfde4887a4 100644 --- a/Project.toml +++ b/Project.toml @@ -48,4 +48,4 @@ LoggingExtras = "e6f89c97-d47a-5376-807f-9c37f3926c36" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" [targets] -test = ["Test", "Logging", "LoggingExtras", "JLD2"] +test = ["Test", "JLD2", "Logging", "LoggingExtras"] diff --git a/test/Logs/Electrolyzer.log b/test/Logs/Electrolyzer.log deleted file mode 100644 index 8f5798d275..0000000000 --- a/test/Logs/Electrolyzer.log +++ /dev/null @@ -1,4 +0,0 @@ -2023-10-11 02:37:37 | 6946.981912630803 ± 0.0001 | Test Passed - Expression: ≈(obj_test, obj_true, atol = optimal_tol) - Evaluated: ≈(6946.981912630803, 6946.9819126; atol = 0.0001) -2023-10-11 03:01:00 | 6946.981912630803 ± 0.0001 | Test Passed diff --git a/test/Logs/MethodofMorris.log b/test/Logs/MethodofMorris.log deleted file mode 100644 index dd23446d99..0000000000 --- a/test/Logs/MethodofMorris.log +++ /dev/null @@ -1,4 +0,0 @@ -2023-10-11 02:37:51 | Build and Run | Test Broken - Expression: built -2023-10-11 03:01:13 | Build and Run | Test Broken - Expression: built diff --git a/test/Logs/MultiStage.log b/test/Logs/MultiStage.log deleted file mode 100644 index 8f0ff0bb7e..0000000000 --- a/test/Logs/MultiStage.log +++ /dev/null @@ -1,3 +0,0 @@ -2023-10-11 02:38:03 | 79734.8003171703 ± 1.0e-5, 41630.03494225143 ± 1.0e-5, 27855.20631474678 ± 1.0e-5 | Test Passed - Expression: all(obj_true .- optimal_tol .<= obj_test .<= obj_true .+ optimal_tol) -2023-10-11 03:01:23 | 79734.80031717036 ± 1.0e-5, 41630.034942251485 ± 1.0e-5, 27855.206314746796 ± 1.0e-5 | Test Passed diff --git a/test/Logs/PiecewiseFuel_CO2.log b/test/Logs/PiecewiseFuel_CO2.log deleted file mode 100644 index 7466c75b06..0000000000 --- a/test/Logs/PiecewiseFuel_CO2.log +++ /dev/null @@ -1,4 +0,0 @@ -2023-10-11 02:36:57 | 2341.8230753008047 ± 1.0e-5 | Test Passed - Expression: ≈(obj_test, obj_true, atol = optimal_tol) - Evaluated: ≈(2341.8230753008047, 2341.8230753; atol = 1.0e-5) -2023-10-11 03:00:24 | 2341.8230753008047 ± 1.0e-5 | Test Passed diff --git a/test/Logs/VREStor.log b/test/Logs/VREStor.log deleted file mode 100644 index 0c4a88778e..0000000000 --- a/test/Logs/VREStor.log +++ /dev/null @@ -1,4 +0,0 @@ -2023-10-11 02:37:34 | 92081.91504226513 ± 1.0e-5 | Test Passed - Expression: ≈(obj_test, obj_true, atol = optimal_tol) - Evaluated: ≈(92081.91504226513, 92081.915042; atol = 1.0e-5) -2023-10-11 03:00:57 | 92081.91504226513 ± 1.0e-5 | Test Passed From 4e3ef508c56f43a0685517affcb99025455f8a17 Mon Sep 17 00:00:00 2001 From: lbonaldo Date: Tue, 17 Oct 2023 12:34:23 -0400 Subject: [PATCH 2/2] Fix permission on ci.yml --- .github/workflows/ci.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0d89eef62b..a41970e37a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -29,7 +29,8 @@ jobs: allow_failure: true steps: - uses: actions/checkout@v3 - - name: Create a new branch and pull test logs from repo + - name: Create a new branch and pull test logs from repo # only push logs if PR is not from a fork + if: ${{ ! github.event.pull_request.head.repo.fork }} run: | git checkout -b ${GITHUB_REF#refs/heads/}-testlogs mkdir test/Logs; cd test/Logs @@ -53,7 +54,8 @@ jobs: - uses: julia-actions/cache@v1 - uses: julia-actions/julia-buildpkg@v1 - uses: julia-actions/julia-runtest@v1 - - name: Commit logs and push back to repo + - name: Commit logs and push back to repo # only push logs if PR is not from a fork + if: ${{ ! github.event.pull_request.head.repo.fork }} run: | cd ${GITHUB_WORKSPACE}/test/Logs mv *.log Logs_v${{ matrix.version }} @@ -61,8 +63,6 @@ jobs: git commit -m "Update test logs for Julia v${{ matrix.version }}" git pull --rebase testlog main # pull again to avoid conflicts from other versions git push testlog main - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - uses: julia-actions/julia-processcoverage@v1 - uses: codecov/codecov-action@v3 with: