From 0c831d8b0d1fbaac9c1d83a1e1951b8904792cb2 Mon Sep 17 00:00:00 2001 From: Lukas Larsson Date: Thu, 12 Oct 2023 15:43:25 +0200 Subject: [PATCH 01/11] gh: Backport github actions to OTP-26 --- .github/dockerfiles/Dockerfile.ubuntu-base | 2 +- .github/scripts/build-base-image.sh | 4 + .github/scripts/sync-github-prs.es | 42 +++++++++- .github/scripts/sync-github-releases.sh | 65 ++++++++------- .github/workflows/actions-updater.yaml | 25 +++--- .github/workflows/add-to-project.yaml | 5 +- .github/workflows/main.yaml | 89 ++++++++++++--------- .github/workflows/pr-comment.yaml | 14 ++-- .github/workflows/sync-github-prs.yaml | 45 +++++++++++ .github/workflows/sync-github-releases.yaml | 35 +------- .github/workflows/update-base.yaml | 4 +- 11 files changed, 207 insertions(+), 123 deletions(-) create mode 100644 .github/workflows/sync-github-prs.yaml diff --git a/.github/dockerfiles/Dockerfile.ubuntu-base b/.github/dockerfiles/Dockerfile.ubuntu-base index 1f4afa618b6a..aa61012b4d39 100644 --- a/.github/dockerfiles/Dockerfile.ubuntu-base +++ b/.github/dockerfiles/Dockerfile.ubuntu-base @@ -68,7 +68,7 @@ RUN apt-get install -y git curl && \ ARG EXTRA_LIBS="erlang erlang-doc" RUN apt-get install -y \ unixodbc odbc-postgresql postgresql ssh openssh-server groff-base gdb \ - tinyproxy bind9 nsd expect vsftpd python emacs nano vim \ + tinyproxy knot ldnsutils expect vsftpd python emacs nano vim \ linux-tools-common linux-tools-generic jq \ xvfb libgl1-mesa-dri && \ for lib in ${EXTRA_LIBS}; do apt-get install -y ${lib}; done && \ diff --git a/.github/scripts/build-base-image.sh b/.github/scripts/build-base-image.sh index 7069ef391a00..5836efc30bd4 100755 --- a/.github/scripts/build-base-image.sh +++ b/.github/scripts/build-base-image.sh @@ -12,6 +12,10 @@ esac if [ -z "${BASE_TAG}" ]; then BASE_TAG=$(grep "ARG BASE=" ".github/dockerfiles/Dockerfile.${2}" | head -1 | tr '=' ' ' | awk '{print $3}') + ## If this script is used on pre 25 releases + if [ -z "${BASE_TAG}" ]; then + BASE_TAG=$(grep "FROM " ".github/dockerfiles/Dockerfile.${2}" | head -1 | awk '{print $2}') + fi fi case "${BASE_TAG}" in diff --git a/.github/scripts/sync-github-prs.es b/.github/scripts/sync-github-prs.es index 6560ae5e020e..a09beb901f3b 100755 --- a/.github/scripts/sync-github-prs.es +++ b/.github/scripts/sync-github-prs.es @@ -5,9 +5,14 @@ %% into the Target folder. It tries its best to not create too large %% files so that gh will still be happy with us when this is published to %% gh pages +-module('sync-github-prs'). -mode(compile). main([Repo, Target]) -> + + io:format("Updating PRs in ~ts, current PRs are: ~p~n", + [Target, filelib:wildcard(filename:join(Target,"*"))]), + AllOpenPrs = ghapi("gh api --paginate -X GET /repos/"++Repo++"/pulls -f state=open"), %% Download all updates, there really should not be any to download as they %% are updated when a PR is updated, but we do it anyways just to be safe. @@ -26,7 +31,10 @@ main([Repo, Target]) -> false -> cmd("rm -rf " ++ filename:join(Target,PRNo)) end - end, AllPrs); + end, AllPrs), + + purge_prs(Target); + main([Repo, Target, PRNo]) -> handle_prs(Repo, Target, [ghapi("gh api /repos/"++Repo++"/pulls/"++PRNo)]). @@ -68,6 +76,9 @@ handle_pr(_Repo, Target, io:format("Checking for ~ts~n", [filename:join(PRDir, Ident)]), case file:read_file_info(filename:join(PRDir, Ident)) of {error, enoent} -> + io:format("Did not find ~ts. Files in dir are: ~p~n", + [filename:join(PRDir, Ident), + filelib:wildcard(filename:join(PRDir, "*"))]), cmd("rm -rf "++PRDir), ok = file:make_dir(PRDir), ok = file:write_file(filename:join(PRDir,Ident), integer_to_list(Number)), @@ -100,6 +111,10 @@ handle_pr(_Repo, Target, ok = filelib:ensure_dir(CTLogsIndex), ok = file:write_file(CTLogsIndex, ["No test logs found for ", Sha]) end, + %% If we ever want to de-duplicate the docs, this command will create a + %% stable md5sum. + %% (cd $dir && find doc lib erts-* -type f \! -path "lib/jinterface-*" \! -name erlresolvelinks.js \! -name index.html \! -name release_notes.html \! -name users_guide.html \! -name internal_docs.html \! -name "*.eix" -exec md5sum {} \;) | sort -k 2 | awk "{print $1}" | md5sum + %% where $dir is the pr directory. DocIndex = filename:join([PRDir,"doc","index.html"]), case file:read_file_info(DocIndex) of {ok, _} -> ok; @@ -154,6 +169,31 @@ purge_suite(SuiteFilePath) -> end, filelib:wildcard(filename:join(SuiteDir,"*.html"))) end. +%% If we have more the 10 GB of PR data we need to remove some otherwise +%% github actions will not work them. So we purge the largest files until we +%% reach the 10 GB limit. +purge_prs(Target) -> + %% Start by deleting all data from common_test test runs as they are huge. + os:cmd("rm -rf "++Target++"*/ct_logs/ct_run*/*common_test_test*/run*/log_private/ct_run*"), + Files = string:split(cmd("find " ++ Target ++ " -type f -a " + "-name \\! suite.log.html -exec du -a {} \\+"),"\n",all), + SortedFiles = + lists:sort(fun([A|_]=As,[B|_]=Bs) -> + binary_to_integer(A) >= binary_to_integer(B) + end, [string:split(F,"\t") || F <- Files, F =/= <<>>]), + purge_prs(SortedFiles, Target, get_directory_size(Target)). +purge_prs(Files, Target, Size) when Size > 10_000_000_000 -> + {H,T} = lists:split(10, Files), + [file:write_file(File, io_lib:format("Large file (~p bytes) truncated", [Sz])) + || [Sz, File] <- H], + purge_prs(T, Target, get_directory_size(Target)); +purge_prs(_, _, _) -> + ok. + +get_directory_size(Dir) -> + binary_to_integer(hd(string:split(cmd("du -b --max-depth=0 " ++ Dir),"\t"))). + + ghapi(CMD) -> decode(cmd(CMD)). diff --git a/.github/scripts/sync-github-releases.sh b/.github/scripts/sync-github-releases.sh index b71d5b54a4eb..c5c6f97ed6d8 100755 --- a/.github/scripts/sync-github-releases.sh +++ b/.github/scripts/sync-github-releases.sh @@ -211,37 +211,40 @@ if [ ${UPLOADED} = true ]; then fi ## If no assets were uploaded, we try to build one instead -if [ ${UPLOADED} = false ] && [ ${#MISSING_PREBUILD[0]} != 0 ]; then - name="${MISSING_PREBUILD[0]}" - stripped_name=$(_strip_name "${name}") - git clone https://github.com/erlang/otp -b "${name}" otp_src - if [ -f otp_src/.github/scripts/init-pre-release.sh ]; then - (cd otp_src && ERL_TOP=$(pwd) .github/scripts/init-pre-release.sh) - else - (cd otp_src && ERL_TOP=$(pwd) ../.github/scripts/init-pre-release.sh) - fi - case ${stripped_name} in - 23.**) - ## The 32-bit dockerfile build the doc chunks which we want - ## to include in VSN >= 23. - docker build -t otp --build-arg ARCHIVE=otp_src/otp_src.tar.gz \ - -f otp_src/.github/dockerfiles/Dockerfile.32-bit . - ;; - *) - docker build -t otp --build-arg ARCHIVE=otp_src/otp_src.tar.gz \ - -f otp_src/.github/dockerfiles/Dockerfile.64-bit . - ;; - esac - docker run -v "$PWD":/github otp \ - "/github/scripts/build-otp-tar -o /github/otp_clean_src.tar.gz /github/otp_src.tar.gz -b /buildroot/otp/ /buildroot/otp.tar.gz" - .github/scripts/release-docs.sh - .github/scripts/create-artifacts.sh downloads "${name}" - - ## Delete any artifacts that we should not upload - for artifact in dowloads/*; do - if ! echo "${RI[@]}" | grep "${artifact}" 2> /dev/null > /dev/null; then - rm -f "downloads/${artifact}" +if [ ${UPLOADED} = false ]; then + for name in "${MISSING_PREBUILD[@]}"; do + stripped_name=$(_strip_name "${name}") + release=$(echo "${stripped_name}" | awk -F. '{print $1}') + if [[ $release < 24 ]]; then + ## Releases before 24 are no longer supported and are a bit different + ## from 24+ so I've removed support for them + echo "Skipping old release ${name}" + continue; + fi + echo "Building pre-build and docs for ${name}" + git clone https://github.com/erlang/otp -b "${name}" otp_src + if [ -f otp_src/.github/scripts/init-pre-release.sh ]; then + (cd otp_src && ERL_TOP=$(pwd) .github/scripts/init-pre-release.sh) + else + (cd otp_src && ERL_TOP=$(pwd) ../.github/scripts/init-pre-release.sh) fi + (cd otp_src && BASE_USE_CACHE=false GITHUB_OUTPUT=.tmp ../.github/scripts/build-base-image.sh maint-${release} 64-bit) + docker build -t otp --build-arg ARCHIVE=otp_src/otp_src.tar.gz \ + -f otp_src/.github/dockerfiles/Dockerfile.64-bit . + docker run -v "$PWD":/github otp \ + "/github/scripts/build-otp-tar -o /github/otp_clean_src.tar.gz /github/otp_src.tar.gz -b /buildroot/otp/ /buildroot/otp.tar.gz" + .github/scripts/release-docs.sh + .github/scripts/create-artifacts.sh downloads "${name}" + + ## Delete any artifacts that we should not upload + for artifact in dowloads/*; do + if ! echo "${RI[@]}" | grep "${artifact}" 2> /dev/null > /dev/null; then + rm -f "downloads/${artifact}" + fi + done + _upload_artifacts "${name}" + + ## We only update one release per call to sync-github-releases + break done - _upload_artifacts "${name}" fi diff --git a/.github/workflows/actions-updater.yaml b/.github/workflows/actions-updater.yaml index 0e186cf4e117..7dd777182b05 100644 --- a/.github/workflows/actions-updater.yaml +++ b/.github/workflows/actions-updater.yaml @@ -1,22 +1,29 @@ -name: GitHub Actions Updater +name: GitHub Actions Version Updater +# Controls when the action will run. on: + workflow_dispatch: schedule: - # Automatically run on the 1st of every month - - cron: '0 0 1 * *' + # Automatically run on every Sunday + - cron: '0 0 * * 0' jobs: build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - name: Generate token + id: generate_token + uses: actions/create-github-app-token@v1.5.0 with: - token: ${{ secrets.GITHUB_TOKEN }} + app_id: ${{ secrets.APP_ID }} + private_key: ${{ secrets.APP_PEM }} + + - uses: actions/checkout@v4.1.0 + with: + token: ${{ steps.generate_token.outputs.token }} - name: Run GitHub Actions Version Updater - uses: saadmk11/github-actions-version-updater@v0.7.3 + uses: saadmk11/github-actions-version-updater@v0.8.1 with: - token: ${{ secrets.GITHUB_TOKEN }} - commit_message: "Updating GitHub actions to their latest versions" - pull_request_labels: "team:IS" + token: ${{ steps.generate_token.outputs.token }} diff --git a/.github/workflows/add-to-project.yaml b/.github/workflows/add-to-project.yaml index d387e52f4a05..3539790c0eb5 100644 --- a/.github/workflows/add-to-project.yaml +++ b/.github/workflows/add-to-project.yaml @@ -16,11 +16,12 @@ jobs: steps: - name: Generate token id: generate_token - uses: tibdex/github-app-token@v1.8.0 + uses: actions/create-github-app-token@v1.5.0 with: app_id: ${{ secrets.APP_ID }} private_key: ${{ secrets.APP_PEM }} - - uses: actions/add-to-project@v0.4.0 + + - uses: actions/add-to-project@v0.5.0 with: project-url: https://github.com/orgs/erlang/projects/13 github-token: ${{ steps.generate_token.outputs.token }} diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index ffb2da180c3d..41f8c78b2925 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -18,6 +18,8 @@ name: Build and check Erlang/OTP on: push: pull_request: + schedule: + - cron: 0 1 * * * env: ## Equivalent to github.event_name == 'pull_request' ? github.base_ref : github.ref_name @@ -33,7 +35,7 @@ jobs: changes: ${{ steps.changes.outputs.changes }} all: ${{ steps.apps.outputs.all }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4.1.0 - uses: ./.github/actions/build-base-image with: BASE_BRANCH: ${{ env.BASE_BRANCH }} @@ -42,23 +44,36 @@ jobs: id: apps run: | .github/scripts/path-filters.sh > .github/scripts/path-filters.yaml + ## Print path-filters for debug purposes + cat .github/scripts/path-filters.yaml ALL_APPS=$(grep '^[a-z_]*:' .github/scripts/path-filters.yaml | sed 's/:.*$//') ALL_APPS=$(jq -n --arg inarr "${ALL_APPS}" '$inarr | split("\n")' | tr '\n' ' ') echo "all=${ALL_APPS}" >> $GITHUB_OUTPUT - - uses: dorny/paths-filter@v2 - id: changes + - uses: dorny/paths-filter@v2.11.1 + id: app-changes with: filters: .github/scripts/path-filters.yaml + - name: Override changes + id: changes + env: + ALL_APPS: ${{ steps.apps.outputs.all }} + CHANGED_APPS: ${{ steps.app-changes.outputs.changes }} + run: | + if ${{ github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'full-build-and-check') }} || ${{ github.event_name == 'schedule' }}; then + echo "changes=${ALL_APPS}" >> "$GITHUB_OUTPUT" + else + echo "changes=${CHANGED_APPS}" >> "$GITHUB_OUTPUT" + fi - name: Create initial pre-release tar run: .github/scripts/init-pre-release.sh otp_archive.tar.gz - name: Upload source tar archive - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v3.1.3 with: name: otp_git_archive path: otp_archive.tar.gz - name: Cache pre-built tar archives id: pre-built-cache - uses: actions/cache@v3 + uses: actions/cache@v3.3.2 with: path: | otp_src.tar.gz @@ -66,7 +81,7 @@ jobs: key: prebuilt-${{ github.ref_name }}-${{ github.sha }} restore-keys: | prebuilt-${{ github.base_ref }}-${{ github.event.pull_request.base.sha }} - - uses: dorny/paths-filter@v2 + - uses: dorny/paths-filter@v2.11.1 id: cache with: filters: | @@ -93,7 +108,7 @@ jobs: '${{ steps.cache.outputs.deleted_files }}' \ '${{ steps.changes.outputs.changes }}' - name: Upload restored cache - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v3.1.3 if: runner.debug == 1 with: name: restored-cache @@ -120,7 +135,7 @@ jobs: bash -c 'set -x; C_APPS=$(ls -d ./lib/*/c_src); find Makefile ./make ./erts ./bin/`erts/autoconf/config.guess` ./lib/erl_interface ./lib/jinterface ${C_APPS} `echo "${C_APPS}" | sed -e 's:c_src$:priv:'` -type f -newer README.md \! -name "*.beam" \! -path "*/doc/*" | xargs tar --transform "s:^./:otp/:" -uvf /github/otp_cache.tar' gzip otp_cache.tar - name: Upload pre-built tar archive - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v3.1.3 with: name: otp_prebuilt path: | @@ -134,16 +149,16 @@ jobs: env: WXWIDGETS_VERSION: 3.1.5 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4.1.0 - name: Download source archive - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v3.0.2 with: name: otp_prebuilt - name: Cache wxWidgets id: wxwidgets-cache - uses: actions/cache@v3 + uses: actions/cache@v3.3.2 with: path: wxWidgets key: wxWidgets-${{ env.WXWIDGETS_VERSION }}-${{ runner.os }}-12 @@ -169,7 +184,7 @@ jobs: ./bin/erl -noshell -eval '{wx_ref,_,_,_} = wx:new(), io:format("wx ok~n"), halt().' - name: Upload tarball - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v3.1.3 with: name: otp_prebuilt_macos_x86-64 path: otp/otp_macos_*_x86-64.tar.gz @@ -182,9 +197,9 @@ jobs: runs-on: macos-12 needs: pack steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4.1.0 - name: Download source archive - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v3.0.2 with: name: otp_prebuilt @@ -203,7 +218,7 @@ jobs: xcodebuild -create-xcframework -output ./liberlang.xcframework -library liberlang.a - name: Upload framework - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v3.1.3 with: name: ios_framework_${{ env.TARGET_ARCH }} path: otp/liberlang.xcframework @@ -218,7 +233,7 @@ jobs: runs-on: windows-2022 needs: pack steps: - - uses: Vampire/setup-wsl@v2 + - uses: Vampire/setup-wsl@v2.0.1 with: distribution: Ubuntu-18.04 @@ -232,7 +247,7 @@ jobs: IF EXIST "c:\\Program Files\\OpenSSL-Win64" (move "c:\\Program Files\\OpenSSL-Win64" "c:\\OpenSSL-Win64") ELSE (move "c:\\Program Files\\OpenSSL" "c:\\OpenSSL-Win64") - name: Cache wxWidgets - uses: actions/cache@v3 + uses: actions/cache@v3.3.2 with: path: wxWidgets key: wxWidgets-${{ env.WXWIDGETS_VERSION }}-${{ runner.os }} @@ -274,7 +289,7 @@ jobs: nmake TARGET_CPU=amd64 BUILD=release SHARED=0 DIR_SUFFIX_CPU= -f makefile.vc - name: Download source archive - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v3.0.2 with: name: otp_prebuilt @@ -302,7 +317,7 @@ jobs: ./otp_build installer_win32 - name: Upload installer - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v3.1.3 with: name: otp_win32_installer path: otp/release/win32/otp*.exe @@ -314,7 +329,7 @@ jobs: if: contains(needs.pack.outputs.changes, 'emulator') steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4.1.0 - uses: ./.github/actions/build-base-image with: BASE_BRANCH: ${{ env.BASE_BRANCH }} @@ -341,13 +356,13 @@ jobs: fail-fast: false steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4.1.0 - uses: ./.github/actions/build-base-image with: BASE_BRANCH: ${{ env.BASE_BRANCH }} TYPE: ${{ matrix.type }} - name: Download source archive - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v3.0.2 with: name: otp_prebuilt - name: Build ${{ matrix.type }} image @@ -361,7 +376,7 @@ jobs: runs-on: ubuntu-latest needs: pack steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4.1.0 - uses: ./.github/actions/build-base-image with: BASE_BRANCH: ${{ env.BASE_BRANCH }} @@ -383,12 +398,12 @@ jobs: rm -rf man tar czf ../otp_doc_html.tar.gz * - name: Upload html documentation archive - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v3.1.3 with: name: otp_doc_html path: otp_doc_html.tar.gz - name: Upload man documentation archive - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v3.1.3 with: name: otp_doc_man path: otp_doc_man.tar.gz @@ -403,7 +418,7 @@ jobs: runs-on: ubuntu-latest needs: pack steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4.1.0 - uses: ./.github/actions/build-base-image with: BASE_BRANCH: ${{ env.BASE_BRANCH }} @@ -432,7 +447,7 @@ jobs: # type: ["os_mon","sasl"] fail-fast: false steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4.1.0 - uses: ./.github/actions/build-base-image with: BASE_BRANCH: ${{ env.BASE_BRANCH }} @@ -469,7 +484,7 @@ jobs: sudo bash -c "chown -R `whoami` make_test_dir && chmod -R +r make_test_dir" tar czf ${{ matrix.type }}_test_results.tar.gz make_test_dir - name: Upload test results - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v3.1.3 if: always() with: name: ${{ matrix.type }}_test_results @@ -481,12 +496,12 @@ jobs: if: always() # Run even if the need has failed needs: test steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4.1.0 - uses: ./.github/actions/build-base-image with: BASE_BRANCH: ${{ env.BASE_BRANCH }} - name: Download test results - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v3.0.2 - name: Merge test results run: | shopt -s nullglob @@ -516,14 +531,14 @@ jobs: -e 's:\(file="erts/\)make_test_dir/[^/]*:\1test:g' \ make_test_dir/*_junit.xml - name: Upload test results - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v3.1.3 if: always() with: name: test_results path: test_results.tar.gz - name: Upload Test Results if: always() - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v3.1.3 with: name: Unit Test Results path: | @@ -547,19 +562,19 @@ jobs: echo "tag=${TAG}" >> $GITHUB_OUTPUT echo "vsn=${VSN}" >> $GITHUB_OUTPUT - - uses: actions/checkout@v3 + - uses: actions/checkout@v4.1.0 ## Publish the pre-built archive and docs - name: Download source archive - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v3.0.2 with: name: otp_prebuilt - name: Download html docs - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v3.0.2 with: name: otp_doc_html - name: Download man docs - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v3.0.2 with: name: otp_doc_man @@ -597,7 +612,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Upload - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v3.1.3 with: name: Event File path: ${{ github.event_path }} diff --git a/.github/workflows/pr-comment.yaml b/.github/workflows/pr-comment.yaml index 80a4622ae7c4..800ea07d040e 100644 --- a/.github/workflows/pr-comment.yaml +++ b/.github/workflows/pr-comment.yaml @@ -19,7 +19,7 @@ jobs: outputs: result: ${{ steps.pr-number.outputs.result }} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4.1.0 - name: Fetch PR number id: pr-number env: @@ -35,9 +35,9 @@ jobs: needs: pr-number if: github.event.action == 'requested' && needs.pr-number.outputs.result != '' steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4.1.0 ## We create an initial comment with some useful help to the user - - uses: actions/github-script@v5.1.1 + - uses: actions/github-script@v6.4.1 with: script: | const script = require('./.github/scripts/pr-comment.js'); @@ -54,7 +54,7 @@ jobs: needs.pr-number.outputs.result != '' && github.event.workflow_run.conclusion != 'skipped' steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4.1.0 - name: Download and Extract Artifacts id: extract env: @@ -79,14 +79,14 @@ jobs: echo "HAS_TEST_ARTIFACTS=false" >> $GITHUB_OUTPUT fi - - uses: actions/checkout@v2 + - uses: actions/checkout@v4.1.0 with: token: ${{ secrets.ERLANG_TOKEN }} repository: 'erlang/erlang.github.io' path: erlang.github.io - name: Publish CT Test Results - uses: EnricoMi/publish-unit-test-result-action@v1 + uses: EnricoMi/publish-unit-test-result-action@v2.10.0 if: steps.extract.outputs.HAS_TEST_ARTIFACTS == 'true' with: commit: ${{ github.event.workflow_run.head_sha }} @@ -122,7 +122,7 @@ jobs: ## Append some useful links and tips to the test results posted by ## Publish CT Test Results - - uses: actions/github-script@v5.1.1 + - uses: actions/github-script@v6.4.1 if: always() with: script: | diff --git a/.github/workflows/sync-github-prs.yaml b/.github/workflows/sync-github-prs.yaml new file mode 100644 index 000000000000..666e0e041f2d --- /dev/null +++ b/.github/workflows/sync-github-prs.yaml @@ -0,0 +1,45 @@ +name: Sync all github prs with erlang.github.io/prs/ + +## Sync all github prs twice a day +on: + workflow_dispatch: + schedule: + ## In UTC + - cron: '0 */4 * * *' + +jobs: + + sync-prs: + if: github.repository == 'erlang/otp' + concurrency: erlang.github.io-deploy + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v4.1.0 + - uses: actions/checkout@v4.1.0 + with: + token: ${{ secrets.ERLANG_TOKEN }} + repository: 'erlang/erlang.github.io' + path: erlang.github.io + - name: Update PRs + env: + GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} + run: | + git clone https://github.com/talentdeficit/jsx + (cd jsx && rebar3 compile) + mkdir -p "${GITHUB_WORKSPACE}/erlang.github.io/prs/" + touch "${GITHUB_WORKSPACE}/erlang.github.io/.nojekyll" + .github/scripts/sync-github-prs.es erlang/otp "${GITHUB_WORKSPACE}/erlang.github.io/prs/" + + - name: Deploy to github pages 🚀 + run: | + cd erlang.github.io + set -x + git config user.name github-actions + git config user.email github-actions@github.com + git add . + git add -u + git update-index --refresh + if ! git diff-index --quiet HEAD --; then + git commit -m "Update github pages content" + git push origin master + fi diff --git a/.github/workflows/sync-github-releases.yaml b/.github/workflows/sync-github-releases.yaml index 40dc72f6849d..192cc81a5028 100644 --- a/.github/workflows/sync-github-releases.yaml +++ b/.github/workflows/sync-github-releases.yaml @@ -1,6 +1,6 @@ name: Sync all github releases with erlang.org -## Sync all github releases + prs every hour +## Sync all github releases every hour on: workflow_dispatch: schedule: @@ -15,7 +15,7 @@ jobs: concurrency: sync-github-releases runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4.1.0 ## We need to login to the package registry in order to pull ## the base debian image. - name: Docker login @@ -26,34 +26,3 @@ jobs: run: > .github/scripts/sync-github-releases.sh ${{ github.repository }} "Bearer ${{ secrets.GITHUB_TOKEN }}" "^[2-9][1-9]\\..*" 25m - - sync-prs: - if: github.repository == 'erlang/otp' - concurrency: erlang.github.io-deploy - runs-on: ubuntu-20.04 - steps: - - uses: actions/checkout@v3 - with: - token: ${{ secrets.ERLANG_TOKEN }} - repository: 'erlang/erlang.github.io' - path: erlang.github.io - - uses: actions/checkout@v3 - - name: Update PRs - env: - GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} - run: | - git clone https://github.com/talentdeficit/jsx - (cd jsx && rebar3 compile) - rm -rf "${GITHUB_WORKSPACE}/erlang.github.io/.git" - mkdir -p "${GITHUB_WORKSPACE}/erlang.github.io/prs/" - touch "${GITHUB_WORKSPACE}/erlang.github.io/.nojekyll" - .github/scripts/sync-github-prs.es erlang/otp "${GITHUB_WORKSPACE}/erlang.github.io/prs/" - - - name: Deploy to github pages 🚀 - uses: JamesIves/github-pages-deploy-action@v4.4.1 - with: - token: ${{ secrets.ERLANG_TOKEN }} - branch: master # The branch the action should deploy to. - folder: erlang.github.io # The folder the action should deploy. - repository-name: erlang/erlang.github.io - single-commit: true diff --git a/.github/workflows/update-base.yaml b/.github/workflows/update-base.yaml index 381ecf44f82e..17e67faf8dd9 100644 --- a/.github/workflows/update-base.yaml +++ b/.github/workflows/update-base.yaml @@ -22,11 +22,11 @@ jobs: fail-fast: false steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4.1.0 with: ref: ${{ matrix.branch }} - name: Docker login - uses: docker/login-action@v2 + uses: docker/login-action@v3.0.0 with: registry: ghcr.io username: ${{ github.actor }} From 7de1d892c29ff664f82d850fef8db30a808038f6 Mon Sep 17 00:00:00 2001 From: Lukas Larsson Date: Thu, 12 Oct 2023 12:15:31 +0200 Subject: [PATCH 02/11] gh: Don't use key for cache restore --- .github/actions/build-base-image/action.yaml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/actions/build-base-image/action.yaml b/.github/actions/build-base-image/action.yaml index de9731c5de9a..425219dd7356 100644 --- a/.github/actions/build-base-image/action.yaml +++ b/.github/actions/build-base-image/action.yaml @@ -50,9 +50,7 @@ runs: path: | otp_src.tar.gz otp_cache.tar.gz - key: prebuilt-${{ github.job }}-${{ github.ref_name }}-${{ github.sha }} - restore-keys: | - prebuilt-${{ github.ref_name }}-${{ github.sha }} + key: prebuilt-${{ github.ref_name }}-${{ github.sha }} - name: Build image if: inputs.BUILD_IMAGE == 'true' shell: bash -euxo pipefail {0} From 862a554dad1e6ec6412ea114a379f97adcece112 Mon Sep 17 00:00:00 2001 From: Lukas Larsson Date: Thu, 12 Oct 2023 13:23:41 +0200 Subject: [PATCH 03/11] gh: Fix perf install --- .github/dockerfiles/init.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/dockerfiles/init.sh b/.github/dockerfiles/init.sh index 3033e3351d03..65e4294e6f7e 100755 --- a/.github/dockerfiles/init.sh +++ b/.github/dockerfiles/init.sh @@ -11,7 +11,7 @@ sudo /usr/sbin/sshd sudo service postgresql start sudo -E bash -c "apt-get update && apt-get install -y linux-tools-common linux-tools-generic" -sudo -E bash -c "apt-get install -y linux-tools-$(uname-r)" || true +sudo -E bash -c "apt-get install -y linux-tools-$(uname -r)" || true sudo bash -c "Xvfb :99 -ac -screen 0 1920x1080x24 -nolisten tcp" & export DISPLAY=:99 From 5b6effd68f2d360dc89daef8e2e128bd2a252a53 Mon Sep 17 00:00:00 2001 From: Lukas Larsson Date: Thu, 12 Oct 2023 15:24:25 +0200 Subject: [PATCH 04/11] gh: Pin kerl version --- .github/dockerfiles/Dockerfile.ubuntu-base | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/dockerfiles/Dockerfile.ubuntu-base b/.github/dockerfiles/Dockerfile.ubuntu-base index aa61012b4d39..c042ca51ad75 100644 --- a/.github/dockerfiles/Dockerfile.ubuntu-base +++ b/.github/dockerfiles/Dockerfile.ubuntu-base @@ -48,7 +48,7 @@ RUN mkdir /buildroot /tests /otp && chown ${USER}:${GROUP} /buildroot /tests /ot ## We install the latest version of the previous three releases in order to do ## backwards compatability testing of Erlang. RUN apt-get install -y git curl && \ - curl -L https://raw.githubusercontent.com/kerl/kerl/master/kerl > /usr/bin/kerl && \ + curl -L https://raw.githubusercontent.com/kerl/kerl/3.1.0/kerl > /usr/bin/kerl && \ chmod +x /usr/bin/kerl && \ kerl update releases && \ LATEST=$(kerl list releases | tail -1 | awk -F '.' '{print $1}') && \ From 8535a5efa405d3de99fd487952366d4a4543d6f9 Mon Sep 17 00:00:00 2001 From: Lukas Larsson Date: Fri, 13 Oct 2023 13:10:30 +0200 Subject: [PATCH 05/11] gh: Split otp_src and otp_cache into separate cache actions --- .github/actions/build-base-image/action.yaml | 14 +++++++---- .github/scripts/restore-from-prebuilt.sh | 26 +++++++++++++++++--- .github/workflows/main.yaml | 20 +++++++++------ 3 files changed, 44 insertions(+), 16 deletions(-) diff --git a/.github/actions/build-base-image/action.yaml b/.github/actions/build-base-image/action.yaml index 425219dd7356..2651baa52869 100644 --- a/.github/actions/build-base-image/action.yaml +++ b/.github/actions/build-base-image/action.yaml @@ -43,14 +43,18 @@ runs: shell: bash run: .github/scripts/build-base-image.sh "${{ inputs.BASE_BRANCH }}" "${{ inputs.TYPE }}" - - name: Cache pre-built tar archives + - name: Cache pre-built src if: inputs.BUILD_IMAGE == 'true' uses: actions/cache@v3 with: - path: | - otp_src.tar.gz - otp_cache.tar.gz - key: prebuilt-${{ github.ref_name }}-${{ github.sha }} + path: otp_src.tar.gz + key: prebuilt-src-${{ github.ref_name }}-${{ github.sha }} + - name: Cache pre-built binaries + if: inputs.BUILD_IMAGE == 'true' + uses: actions/cache@v3 + with: + path: otp_cache.tar.gz + key: prebuilt-cache-${{ inputs.TYPE }}-${{ github.ref_name }}-${{ github.sha }} - name: Build image if: inputs.BUILD_IMAGE == 'true' shell: bash -euxo pipefail {0} diff --git a/.github/scripts/restore-from-prebuilt.sh b/.github/scripts/restore-from-prebuilt.sh index 9fff27c28379..07b2b731fe09 100755 --- a/.github/scripts/restore-from-prebuilt.sh +++ b/.github/scripts/restore-from-prebuilt.sh @@ -1,4 +1,21 @@ #!/bin/bash +## restore-from-prebuilt.sh CACHE_SRC_DIR TARGET [ARCHIVE] [EVENT] [DELETED] [CHANGES] +## +## This script attempts to restore as much as possible from a previous +## CI run so that we don't have to build everything all the time. +## It works by merging the contents of: +## * ${ARCHIVE} - The original source code, created by git archive +## * ${CACHE_SOURCE_DIR}/otp_src.tar.gz - The pre-built tar archive +## * ${CACHE_SOURCE_DIR}/otp_cache.tar.gz - A cache of many binary files +## +## otp_src and otp_cache can be either from a different step in the same CI run +## or from a different CI run altogether. +## +## The archives above are then processed and placed into a new ${TARGET} archive. +## +## When running this script using the contents of a previous CI run you also have +## to pass the EVENT, DELETED and CHANGES arguments so that the correct parts of +## otp_src and otp_cache can be deleted. set -xe @@ -27,9 +44,12 @@ mkdir "${ARCHIVE_DIR}" echo "::group::{Restore cached files}" tar -C "${CACHE_DIR}/" -xzf "${CACHE_SOURCE_DIR}/otp_src.tar.gz" -## If configure scripts have NOT changed, we can restore configure and other C/java programs -if [ -z "${CONFIGURE}" ] || [ "${CONFIGURE}" = "false" ]; then - tar -C "${CACHE_DIR}/" -xzf "${CACHE_SOURCE_DIR}/otp_cache.tar.gz" +## If we have a binary cache +if [ -f "${CACHE_SOURCE_DIR}/otp_cache.tar.gz" ]; then + ## If configure scripts have NOT changed, we can restore configure and other C/java programs + if [ -z "${CONFIGURE}" ] || [ "${CONFIGURE}" = "false" ]; then + tar -C "${CACHE_DIR}/" -xzf "${CACHE_SOURCE_DIR}/otp_cache.tar.gz" + fi fi ## If bootstrap has been changed, we do not use the cached .beam files diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 41f8c78b2925..9eb3dfbfbfb8 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -71,16 +71,20 @@ jobs: with: name: otp_git_archive path: otp_archive.tar.gz - - name: Cache pre-built tar archives - id: pre-built-cache + - name: Cache pre-built src uses: actions/cache@v3.3.2 with: - path: | - otp_src.tar.gz - otp_cache.tar.gz - key: prebuilt-${{ github.ref_name }}-${{ github.sha }} + path: otp_src.tar.gz + key: prebuilt-src-${{ github.ref_name }}-${{ github.sha }} restore-keys: | - prebuilt-${{ github.base_ref }}-${{ github.event.pull_request.base.sha }} + prebuilt-src-${{ github.base_ref }}-${{ github.event.pull_request.base.sha }} + - name: Cache pre-built binaries + uses: actions/cache@v3.3.2 + with: + path: otp_cache.tar.gz + key: prebuilt-cache-64-bit-${{ github.ref_name }}-${{ github.sha }} + restore-keys: | + prebuilt-cache-64-bit-${{ github.base_ref }}-${{ github.event.pull_request.base.sha }} - uses: dorny/paths-filter@v2.11.1 id: cache with: @@ -134,7 +138,7 @@ jobs: docker run -v $PWD:/github --entrypoint "" otp \ bash -c 'set -x; C_APPS=$(ls -d ./lib/*/c_src); find Makefile ./make ./erts ./bin/`erts/autoconf/config.guess` ./lib/erl_interface ./lib/jinterface ${C_APPS} `echo "${C_APPS}" | sed -e 's:c_src$:priv:'` -type f -newer README.md \! -name "*.beam" \! -path "*/doc/*" | xargs tar --transform "s:^./:otp/:" -uvf /github/otp_cache.tar' gzip otp_cache.tar - - name: Upload pre-built tar archive + - name: Upload pre-built tar archives uses: actions/upload-artifact@v3.1.3 with: name: otp_prebuilt From a9f8d33eabbe3716f313b6515a7a4f0f41130e5e Mon Sep 17 00:00:00 2001 From: Lukas Larsson Date: Fri, 13 Oct 2023 13:11:03 +0200 Subject: [PATCH 06/11] gh: Build correct docker image for cross, 32 and clang --- .github/actions/build-base-image/action.yaml | 2 +- .github/workflows/main.yaml | 10 +--------- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/.github/actions/build-base-image/action.yaml b/.github/actions/build-base-image/action.yaml index 2651baa52869..06f445079777 100644 --- a/.github/actions/build-base-image/action.yaml +++ b/.github/actions/build-base-image/action.yaml @@ -63,5 +63,5 @@ runs: rm -f otp_{src,cache}.tar.gz docker build --tag otp \ --build-arg MAKEFLAGS=-j$(($(nproc) + 2)) \ - --file ".github/dockerfiles/Dockerfile.64-bit" \ + --file ".github/dockerfiles/Dockerfile.${{ inputs.TYPE }}" \ .github/ diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 9eb3dfbfbfb8..67f31481bf82 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -202,6 +202,7 @@ jobs: needs: pack steps: - uses: actions/checkout@v4.1.0 + - name: Download source archive uses: actions/download-artifact@v3.0.2 with: @@ -365,15 +366,6 @@ jobs: with: BASE_BRANCH: ${{ env.BASE_BRANCH }} TYPE: ${{ matrix.type }} - - name: Download source archive - uses: actions/download-artifact@v3.0.2 - with: - name: otp_prebuilt - - name: Build ${{ matrix.type }} image - run: | - mv otp_src.tar.gz .github/otp.tar.gz - docker build --tag otp --file .github/dockerfiles/Dockerfile.${{ matrix.type }} \ - .github documentation: name: Build and check documentation From 13903e6548b8d01031bc909f2956756de244a9e7 Mon Sep 17 00:00:00 2001 From: Lukas Larsson Date: Fri, 13 Oct 2023 13:11:37 +0200 Subject: [PATCH 07/11] gh: Fix argument bug when changing what has changed in prebuilt --- .github/scripts/restore-from-prebuilt.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/scripts/restore-from-prebuilt.sh b/.github/scripts/restore-from-prebuilt.sh index 07b2b731fe09..9e3a212366d9 100755 --- a/.github/scripts/restore-from-prebuilt.sh +++ b/.github/scripts/restore-from-prebuilt.sh @@ -24,7 +24,7 @@ TARGET="$2" ARCHIVE="$3" EVENT="$4" DELETED="$5" -CHANGES="$9" +CHANGES="$6" if [ ! -f "${CACHE_SOURCE_DIR}/otp_src.tar.gz" ] || [ "${NO_CACHE}" = "true" ]; then cp "${ARCHIVE}" "${TARGET}" From b26ef8d95b0b97f92374a419b2f3a87b6bf8add4 Mon Sep 17 00:00:00 2001 From: Lukas Larsson Date: Mon, 16 Oct 2023 10:11:09 +0200 Subject: [PATCH 08/11] gh: Rebuild bootstrap if any bootstrap apps changed --- .github/scripts/restore-from-prebuilt.sh | 26 +++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/.github/scripts/restore-from-prebuilt.sh b/.github/scripts/restore-from-prebuilt.sh index 9e3a212366d9..a72099feebde 100755 --- a/.github/scripts/restore-from-prebuilt.sh +++ b/.github/scripts/restore-from-prebuilt.sh @@ -91,29 +91,45 @@ if [ -n "${ARCHIVE}" ]; then ## Directory permissions in the archive and cache are for some reason different... chmod -R g-w "${ARCHIVE_DIR}/" - ## rlpgoD is the same as --archive, but without --times - RSYNC_ARGS=(-rlpgoD --itemize-changes --verbose --checksum --update "${EXCLUDE_BOOTSTRAP[@]}" "${ARCHIVE_DIR}/otp/" "${CACHE_DIR}/") - CHANGES="${TMP_DIR}/changes" PREV_CHANGES="${TMP_DIR}/prev-changes" touch "${PREV_CHANGES}" ## Below follows some rules about when we do not want to use the cache - ## The rules are run multiple times so that if any rule triggeres a delte + ## The rules are run multiple times so that if any rule triggeres a delete ## we will re-run the rules again with the new changes. for i in $(seq 1 10); do echo "::group::{Run ${i} at pruning cache}" - ## First do a dry run to see if we need to delete anything from cache + ## rlpgoD is the same as --archive, but without --times + RSYNC_ARGS=(-rlpgoD --itemize-changes --verbose --checksum --update "${EXCLUDE_BOOTSTRAP[@]}" "${ARCHIVE_DIR}/otp/" "${CACHE_DIR}/") + + ## We do a dry run to see if we need to purge anything from cache rsync --dry-run "${RSYNC_ARGS[@]}" | grep '^\(>\|c\)' > "${TMP_DIR}/changes" cat "${TMP_DIR}/changes" + ## If no new changes were done, we are done and can quit the loop if cmp -s "${CHANGES}" "${PREV_CHANGES}"; then break; fi + ### If any of the applications in the secondary or tertiary bootstrap have changed + ### we delete prebuilt.files which will trigger a rebuilt of the bootstrap + echo "::group::{Run ${i}: bootstrap applications}" + SECONDARY_BOOTSTRAP=(parsetools sasl asn1) + TERTIARY_BOOTSTRAP=(parsetools wx public_key erl_interface syntax_tools \ + snmp runtime_tools xmerl common_test) + for app in ${SECONDARY_BOOTSTRAP[@]} ${TERTIARY_BOOTSTRAP[@]}; do + if grep "lib/\(${app}\)" "${CHANGES}"; then + echo "Delete prebuilt.files and include bootstrap in sync" >&2 + rm -f "${CACHE_DIR}/prebuilt.files" + EXCLUDE_BOOTSTRAP=() + break + fi + done + ### If any parse transform is changed we recompile everything as we have ### no idea what it may change. If the parse transform calls any other ### modules we really should delete the cache for those as well, but From c9a323819bbafb91dc1dd52f45e336a82a114115 Mon Sep 17 00:00:00 2001 From: Lukas Larsson Date: Tue, 17 Oct 2023 10:06:20 +0200 Subject: [PATCH 09/11] gh: Pass args as env vars as DELETED can become very large --- .github/scripts/restore-from-prebuilt.sh | 15 +++++++++------ .github/workflows/main.yaml | 7 +++---- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/.github/scripts/restore-from-prebuilt.sh b/.github/scripts/restore-from-prebuilt.sh index a72099feebde..4d65ecc8f172 100755 --- a/.github/scripts/restore-from-prebuilt.sh +++ b/.github/scripts/restore-from-prebuilt.sh @@ -1,5 +1,5 @@ #!/bin/bash -## restore-from-prebuilt.sh CACHE_SRC_DIR TARGET [ARCHIVE] [EVENT] [DELETED] [CHANGES] +## restore-from-prebuilt.sh CACHE_SRC_DIR TARGET [ARCHIVE] ## ## This script attempts to restore as much as possible from a previous ## CI run so that we don't have to build everything all the time. @@ -14,17 +14,20 @@ ## The archives above are then processed and placed into a new ${TARGET} archive. ## ## When running this script using the contents of a previous CI run you also have -## to pass the EVENT, DELETED and CHANGES arguments so that the correct parts of -## otp_src and otp_cache can be deleted. +## to set the NO_CACHE, BOOTSTRAP, CONFIGURE, EVENT and DELETED environment +## variables so that the correct parts of otp_src and otp_cache can be deleted. +## +## * NO_CACHE - Don't use cache at all. Set if .github has changed or too many files have changed. +## * BOOTSTRAP - Don't cache any beam files. Set if bootstrap has changed. +## * CONFIGURE - Don't use any native cached. Set if configure has changed. +## * DELETED - Which files have been deleted and should therefore be deleted in the cache. +## * EVENT - The github event that triggered the change, currently unused. set -xe CACHE_SOURCE_DIR="$1" TARGET="$2" ARCHIVE="$3" -EVENT="$4" -DELETED="$5" -CHANGES="$6" if [ ! -f "${CACHE_SOURCE_DIR}/otp_src.tar.gz" ] || [ "${NO_CACHE}" = "true" ]; then cp "${ARCHIVE}" "${TARGET}" diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 67f31481bf82..de926cce6c05 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -104,13 +104,12 @@ jobs: NO_CACHE: ${{ steps.cache.outputs.no-cache }} BOOTSTRAP: ${{ steps.cache.outputs.bootstrap }} CONFIGURE: ${{ steps.cache.outputs.configure }} + EVENT: ${{ github.event_name }} + DELETED: ${{ steps.cache.outputs.deleted_files }} run: | .github/scripts/restore-from-prebuilt.sh "`pwd`" \ "`pwd`/.github/otp.tar.gz" \ - "`pwd`/otp_archive.tar.gz" \ - '${{ github.event_name }}' \ - '${{ steps.cache.outputs.deleted_files }}' \ - '${{ steps.changes.outputs.changes }}' + "`pwd`/otp_archive.tar.gz" - name: Upload restored cache uses: actions/upload-artifact@v3.1.3 if: runner.debug == 1 From ca0ac55dce6577043589819d08aa9ece56184deb Mon Sep 17 00:00:00 2001 From: Lukas Larsson Date: Tue, 17 Oct 2023 10:49:43 +0200 Subject: [PATCH 10/11] gh: NO_CACHE if too many deleted --- .github/workflows/main.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index de926cce6c05..d7393588c6e2 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -101,7 +101,7 @@ jobs: list-files: shell - name: Restore from cache env: - NO_CACHE: ${{ steps.cache.outputs.no-cache }} + NO_CACHE: ${{ steps.cache.outputs.no-cache || steps.cache.outputs.deleted_count > 20 }} BOOTSTRAP: ${{ steps.cache.outputs.bootstrap }} CONFIGURE: ${{ steps.cache.outputs.configure }} EVENT: ${{ github.event_name }} From dd3e46c203076a8484b9466d8c49936bd3e459ed Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sun, 22 Oct 2023 00:15:28 +0000 Subject: [PATCH 11/11] Update GitHub Action Versions --- .github/workflows/actions-updater.yaml | 2 +- .github/workflows/main.yaml | 21 ++++++++++----------- .github/workflows/pr-comment.yaml | 10 +++++----- .github/workflows/sync-github-prs.yaml | 4 ++-- .github/workflows/sync-github-releases.yaml | 2 +- .github/workflows/update-base.yaml | 2 +- 6 files changed, 20 insertions(+), 21 deletions(-) diff --git a/.github/workflows/actions-updater.yaml b/.github/workflows/actions-updater.yaml index 7dd777182b05..2a4980b3a40c 100644 --- a/.github/workflows/actions-updater.yaml +++ b/.github/workflows/actions-updater.yaml @@ -19,7 +19,7 @@ jobs: app_id: ${{ secrets.APP_ID }} private_key: ${{ secrets.APP_PEM }} - - uses: actions/checkout@v4.1.0 + - uses: actions/checkout@v4.1.1 with: token: ${{ steps.generate_token.outputs.token }} diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index d7393588c6e2..77bb08857f19 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -35,7 +35,7 @@ jobs: changes: ${{ steps.changes.outputs.changes }} all: ${{ steps.apps.outputs.all }} steps: - - uses: actions/checkout@v4.1.0 + - uses: actions/checkout@v4.1.1 - uses: ./.github/actions/build-base-image with: BASE_BRANCH: ${{ env.BASE_BRANCH }} @@ -152,7 +152,7 @@ jobs: env: WXWIDGETS_VERSION: 3.1.5 steps: - - uses: actions/checkout@v4.1.0 + - uses: actions/checkout@v4.1.1 - name: Download source archive uses: actions/download-artifact@v3.0.2 @@ -200,8 +200,7 @@ jobs: runs-on: macos-12 needs: pack steps: - - uses: actions/checkout@v4.1.0 - + - uses: actions/checkout@v4.1.1 - name: Download source archive uses: actions/download-artifact@v3.0.2 with: @@ -333,7 +332,7 @@ jobs: if: contains(needs.pack.outputs.changes, 'emulator') steps: - - uses: actions/checkout@v4.1.0 + - uses: actions/checkout@v4.1.1 - uses: ./.github/actions/build-base-image with: BASE_BRANCH: ${{ env.BASE_BRANCH }} @@ -360,7 +359,7 @@ jobs: fail-fast: false steps: - - uses: actions/checkout@v4.1.0 + - uses: actions/checkout@v4.1.1 - uses: ./.github/actions/build-base-image with: BASE_BRANCH: ${{ env.BASE_BRANCH }} @@ -371,7 +370,7 @@ jobs: runs-on: ubuntu-latest needs: pack steps: - - uses: actions/checkout@v4.1.0 + - uses: actions/checkout@v4.1.1 - uses: ./.github/actions/build-base-image with: BASE_BRANCH: ${{ env.BASE_BRANCH }} @@ -413,7 +412,7 @@ jobs: runs-on: ubuntu-latest needs: pack steps: - - uses: actions/checkout@v4.1.0 + - uses: actions/checkout@v4.1.1 - uses: ./.github/actions/build-base-image with: BASE_BRANCH: ${{ env.BASE_BRANCH }} @@ -442,7 +441,7 @@ jobs: # type: ["os_mon","sasl"] fail-fast: false steps: - - uses: actions/checkout@v4.1.0 + - uses: actions/checkout@v4.1.1 - uses: ./.github/actions/build-base-image with: BASE_BRANCH: ${{ env.BASE_BRANCH }} @@ -491,7 +490,7 @@ jobs: if: always() # Run even if the need has failed needs: test steps: - - uses: actions/checkout@v4.1.0 + - uses: actions/checkout@v4.1.1 - uses: ./.github/actions/build-base-image with: BASE_BRANCH: ${{ env.BASE_BRANCH }} @@ -557,7 +556,7 @@ jobs: echo "tag=${TAG}" >> $GITHUB_OUTPUT echo "vsn=${VSN}" >> $GITHUB_OUTPUT - - uses: actions/checkout@v4.1.0 + - uses: actions/checkout@v4.1.1 ## Publish the pre-built archive and docs - name: Download source archive diff --git a/.github/workflows/pr-comment.yaml b/.github/workflows/pr-comment.yaml index 800ea07d040e..ff941e49d836 100644 --- a/.github/workflows/pr-comment.yaml +++ b/.github/workflows/pr-comment.yaml @@ -19,7 +19,7 @@ jobs: outputs: result: ${{ steps.pr-number.outputs.result }} steps: - - uses: actions/checkout@v4.1.0 + - uses: actions/checkout@v4.1.1 - name: Fetch PR number id: pr-number env: @@ -35,7 +35,7 @@ jobs: needs: pr-number if: github.event.action == 'requested' && needs.pr-number.outputs.result != '' steps: - - uses: actions/checkout@v4.1.0 + - uses: actions/checkout@v4.1.1 ## We create an initial comment with some useful help to the user - uses: actions/github-script@v6.4.1 with: @@ -54,7 +54,7 @@ jobs: needs.pr-number.outputs.result != '' && github.event.workflow_run.conclusion != 'skipped' steps: - - uses: actions/checkout@v4.1.0 + - uses: actions/checkout@v4.1.1 - name: Download and Extract Artifacts id: extract env: @@ -79,14 +79,14 @@ jobs: echo "HAS_TEST_ARTIFACTS=false" >> $GITHUB_OUTPUT fi - - uses: actions/checkout@v4.1.0 + - uses: actions/checkout@v4.1.1 with: token: ${{ secrets.ERLANG_TOKEN }} repository: 'erlang/erlang.github.io' path: erlang.github.io - name: Publish CT Test Results - uses: EnricoMi/publish-unit-test-result-action@v2.10.0 + uses: EnricoMi/publish-unit-test-result-action@v2.11.0 if: steps.extract.outputs.HAS_TEST_ARTIFACTS == 'true' with: commit: ${{ github.event.workflow_run.head_sha }} diff --git a/.github/workflows/sync-github-prs.yaml b/.github/workflows/sync-github-prs.yaml index 666e0e041f2d..22a27f7afcd8 100644 --- a/.github/workflows/sync-github-prs.yaml +++ b/.github/workflows/sync-github-prs.yaml @@ -14,8 +14,8 @@ jobs: concurrency: erlang.github.io-deploy runs-on: ubuntu-20.04 steps: - - uses: actions/checkout@v4.1.0 - - uses: actions/checkout@v4.1.0 + - uses: actions/checkout@v4.1.1 + - uses: actions/checkout@v4.1.1 with: token: ${{ secrets.ERLANG_TOKEN }} repository: 'erlang/erlang.github.io' diff --git a/.github/workflows/sync-github-releases.yaml b/.github/workflows/sync-github-releases.yaml index 192cc81a5028..afcd15d700a9 100644 --- a/.github/workflows/sync-github-releases.yaml +++ b/.github/workflows/sync-github-releases.yaml @@ -15,7 +15,7 @@ jobs: concurrency: sync-github-releases runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4.1.0 + - uses: actions/checkout@v4.1.1 ## We need to login to the package registry in order to pull ## the base debian image. - name: Docker login diff --git a/.github/workflows/update-base.yaml b/.github/workflows/update-base.yaml index 17e67faf8dd9..e412e67c8346 100644 --- a/.github/workflows/update-base.yaml +++ b/.github/workflows/update-base.yaml @@ -22,7 +22,7 @@ jobs: fail-fast: false steps: - - uses: actions/checkout@v4.1.0 + - uses: actions/checkout@v4.1.1 with: ref: ${{ matrix.branch }} - name: Docker login