From 0f4189f73721150bc145dd4ce5e1fee4ad3601f3 Mon Sep 17 00:00:00 2001 From: Yota Toyama Date: Sat, 27 Apr 2024 18:13:32 +0900 Subject: [PATCH] Setup action (#2376) --- .github/workflows/benchmark.yaml | 4 +--- .github/workflows/lint.yaml | 8 ++------ .github/workflows/release.yaml | 4 +--- .github/workflows/test.yaml | 16 ++++------------ tools/ci/github/setup.sh | 2 ++ tools/ci/github/setup/action.yaml | 14 ++++++++++++++ 6 files changed, 24 insertions(+), 24 deletions(-) create mode 100644 tools/ci/github/setup/action.yaml diff --git a/.github/workflows/benchmark.yaml b/.github/workflows/benchmark.yaml index 8d01f883e9..893c64407e 100644 --- a/.github/workflows/benchmark.yaml +++ b/.github/workflows/benchmark.yaml @@ -13,9 +13,7 @@ jobs: runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v4 - - uses: Swatinem/rust-cache@v2 - - uses: Homebrew/actions/setup-homebrew@master - - run: tools/ci/github/setup.sh + - uses: ./tools/ci/github/setup - run: tools/build.sh - run: tools/benchmark.sh -b - run: tools/benchmark.sh diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index babe6042b2..b2671219d9 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -18,17 +18,13 @@ jobs: runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v4 - - uses: Swatinem/rust-cache@v2 - - uses: Homebrew/actions/setup-homebrew@master - - run: tools/ci/github/setup.sh + - uses: ./tools/ci/github/setup - run: tools/lint.sh -- -D warnings unused_dependencies: runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v4 - - uses: Swatinem/rust-cache@v2 - - uses: Homebrew/actions/setup-homebrew@master - - run: tools/ci/github/setup.sh + - uses: ./tools/ci/github/setup - run: tools/unused_dependencies.sh spell_check: runs-on: ubuntu-latest diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 8e0ecbe66d..d1ea6054da 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -34,9 +34,7 @@ jobs: runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4 - - uses: Swatinem/rust-cache@v2 - - uses: Homebrew/actions/setup-homebrew@master - - run: tools/ci/github/setup.sh + - uses: ./tools/ci/github/setup - run: echo asset=$(tools/build_asset.sh) >> $GITHUB_ENV - uses: actions/upload-artifact@v4 with: diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 7521452f8d..30aca6e42f 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -20,9 +20,7 @@ jobs: runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4 - - uses: Swatinem/rust-cache@v2 - - uses: Homebrew/actions/setup-homebrew@master - - run: tools/ci/github/setup.sh + - uses: ./tools/ci/github/setup - run: tools/build.sh - run: git diff --exit-code - uses: actions/upload-artifact@v4 @@ -33,17 +31,13 @@ jobs: runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v4 - - uses: Swatinem/rust-cache@v2 - - uses: Homebrew/actions/setup-homebrew@master - - run: tools/ci/github/setup.sh + - uses: ./tools/ci/github/setup - run: tools/unit_test.sh coverage: runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v4 - - uses: Swatinem/rust-cache@v2 - - uses: Homebrew/actions/setup-homebrew@master - - run: tools/ci/github/setup.sh + - uses: ./tools/ci/github/setup - run: tools/coverage.sh - uses: codecov/codecov-action@v3 with: @@ -63,9 +57,7 @@ jobs: runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4 - - uses: Homebrew/actions/setup-homebrew@master - - run: tools/ci/github/setup.sh - - uses: ruby/setup-ruby@v1 + - uses: ./tools/ci/github/setup - uses: actions/download-artifact@v4 with: name: build-${{ matrix.os }} diff --git a/tools/ci/github/setup.sh b/tools/ci/github/setup.sh index e86faebe68..dd2ac8cdeb 100755 --- a/tools/ci/github/setup.sh +++ b/tools/ci/github/setup.sh @@ -15,4 +15,6 @@ if [ $(uname) = Linux ]; then sudo apt update --fix-missing sudo apt install libc6-dbg # for valgrind brew install valgrind +else + echo LIBRARY_PATH=$(brew --prefix)/lib:$LIBRARY_PATH >>$GITHUB_ENV fi diff --git a/tools/ci/github/setup/action.yaml b/tools/ci/github/setup/action.yaml new file mode 100644 index 0000000000..3fe8ee93fe --- /dev/null +++ b/tools/ci/github/setup/action.yaml @@ -0,0 +1,14 @@ +name: pen/setup +description: Sets up a build environment +inputs: {} +outputs: {} +runs: + using: composite + steps: + - uses: ruby/setup-ruby@v1 + - uses: swatinem/rust-cache@v2 + - uses: homebrew/actions/setup-homebrew@master + with: + stable: true + - run: tools/ci/github/setup.sh + shell: bash