From 420d069cc2b9abcc1c7cc6a5d3cd6731bac4f54c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8D=9C=E9=83=A8=E6=98=8C=E5=B9=B3?= Date: Fri, 30 Jun 2023 22:19:35 +0900 Subject: [PATCH] refactor extract mkdir Everyone does `mkdir build; src/autogen.sh`; why not merge them. --- .github/actions/setup/directories/action.yml | 111 +++++++++++++++++++ .github/workflows/annocheck.yml | 27 ++--- .github/workflows/baseruby.yml | 13 +-- .github/workflows/bundled_gems.yml | 17 +-- .github/workflows/check_dependencies.yml | 10 +- .github/workflows/check_misc.yml | 9 +- .github/workflows/codeql-analysis.yml | 8 +- .github/workflows/compilers.yml | 26 ++--- .github/workflows/macos.yml | 26 ++--- .github/workflows/mingw.yml | 51 +++------ .github/workflows/rjit-bindgen.yml | 32 ++---- .github/workflows/rjit.yml | 33 ++---- .github/workflows/ubuntu.yml | 31 ++---- .github/workflows/wasm.yml | 21 ++-- .github/workflows/windows.yml | 17 +-- .github/workflows/yjit-ubuntu.yml | 39 ++----- 16 files changed, 210 insertions(+), 261 deletions(-) create mode 100644 .github/actions/setup/directories/action.yml diff --git a/.github/actions/setup/directories/action.yml b/.github/actions/setup/directories/action.yml new file mode 100644 index 0000000000..c4d64ee7ea --- /dev/null +++ b/.github/actions/setup/directories/action.yml @@ -0,0 +1,111 @@ +name: Setup directories etc. +description: >- + Set up the source code and build directories (plus some + environmental tweaks) + +inputs: + srcdir: + required: false + default: ${{ github.workspace }} + description: >- + Directory to (re-)checkout source codes. This will be created + if absent. If there is no `configure` file that is also + generated inside. + + builddir: + required: false + default: ${{ github.workspace }} + description: >- + Where binaries and other generated contents go. This will be + created if absent. + + makeup: + required: false + type: boolean + # Note that `default: false` evaluates to a string constant + # `'false'`, which is a truthy value :sigh: + # https://github.com/actions/runner/issues/2238 + default: '' + description: >- + If set to true, additionally runs `make up`. + +outputs: {} # nothing? + +runs: + using: composite + + steps: + # Note that `shell: bash` works on both Windows and Linux, but not + # `shell: sh`. This is because GitHub hosted Windows runners have + # their bash manually installed. + - shell: bash + run: | + mkdir -p ${{ inputs.srcdir }} + mkdir -p ${{ inputs.builddir }} + + # Did you know that actions/checkout works without git(1)? We are + # checking that here. + - id: which + shell: bash + run: | + echo "git=`command -v git`" >> "$GITHUB_OUTPUT" + echo "sudo=`command -v sudo`" >> "$GITHUB_OUTPUT" + echo "autoreconf=`command -v autoreconf`" >> "$GITHUB_OUTPUT" + + - if: steps.which.outputs.git + shell: bash + run: | + git config --global core.autocrlf false + git config --global core.eol lf + git config --global advice.detachedHead 0 + git config --global init.defaultBranch garbage + + - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 + with: + path: ${{ inputs.srcdir }} + + - uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1 + with: + path: ${{ inputs.srcdir }}/.downloaded-cache + key: downloaded-cache + + - if: steps.which.outputs.autoreconf + shell: bash + working-directory: ${{ inputs.srcdir }} + run: ./autogen.sh + + # This is for MinGW. + - if: runner.os == 'Windows' + shell: bash + run: echo "GNUMAKEFLAGS=-j$((2 * NUMBER_OF_PROCESSORS))" >> $GITHUB_ENV + + - if: runner.os == 'Linux' + shell: bash + run: echo "GNUMAKEFLAGS=-sj$((1 + $(nproc --all)))" >> "$GITHUB_ENV" + + # macOS' GNU make is so old that they doesn't understand `GNUMAKEFLAGS`. + - if: runner.os == 'macOS' + shell: bash + run: echo "MAKEFLAGS=-j$((1 + $(sysctl -n hw.activecpu)))" >> "$GITHUB_ENV" + + - if: inputs.makeup + shell: bash + working-directory: ${{ inputs.srcdir }} + run: | + touch config.status + touch rbconfig.time + sed -f tool/prereq.status template/Makefile.in common.mk > Makefile + make up + + # Cleanup, runs even on failure + - if: always() && inputs.makeup + shell: bash + working-directory: ${{ inputs.srcdir }} + run: rm -f config.status Makefile rbconfig.rb .rbconfig.time + + - if: steps.which.outputs.sudo + shell: bash + run: | + sudo chmod -R go-w /usr/share + chmod -v go-w $HOME $HOME/.config || : + sudo bash -c 'IFS=:; for d in '"$PATH"'; do chmod -v go-w $d; done' || : diff --git a/.github/workflows/annocheck.yml b/.github/workflows/annocheck.yml index e73ae40397..811f676ecc 100644 --- a/.github/workflows/annocheck.yml +++ b/.github/workflows/annocheck.yml @@ -94,25 +94,15 @@ jobs: steps: - run: id working-directory: - - run: mkdir build - working-directory: - - name: setenv - run: | - echo "GNUMAKEFLAGS=-sj$((1 + $(nproc --all)))" >> $GITHUB_ENV - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 with: - path: src - - uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1 + sparse-checkout-cone-mode: false + sparse-checkout: /.github + - uses: ./.github/actions/setup/directories with: - path: src/.downloaded-cache - key: downloaded-cache - - name: autogen - run: | - if [ ! -f ./autogen.sh ]; then - ls -la - fi - ./autogen.sh - working-directory: src + srcdir: src + builddir: build + makeup: true - name: Run configure run: > ../src/configure -C ${default_configure} ${append_configure} @@ -122,8 +112,6 @@ jobs: matrix.entry.crosshost || '"${default_cc}${append_cc:+ $append_cc}"' }} --${{ matrix.entry.shared || 'enable' }}-shared - - run: make extract-extlibs - - run: make incs - run: make showflags - run: make - run: make test @@ -136,8 +124,7 @@ jobs: # env: # CHECK_LEAKS: true - run: make test-annocheck - - - uses: ./src/.github/actions/slack + - uses: ./.github/actions/slack with: label: ${{ matrix.entry.name }} SLACK_WEBHOOK_URL: ${{ secrets.SIMPLER_ALERTS_URL }} # ruby-lang slack: ruby/simpler-alerts-bot diff --git a/.github/workflows/baseruby.yml b/.github/workflows/baseruby.yml index c86da2ca12..75e28e281c 100644 --- a/.github/workflows/baseruby.yml +++ b/.github/workflows/baseruby.yml @@ -46,21 +46,16 @@ jobs: - ruby-3.2 steps: - - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 - - uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1 - with: - path: .downloaded-cache - key: downloaded-cache - uses: ruby/setup-ruby@250fcd6a742febb1123a77a841497ccaa8b9e939 # v1.152.0 with: ruby-version: ${{ matrix.ruby }} bundler: none - - run: echo "GNUMAKEFLAGS=-j$((1 + $(nproc --all)))" >> $GITHUB_ENV + - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 - uses: ./.github/actions/setup/ubuntu - - run: ./autogen.sh + - uses: ./.github/actions/setup/directories + with: + makeup: true - run: ./configure --disable-install-doc - - run: make common-srcs - - run: make incs - run: make all - run: make test - uses: ./.github/actions/slack diff --git a/.github/workflows/bundled_gems.yml b/.github/workflows/bundled_gems.yml index 3998f86f80..a39adaf354 100644 --- a/.github/workflows/bundled_gems.yml +++ b/.github/workflows/bundled_gems.yml @@ -31,25 +31,14 @@ jobs: name: update ${{ github.workflow }} runs-on: ubuntu-latest steps: - - name: git config - run: | - git config --global advice.detachedHead 0 - git config --global init.defaultBranch garbage + - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 + + - uses: ./.github/actions/setup/directories - name: Set ENV run: | - echo "GNUMAKEFLAGS=-j$((1 + $(nproc --all)))" >> $GITHUB_ENV echo "TODAY=$(date +%F)" >> $GITHUB_ENV - - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 - - - uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1 - with: - path: .downloaded-cache - key: downloaded-cache-${{ github.sha }} - restore-keys: | - downloaded-cache - - name: Download previous gems list run: | data=bundled_gems.json diff --git a/.github/workflows/check_dependencies.yml b/.github/workflows/check_dependencies.yml index d55846b2bc..b2c3130ea1 100644 --- a/.github/workflows/check_dependencies.yml +++ b/.github/workflows/check_dependencies.yml @@ -38,20 +38,12 @@ jobs: runs-on: ${{ matrix.os }} if: ${{ !contains(github.event.head_commit.message, '[DOC]') && !contains(github.event.pull_request.labels.*.name, 'Documentation') }} steps: - - name: git config - run: | - git config --global advice.detachedHead 0 - git config --global init.defaultBranch garbage - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 - uses: ./.github/actions/setup/ubuntu if: ${{ contains(matrix.os, 'ubuntu') }} - uses: ./.github/actions/setup/macos if: ${{ contains(matrix.os, 'macos') }} - - uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1 - with: - path: .downloaded-cache - key: downloaded-cache - - run: ./autogen.sh + - uses: ./.github/actions/setup/directories - name: Run configure run: ./configure -C --disable-install-doc --disable-rubygems --with-gcc 'optflags=-O0' 'debugflags=-save-temps=obj -g' - run: make all golf diff --git a/.github/workflows/check_misc.yml b/.github/workflows/check_misc.yml index 5f83ecfbbb..ab0b4f0008 100644 --- a/.github/workflows/check_misc.yml +++ b/.github/workflows/check_misc.yml @@ -15,6 +15,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 + - uses: ./.github/actions/setup/directories - name: Check if C-sources are US-ASCII run: | grep -r -n '[^ -~]' -- *.[chy] include internal win32/*.[ch] && exit 1 || : @@ -40,14 +41,6 @@ jobs: run: true if: ${{ github.ref == 'refs/heads/master' }} - - uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1 - with: - path: .downloaded-cache - key: downloaded-cache-${{ github.sha }} - restore-keys: | - downloaded-cache - if: steps.gems.outcome == 'success' - - name: Download previous gems list run: | data=default_gems.json diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 8efbaa1ed8..282b8b6987 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -53,10 +53,7 @@ jobs: - name: Install libraries uses: ./.github/actions/setup/ubuntu - - uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1 - with: - path: .downloaded-cache - key: downloaded-cache + - uses: ./.github/actions/setup/directories - name: Remove an obsolete rubygems vendored file run: sudo rm /usr/lib/ruby/vendor_ruby/rubygems/defaults/operating_system.rb @@ -66,9 +63,6 @@ jobs: with: languages: ${{ matrix.language }} - - name: Set ENV - run: echo "GNUMAKEFLAGS=-j$((1 + $(nproc --all)))" >> $GITHUB_ENV - - name: Autobuild uses: github/codeql-action/autobuild@cdcdbb579706841c47f7063dda365e292e5cad7a # v2.13.4 diff --git a/.github/workflows/compilers.yml b/.github/workflows/compilers.yml index 769e0a57ba..a47d7c2490 100644 --- a/.github/workflows/compilers.yml +++ b/.github/workflows/compilers.yml @@ -215,28 +215,18 @@ jobs: steps: - run: id working-directory: - - run: mkdir build - working-directory: - - name: setenv - run: | - echo "GNUMAKEFLAGS=-sj$((1 + $(nproc --all)))" >> $GITHUB_ENV - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 with: - path: src - - uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1 + sparse-checkout-cone-mode: false + sparse-checkout: /.github + - uses: ./.github/actions/setup/directories with: - path: src/.downloaded-cache - key: downloaded-cache + srcdir: src + builddir: build + makeup: true - name: Install Rust if: ${{ matrix.entry.rust }} run: sudo apt-get update && sudo apt install -y rustc - - name: autogen - run: | - if [ ! -f ./autogen.sh ]; then - ls -la - fi - ./autogen.sh - working-directory: src - name: Run configure run: > ../src/configure -C ${default_configure} ${append_configure} @@ -249,8 +239,6 @@ jobs: - name: Add to ext/Setup # statically link just the etc extension run: mkdir ext && echo etc >> ext/Setup if: ${{ matrix.entry.name == 'ext/Setup' }} - - run: make extract-extlibs - - run: make incs - run: make showflags - run: make - run: make test @@ -267,7 +255,7 @@ jobs: - run: make test-annocheck if: ${{ matrix.entry.check && endsWith(matrix.entry.name, 'annocheck') }} - - uses: ./src/.github/actions/slack + - uses: ./.github/actions/slack with: label: ${{ matrix.entry.name }} SLACK_WEBHOOK_URL: ${{ secrets.SIMPLER_ALERTS_URL }} # ruby-lang slack: ruby/simpler-alerts-bot diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index bb2c571c89..2be750e853 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -43,33 +43,25 @@ jobs: runs-on: ${{ matrix.os }} if: ${{ !contains(github.event.head_commit.message, '[DOC]') && !contains(github.event.pull_request.labels.*.name, 'Documentation') }} steps: - - run: mkdir build - working-directory: - - name: git config - run: | - git config --global advice.detachedHead 0 - git config --global init.defaultBranch garbage - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 with: - path: src - - uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1 - with: - path: src/.downloaded-cache - key: downloaded-cache + sparse-checkout-cone-mode: false + sparse-checkout: /.github - name: Install libraries - uses: ./src/.github/actions/setup/macos + uses: ./.github/actions/setup/macos + - uses: ./.github/actions/setup/directories + with: + srcdir: src + builddir: build + makeup: true - name: Set ENV run: | - echo "MAKEFLAGS=-j$((1 + $(sysctl -n hw.activecpu)))" >> $GITHUB_ENV for lib in openssl@1.1 readline; do CONFIGURE_ARGS="${CONFIGURE_ARGS:+$CONFIGURE_ARGS }--with-${lib%@*}-dir=$(brew --prefix $lib)" done echo CONFIGURE_ARGS="${CONFIGURE_ARGS}" >> $GITHUB_ENV - - run: ./autogen.sh - working-directory: src - name: Run configure run: ../src/configure -C --disable-install-doc - - run: make incs - run: make prepare-gems if: ${{ matrix.test_task == 'test-bundled-gems' }} - run: make @@ -92,7 +84,7 @@ jobs: PRECHECK_BUNDLED_GEMS: "no" if: ${{ matrix.test_task == 'check' && matrix.skipped_tests != '' }} continue-on-error: ${{ matrix.continue-on-skipped_tests || false }} - - uses: ./src/.github/actions/slack + - uses: ./.github/actions/slack with: label: ${{ matrix.test_task }} SLACK_WEBHOOK_URL: ${{ secrets.SIMPLER_ALERTS_URL }} # ruby-lang slack: ruby/simpler-alerts-bot diff --git a/.github/workflows/mingw.yml b/.github/workflows/mingw.yml index 224ecbd65f..3d3ede56a1 100644 --- a/.github/workflows/mingw.yml +++ b/.github/workflows/mingw.yml @@ -56,28 +56,10 @@ jobs: fail-fast: false if: ${{ !contains(github.event.head_commit.message, '[DOC]') && !contains(github.event.pull_request.labels.*.name, 'Documentation') }} steps: - - run: mkdir build - working-directory: - - name: git config - run: | - git config --global core.autocrlf false - git config --global core.eol lf - git config --global advice.detachedHead 0 - git config --global init.defaultBranch garbage - - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 - with: - path: src - - uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1 - with: - path: src/.downloaded-cache - key: downloaded-cache - name: Set up Ruby & MSYS2 uses: ruby/setup-ruby@250fcd6a742febb1123a77a841497ccaa8b9e939 # v1.152.0 with: ruby-version: ${{ matrix.base_ruby }} - - name: set env - run: | - echo "GNUMAKEFLAGS=-j$((2 * NUMBER_OF_PROCESSORS))" >> $GITHUB_ENV - name: where check run: | @@ -91,6 +73,7 @@ jobs: echo '##['endgroup']' done $result + working-directory: - name: version check run: | @@ -103,38 +86,34 @@ jobs: echo '##['endgroup']' done $result + working-directory: - - name: autogen - run: | - ./autogen.sh - working-directory: src + - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 + with: + sparse-checkout-cone-mode: false + sparse-checkout: /.github + + - uses: ./.github/actions/setup/directories + with: + srcdir: src + builddir: build + makeup: true - name: configure run: > ../src/configure --disable-install-doc --prefix=/. --build=$CHOST --host=$CHOST --target=$CHOST - - name: update - run: | - make incs - - - name: download gems - run: | - make update-gems - - name: make all timeout-minutes: 30 - run: | - make + run: make - name: make install - run: | - make DESTDIR=../install install-nodoc + run: make DESTDIR=../install install-nodoc - name: test timeout-minutes: 30 - run: | - make test + run: make test env: GNUMAKEFLAGS: "" RUBY_TESTOPTS: "-v --tty=no" diff --git a/.github/workflows/rjit-bindgen.yml b/.github/workflows/rjit-bindgen.yml index 3d767e72c0..7a7fe02799 100644 --- a/.github/workflows/rjit-bindgen.yml +++ b/.github/workflows/rjit-bindgen.yml @@ -39,44 +39,28 @@ jobs: runs-on: ubuntu-20.04 if: ${{ !contains(github.event.head_commit.message, '[DOC]') && !contains(github.event.pull_request.labels.*.name, 'Documentation') }} steps: - - run: mkdir build - working-directory: - - name: Set ENV - run: | - echo "GNUMAKEFLAGS=-j$((1 + $(nproc --all)))" >> $GITHUB_ENV - name: Set up Ruby uses: ruby/setup-ruby@250fcd6a742febb1123a77a841497ccaa8b9e939 # v1.152.0 with: ruby-version: '3.1' - - name: git config - run: | - git config --global advice.detachedHead 0 - git config --global init.defaultBranch garbage - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 with: - path: src - - name: Install libraries - uses: ./src/.github/actions/setup/ubuntu - - uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1 + sparse-checkout-cone-mode: false + sparse-checkout: /.github + - uses: ./.github/actions/setup/ubuntu + - uses: ./.github/actions/setup/directories with: - path: src/.downloaded-cache - key: downloaded-cache - - name: Fixed world writable dirs - run: | - chmod -v go-w $HOME $HOME/.config - sudo chmod -R go-w /usr/share - sudo bash -c 'IFS=:; for d in '"$PATH"'; do chmod -v go-w $d; done' || : - - run: ./autogen.sh - working-directory: src + srcdir: src + builddir: build + makeup: true - name: Run configure run: ../src/configure -C --disable-install-doc --prefix=$(pwd)/install --enable-yjit=dev_nodebug - - run: make incs - run: make - run: make install - run: make ${{ matrix.task }} - run: git diff --exit-code working-directory: src - - uses: ./src/.github/actions/slack + - uses: ./.github/actions/slack with: SLACK_WEBHOOK_URL: ${{ secrets.SIMPLER_ALERTS_URL }} # ruby-lang slack: ruby/simpler-alerts-bot if: ${{ failure() && github.event_name == 'push' }} diff --git a/.github/workflows/rjit.yml b/.github/workflows/rjit.yml index 1b64a1c102..65e0791b19 100644 --- a/.github/workflows/rjit.yml +++ b/.github/workflows/rjit.yml @@ -48,31 +48,16 @@ jobs: runs-on: ubuntu-22.04 if: ${{ !contains(github.event.head_commit.message, '[DOC]') && !contains(github.event.pull_request.labels.*.name, 'Documentation') }} steps: - - run: mkdir build - working-directory: - - name: Set ENV - run: | - echo "GNUMAKEFLAGS=-j$((1 + $(nproc --all)))" >> $GITHUB_ENV - - name: git config - run: | - git config --global advice.detachedHead 0 - git config --global init.defaultBranch garbage - - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.1.0 + - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 with: - path: src - - name: Install libraries - uses: ./src/.github/actions/setup/ubuntu - - uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.0.11 + sparse-checkout-cone-mode: false + sparse-checkout: /.github + - uses: ./.github/actions/setup/ubuntu + - uses: ./.github/actions/setup/directories with: - path: src/.downloaded-cache - key: downloaded-cache - - name: Fixed world writable dirs - run: | - chmod -v go-w $HOME $HOME/.config - sudo chmod -R go-w /usr/share - sudo bash -c 'IFS=:; for d in '"$PATH"'; do chmod -v go-w $d; done' || : - - run: ./autogen.sh - working-directory: src + srcdir: src + builddir: build + makeup: true - name: Run configure env: arch: ${{matrix.arch}} @@ -103,7 +88,7 @@ jobs: env: GNUMAKEFLAGS: "" RUN_OPTS: ${{ matrix.run_opts }} - - uses: ./src/.github/actions/slack + - uses: ./.github/actions/slack with: label: ${{ matrix.run_opts }} SLACK_WEBHOOK_URL: ${{ secrets.SIMPLER_ALERTS_URL }} # ruby-lang slack: ruby/simpler-alerts-bot diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index 07c97ed9d8..0f6dc3942f 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -54,32 +54,18 @@ jobs: runs-on: ubuntu-20.04 if: ${{ !contains(github.event.head_commit.message, '[DOC]') && !contains(github.event.pull_request.labels.*.name, 'Documentation') }} steps: - - run: mkdir build - working-directory: - - name: Set ENV - run: | - echo "GNUMAKEFLAGS=-j$((1 + $(nproc --all)))" >> $GITHUB_ENV - - name: git config - run: | - git config --global advice.detachedHead 0 - git config --global init.defaultBranch garbage - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 with: - path: src - - uses: ./src/.github/actions/setup/ubuntu + sparse-checkout-cone-mode: false + sparse-checkout: /.github + - uses: ./.github/actions/setup/ubuntu with: arch: ${{matrix.arch}} - - uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1 + - uses: ./.github/actions/setup/directories with: - path: src/.downloaded-cache - key: downloaded-cache - - name: Fixed world writable dirs - run: | - chmod -v go-w $HOME $HOME/.config - sudo chmod -R go-w /usr/share - sudo bash -c 'IFS=:; for d in '"$PATH"'; do chmod -v go-w $d; done' || : - - run: ./autogen.sh - working-directory: src + srcdir: src + builddir: build + makeup: true - name: Run configure env: arch: ${{matrix.arch}} @@ -87,7 +73,6 @@ jobs: run: >- $SETARCH ../src/configure -C --disable-install-doc ${configure:-cppflags=-DRUBY_DEBUG} ${arch:+--target=$arch-$OSTYPE --host=$arch-$OSTYPE} - - run: $SETARCH make incs - run: $SETARCH make prepare-gems if: ${{ matrix.test_task == 'test-bundled-gems' }} - run: $SETARCH make @@ -115,7 +100,7 @@ jobs: TESTS: ${{ matrix.skipped_tests }} if: ${{ matrix.test_task == 'check' && matrix.skipped_tests != '' }} continue-on-error: ${{ matrix.continue-on-skipped_tests || false }} - - uses: ./src/.github/actions/slack + - uses: ./.github/actions/slack with: label: ${{ matrix.test_task }} ${{ matrix.configure }}${{ matrix.arch }} SLACK_WEBHOOK_URL: ${{ secrets.SIMPLER_ALERTS_URL }} # ruby-lang slack: ruby/simpler-alerts-bot diff --git a/.github/workflows/wasm.yml b/.github/workflows/wasm.yml index bc788aef34..cd62957217 100644 --- a/.github/workflows/wasm.yml +++ b/.github/workflows/wasm.yml @@ -53,15 +53,15 @@ jobs: runs-on: ubuntu-20.04 if: ${{ !contains(github.event.head_commit.message, '[DOC]') && !contains(github.event.pull_request.labels.*.name, 'Documentation') }} steps: - - run: mkdir build - working-directory: - - name: git config - run: | - git config --global advice.detachedHead 0 - git config --global init.defaultBranch garbage - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 with: - path: src + sparse-checkout-cone-mode: false + sparse-checkout: /.github + - uses: ./.github/actions/setup/directories + with: + srcdir: src + builddir: build + makeup: true - name: Install libraries run: | set -ex @@ -87,10 +87,7 @@ jobs: working-directory: src - name: Set ENV run: | - echo "MAKEFLAGS=-j$((1 + $(sysctl -n hw.activecpu)))" >> $GITHUB_ENV echo "WASI_SDK_PATH=/opt/wasi-sdk" >> $GITHUB_ENV - - run: ./autogen.sh - working-directory: src - name: Run configure run: | ../src/configure \ @@ -103,7 +100,6 @@ jobs: optflags="${{ matrix.entry.optflags }}" \ debugflags="${{ matrix.entry.debugflags }}" \ wasmoptflags="${{ matrix.entry.wasmoptflags }} ${{ matrix.entry.debugflags }}" - # miniruby may not be built when cross-compling - run: make mini ruby - name: Run basictest @@ -114,8 +110,7 @@ jobs: NO_THREAD_TESTS="$(grep -L Thread -R ./bootstraptest | awk -F/ '{ print $NF }' | uniq | sed -n 's/test_\(.*\).rb/\1/p' | paste -s -d, -)" ruby ./bootstraptest/runner.rb --ruby="$(which wasmtime) run $PWD/../build/ruby --mapdir /::./ -- " --verbose "--sets=$NO_THREAD_TESTS" working-directory: src - - - uses: ./src/.github/actions/slack + - uses: ./.github/actions/slack with: label: ${{ matrix.name }} SLACK_WEBHOOK_URL: ${{ secrets.SIMPLER_ALERTS_URL }} # ruby-lang slack: ruby/simpler-alerts-bot diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index a733ae03f7..1dc6defd32 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -84,19 +84,14 @@ jobs: iex "& {$(irm get.scoop.sh)} -RunAsAdmin" Join-Path (Resolve-Path ~).Path "scoop\shims" >> $Env:GITHUB_PATH shell: pwsh - - name: git config - run: | - git config --global core.autocrlf false - git config --global core.eol lf - git config --global advice.detachedHead 0 - git config --global init.defaultBranch garbage - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 with: - path: src - - uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1 + sparse-checkout-cone-mode: false + sparse-checkout: /.github + - uses: ./.github/actions/setup/directories with: - path: src/.downloaded-cache - key: downloaded-cache + srcdir: src + builddir: build - name: setup env # %TEMP% is inconsistent with %TMP% and test-all expects they are consistent. # https://github.com/actions/virtual-environments/issues/712#issuecomment-613004302 @@ -140,7 +135,7 @@ jobs: env: RUBY_TESTOPTS: -j${{env.TEST_JOBS}} --job-status=normal timeout-minutes: 60 - - uses: ./src/.github/actions/slack + - uses: ./.github/actions/slack with: label: VS${{ matrix.vs }} / ${{ matrix.test_task || 'check' }} SLACK_WEBHOOK_URL: ${{ secrets.SIMPLER_ALERTS_URL }} # ruby-lang slack: ruby/simpler-alerts-bot diff --git a/.github/workflows/yjit-ubuntu.yml b/.github/workflows/yjit-ubuntu.yml index 8747b82588..6b20a5058d 100644 --- a/.github/workflows/yjit-ubuntu.yml +++ b/.github/workflows/yjit-ubuntu.yml @@ -97,39 +97,25 @@ jobs: runs-on: ubuntu-20.04 if: ${{ !contains(github.event.head_commit.message, '[DOC]') && !contains(github.event.pull_request.labels.*.name, 'Documentation') }} steps: - - run: mkdir build - working-directory: + - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 + with: + sparse-checkout-cone-mode: false + sparse-checkout: /.github + - uses: ./.github/actions/setup/ubuntu + - uses: ./.github/actions/setup/directories + with: + srcdir: src + builddir: build + makeup: true - name: Install Rust if: ${{ matrix.rust_version }} run: rustup install ${{ matrix.rust_version }} --profile minimal - - name: git config - run: | - git config --global advice.detachedHead 0 - git config --global init.defaultBranch garbage - - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 - with: - path: src - - uses: ./src/.github/actions/setup/ubuntu - - uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1 - with: - path: src/.downloaded-cache - key: downloaded-cache - - name: Fixed world writable dirs - run: | - chmod -v go-w $HOME $HOME/.config - sudo chmod -R go-w /usr/share - sudo bash -c 'IFS=:; for d in '"$PATH"'; do chmod -v go-w $d; done' || : - - name: Set ENV - run: | - echo "GNUMAKEFLAGS=-j$((1 + $(nproc --all)))" >> $GITHUB_ENV - - run: ./autogen.sh - working-directory: src - name: Run configure run: ../src/configure -C --disable-install-doc --prefix=$(pwd)/install ${{ matrix.configure }} - run: make incs - run: make prepare-gems if: ${{ matrix.test_task == 'test-bundled-gems' }} - - run: make -j + - run: make - name: Create dummy files in build dir run: | ./miniruby -e '(("a".."z").to_a+("A".."Z").to_a+("0".."9").to_a+%w[foo bar test zzz]).each{|basename|File.write("#{basename}.rb", "raise %(do not load #{basename}.rb)")}' @@ -154,8 +140,7 @@ jobs: BASE_REPO: ${{ github.event.pull_request.base.repo.full_name }} BASE_SHA: ${{ github.event.pull_request.base.sha }} if: ${{ matrix.test_task == 'yjit-bench' && startsWith(github.event_name, 'pull') }} - - - uses: ./src/.github/actions/slack + - uses: ./.github/actions/slack with: label: ${{ matrix.test_task }} ${{ matrix.configure }} SLACK_WEBHOOK_URL: ${{ secrets.SIMPLER_ALERTS_URL }} # ruby-lang slack: ruby/simpler-alerts-bot