summaryrefslogtreecommitdiff
path: root/.github
diff options
context:
space:
mode:
author卜部昌平 <shyouhei@ruby-lang.org>2020-10-19 15:32:39 +0900
committer卜部昌平 <shyouhei@ruby-lang.org>2020-10-21 09:24:47 +0900
commitda25affdacc45dd54a1d4c12a5f8394145811276 (patch)
tree72ebfddce08ad5756d14a9af87134978ee5494d7 /.github
parent1c5f44cd728e8c42fd99a74151752e2980e65d0f (diff)
.github: reduce copy&paste
Found that we can set default working directory for github actions.
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/3675
Diffstat (limited to '.github')
-rw-r--r--.github/workflows/check_dependencies.yml24
-rw-r--r--.github/workflows/compilers.yml17
-rw-r--r--.github/workflows/macos.yml12
-rw-r--r--.github/workflows/mingw.yml15
-rw-r--r--.github/workflows/mjit.yml14
-rw-r--r--.github/workflows/ubuntu.yml13
-rw-r--r--.github/workflows/windows.yml15
7 files changed, 40 insertions, 70 deletions
diff --git a/.github/workflows/check_dependencies.yml b/.github/workflows/check_dependencies.yml
index 3439c04f9d..0ad2d5e757 100644
--- a/.github/workflows/check_dependencies.yml
+++ b/.github/workflows/check_dependencies.yml
@@ -2,11 +2,7 @@ name: Check Dependencies
on: [push, pull_request]
jobs:
update-deps:
- strategy:
- matrix:
- os: [ubuntu-20.04]
- fail-fast: true
- runs-on: ${{ matrix.os }}
+ runs-on: ubuntu-20.04
if: "!contains(github.event.head_commit.message, '[ci skip]')"
steps:
- name: Install libraries
@@ -18,28 +14,12 @@ jobs:
run: |
git config --global advice.detachedHead 0
- uses: actions/checkout@v2
- with:
- path: src
- - 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 "JOBS=-j$((1 + $(nproc --all)))" >> $GITHUB_ENV
- run: autoconf
- working-directory: src
- name: Run configure
run: ./configure -C --disable-install-doc --disable-rubygems --with-gcc 'optflags=-O0' 'debugflags=-save-temps=obj -g'
- working-directory: src
- - name: Run make
- run: make all golf
- working-directory: src
+ - run: make all golf
- run: ruby tool/update-deps --fix
- working-directory: src
- run: git diff --no-ext-diff --ignore-submodules --exit-code
- working-directory: src
- uses: k0kubun/action-slack@v2.0.0
with:
payload: |
diff --git a/.github/workflows/compilers.yml b/.github/workflows/compilers.yml
index 88b6c3ac51..17211b5e1e 100644
--- a/.github/workflows/compilers.yml
+++ b/.github/workflows/compilers.yml
@@ -159,18 +159,18 @@ jobs:
container: ghcr.io/ruby/ruby-ci-image:latest
if: "!contains(github.event.head_commit.message, '[ci skip]')"
steps:
+ - run: mkdir build
+ working-directory:
- name: setenv
run: |
echo "${{ matrix.entry.key }}=${{ matrix.entry.value }}" >> $GITHUB_ENV
echo "make=make -sj$((1 + $(nproc --all)))" >> $GITHUB_ENV
- - run: mkdir build
- uses: actions/checkout@v2
with:
path: src
- run: autoconf
working-directory: src
- name: Run configure
- working-directory: build
run: |
if [ -n "${crosshost}" ]; then
../src/configure -C \
@@ -184,27 +184,18 @@ jobs:
--with-gcc="${default_cc} ${append_cc}"
fi
- run: $make extract-extlibs
- working-directory: build
- run: $make incs
- working-directory: build
- run: $make
- working-directory: build
- run: $make test
- working-directory: build
- run: $make install
- working-directory: build
if: "matrix.entry.name == '-O3'"
- run: /usr/local/bin/gem install --no-doc timezone tzinfo
- working-directory: build
if: "matrix.entry.name == '-O3'"
- run: $make test-tool
- working-directory: build
if: "matrix.entry.name == '-O3'"
- run: $make test-all TESTS='-- ruby -ext-'
- working-directory: build
if: "matrix.entry.name == '-O3'"
- run: $make test-spec
- working-directory: build
if: "matrix.entry.name == '-O3'"
- uses: k0kubun/action-slack@v2.0.0
@@ -220,3 +211,7 @@ jobs:
env:
SLACK_WEBHOOK_URL: ${{ secrets.SIMPLER_ALERTS_URL }} # ruby-lang slack: ruby/simpler-alerts-bot
if: failure() && github.event_name == 'push'
+
+defaults:
+ run:
+ working-directory: build
diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml
index 34757ea193..f0355258f1 100644
--- a/.github/workflows/macos.yml
+++ b/.github/workflows/macos.yml
@@ -11,6 +11,8 @@ jobs:
GITPULLOPTIONS: --no-tags origin ${{github.ref}}
if: "!contains(github.event.head_commit.message, '[ci skip]')"
steps:
+ - run: mkdir build
+ working-directory:
- name: Disable Firewall
run: |
sudo /usr/libexec/ApplicationFirewall/socketfilterfw --setglobalstate off
@@ -32,20 +34,14 @@ jobs:
echo "JOBS=-j$((1 + $(sysctl -n hw.activecpu)))" >> $GITHUB_ENV
- run: autoconf
working-directory: src
- - run: mkdir build
- name: Run configure
run: ../src/configure -C --disable-install-doc --with-openssl-dir=$(brew --prefix openssl@1.1) --with-readline-dir=$(brew --prefix readline)
- working-directory: build
- run: make $JOBS incs
- working-directory: build
- run: make $JOBS
- working-directory: build
- run: make prepare-gems
- working-directory: build
if: matrix.test_task == 'check'
- run: make $JOBS -s ${{ matrix.test_task }}
timeout-minutes: 60
- working-directory: build
env:
RUBY_TESTOPTS: "-q --tty=no"
TEST_BUNDLED_GEMS_ALLOW_FAILURES: "rexml"
@@ -62,3 +58,7 @@ jobs:
env:
SLACK_WEBHOOK_URL: ${{ secrets.SIMPLER_ALERTS_URL }} # ruby-lang slack: ruby/simpler-alerts-bot
if: failure() && github.event_name == 'push'
+
+defaults:
+ run:
+ working-directory: build
diff --git a/.github/workflows/mingw.yml b/.github/workflows/mingw.yml
index 8aacb7238f..36c8d747a7 100644
--- a/.github/workflows/mingw.yml
+++ b/.github/workflows/mingw.yml
@@ -24,6 +24,8 @@ jobs:
fail-fast: false
if: "!contains(github.event.head_commit.message, '[ci skip]')"
steps:
+ - run: mkdir build
+ working-directory:
- name: git config
run: |
git config --system core.autocrlf false
@@ -50,14 +52,13 @@ jobs:
}
- name: misc setup, autoreconf
run: |
- mkdir build
mkdir install
mkdir temp
cd src
sh -c "autoreconf -fi"
+ working-directory:
- name: configure
- working-directory: build
run: |
# Actions uses UTF8, causes test failures, similar to normal OS setup
$PSDefaultParameterValues['*:Encoding'] = 'utf8'
@@ -70,26 +71,22 @@ jobs:
# Get-Content ./config.log | foreach {Write-Output $_}
- name: update
- working-directory: build
run: |
$jobs = [int](2 * $env:NUMBER_OF_PROCESSORS)
make -j $jobs incs
- name: download gems
- working-directory: build
run: |
$jobs = [int](2 * $env:NUMBER_OF_PROCESSORS)
make -j $jobs update-gems
- name: make all
timeout-minutes: 40
- working-directory: build
run: |
$jobs = [int](2 * $env:NUMBER_OF_PROCESSORS)
make -j $jobs
- name: make install
- working-directory: build
run: |
# Actions uses UTF8, causes test failures, similar to normal OS setup
$PSDefaultParameterValues['*:Encoding'] = 'utf8'
@@ -99,13 +96,11 @@ jobs:
- name: test
timeout-minutes: 5
- working-directory: build
run: |
make test
- name: test-all
timeout-minutes: 60
- working-directory: build
run: |
# Actions uses UTF8, causes test failures, similar to normal OS setup
$PSDefaultParameterValues['*:Encoding'] = 'utf8'
@@ -139,3 +134,7 @@ jobs:
env:
SLACK_WEBHOOK_URL: ${{ secrets.SIMPLER_ALERTS_URL }} # ruby-lang slack: ruby/simpler-alerts-bot
if: failure() && github.event_name == 'push'
+
+defaults:
+ run:
+ working-directory: build
diff --git a/.github/workflows/mjit.yml b/.github/workflows/mjit.yml
index 80ab351700..cdb6c940cb 100644
--- a/.github/workflows/mjit.yml
+++ b/.github/workflows/mjit.yml
@@ -14,6 +14,8 @@ jobs:
RUN_OPTS: '--disable-gems ${{ matrix.jit_opts }}'
GITPULLOPTIONS: --no-tags origin ${{github.ref}}
steps:
+ - run: mkdir build
+ working-directory:
- name: Install libraries
run: |
set -x
@@ -35,25 +37,17 @@ jobs:
echo "JOBS=-j$((1 + $(nproc --all)))" >> $GITHUB_ENV
- run: autoconf
working-directory: src
- - run: mkdir build
- name: Run configure
run: ../src/configure -C --disable-install-doc
- working-directory: build
- run: make $JOBS incs
- working-directory: build
- run: make $JOBS
- working-directory: build
- run: sudo make $JOBS -s install
- working-directory: build
- run: make $JOBS -s test RUN_OPTS="$RUN_OPTS"
timeout-minutes: 10
- working-directory: build
- run: make $JOBS -s test-all RUN_OPTS="$RUN_OPTS"
timeout-minutes: 10
- working-directory: build
- run: make $JOBS -s test-spec RUN_OPTS="$RUN_OPTS"
timeout-minutes: 5
- working-directory: build
- uses: k0kubun/action-slack@v2.0.0
with:
payload: |
@@ -67,3 +61,7 @@ jobs:
env:
SLACK_WEBHOOK_URL: ${{ secrets.SIMPLER_ALERTS_URL }} # ruby-lang slack: ruby/simpler-alerts-bot
if: failure() && github.event_name == 'push'
+
+defaults:
+ run:
+ working-directory: build
diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml
index a5132ad053..38649d3f67 100644
--- a/.github/workflows/ubuntu.yml
+++ b/.github/workflows/ubuntu.yml
@@ -29,6 +29,8 @@ jobs:
runs-on: ${{ matrix.os }}
if: "!contains(github.event.head_commit.message, '[ci skip]')"
steps:
+ - run: mkdir build
+ working-directory:
- name: Install libraries
run: |
set -x
@@ -50,25 +52,18 @@ jobs:
echo "JOBS=-j$((1 + $(nproc --all)))" >> $GITHUB_ENV
- run: autoconf
working-directory: src
- - run: mkdir build
- name: Run configure
run: ../src/configure -C --disable-install-doc cppflags=${{ matrix.debug }}
- working-directory: build
- run: make $JOBS incs
- working-directory: build
- run: make $JOBS
- working-directory: build
- run: make prepare-gems
- working-directory: build
if: matrix.test_task == 'check'
- 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)")}'
- working-directory: build
if: matrix.test_task == 'check'
- run: make $JOBS -s ${{ matrix.test_task }}
timeout-minutes: 30
- working-directory: build
env:
RUBY_TESTOPTS: "-q --tty=no"
TEST_BUNDLED_GEMS_ALLOW_FAILURES: ""
@@ -85,3 +80,7 @@ jobs:
env:
SLACK_WEBHOOK_URL: ${{ secrets.SIMPLER_ALERTS_URL }} # ruby-lang slack: ruby/simpler-alerts-bot
if: failure() && github.event_name == 'push'
+
+defaults:
+ run:
+ working-directory: build
diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml
index 0ae537959a..98e59ae188 100644
--- a/.github/workflows/windows.yml
+++ b/.github/workflows/windows.yml
@@ -14,6 +14,8 @@ jobs:
VCVARS: C:\Program Files (x86)\Microsoft Visual Studio\${{ matrix.vs }}\Enterprise\VC\Auxiliary\Build\vcvars64.bat
if: "!contains(github.event.head_commit.message, '[ci skip]')"
steps:
+ - run: md build
+ working-directory:
- uses: actions/cache@v2
with:
path: C:\vcpkg\downloads
@@ -41,14 +43,10 @@ jobs:
- uses: actions/checkout@v2
with:
path: src
- - run: md build
- shell: cmd
- name: Configure
run: |
call "%VCVARS%"
../src/win32/configure.bat --disable-install-doc --without-ext=+,dbm,gdbm --enable-bundled-libffi --with-opt-dir=C:/vcpkg/installed/x64-windows --with-openssl-dir="C:/Program Files/OpenSSL-Win64"
- working-directory: build
- shell: cmd
- name: nmake
run: |
call "%VCVARS%"
@@ -57,15 +55,11 @@ jobs:
nmake incs
nmake extract-extlibs
nmake
- working-directory: build
- shell: cmd
- name: nmake test
timeout-minutes: 30
run: |
call "%VCVARS%"
nmake ${{ matrix.test_task }}
- working-directory: build
- shell: cmd
- uses: k0kubun/action-slack@v2.0.0
with:
payload: |
@@ -79,3 +73,8 @@ jobs:
env:
SLACK_WEBHOOK_URL: ${{ secrets.SIMPLER_ALERTS_URL }} # ruby-lang slack: ruby/simpler-alerts-bot
if: failure() && github.event_name == 'push'
+
+defaults:
+ run:
+ working-directory: build
+ shell: cmd