Skip to content

Commit

Permalink
Merge pull request #7564 from mook-as/ci/shared-yarn-install
Browse files Browse the repository at this point in the history
CI: factor out `yarn install` dependencies
  • Loading branch information
jandubois authored Oct 3, 2024
2 parents 4d05021 + d37647e commit 6a103ae
Show file tree
Hide file tree
Showing 14 changed files with 59 additions and 354 deletions.
43 changes: 43 additions & 0 deletions .github/actions/yarn-install/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Yarn Install
description: >-
This is a composite action that does everything needed to do `yarn install`.
runs:
using: composite
steps:
# In case we're running on a self-hosted runner without `yarn` installed,
# set up NodeJS, enable `yarn`, and then handle the caching.
- uses: actions/setup-node@v4
with:
node-version-file: package.json
- run: corepack enable yarn
shell: bash
- uses: actions/setup-node@v4
with:
node-version-file: package.json
cache: yarn

- uses: actions/setup-go@v5
with:
go-version-file: go.work
cache-dependency-path: src/go/**/go.sum

- uses: actions/setup-python@v5
with:
python-version: '3.x'
cache: pip
- run: pip install setuptools
shell: bash

- name: Install Windows dependencies
if: runner.os == 'Windows'
shell: powershell
run: .\scripts\windows-setup.ps1 -SkipVisualStudio -SkipTools

- name: Flag build for M1
if: runner.os == 'macOS' && runner.arch == 'ARM64'
run: echo "M1=1" >> "${GITHUB_ENV}"
shell: bash

- run: yarn install --frozen-lockfile
shell: bash
16 changes: 1 addition & 15 deletions .github/workflows/docker-cli-monitor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,21 +27,7 @@ jobs:
with:
fetch-depth: 0

- uses: actions/setup-node@v4
with:
node-version-file: package.json
cache: yarn
- uses: actions/setup-go@v5
with:
go-version-file: go.work
cache-dependency-path: src/go/**/go.sum
- uses: actions/setup-python@v5
with:
python-version: '3.x'
cache: pip
- run: pip install setuptools

- run: yarn install --frozen-lockfile
- uses: ./.github/actions/yarn-install

- run: yarn dcmonitor
env:
Expand Down
19 changes: 1 addition & 18 deletions .github/workflows/go-work-sync.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,30 +39,13 @@ jobs:
ref: ${{ github.head_ref }}
fetch-depth: 3
token: ${{ steps.get-token.outputs.token }}
- uses: actions/setup-node@v4
with:
node-version-file: package.json
- run: corepack enable
- uses: actions/setup-node@v4
with:
node-version-file: package.json
cache: yarn
- uses: actions/setup-go@v5
with:
go-version-file: go.work
cache-dependency-path: '**/go.sum'
- uses: actions/setup-python@v5
with:
python-version: '3.x'
cache: pip
- run: pip install setuptools
- uses: ./.github/actions/yarn-install
- name: Determine go.mod files
id: go-files
run: >-
printf "go-files=%s go.work\n"
"$(git ls-files '**/go.mod' '**/go.sum' | tr '\r\n' ' ')"
>> "$GITHUB_OUTPUT"
- run: yarn install --frozen-lockfile
- run: yarn lint:go:fix
- name: Check for changes
id: changed
Expand Down
22 changes: 1 addition & 21 deletions .github/workflows/linux-e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,27 +19,7 @@ jobs:
- uses: actions/checkout@v4
with:
persist-credentials: false
# For compatibility with runners without yarn, we need to install node
# once, install yarn, then install node again to get caching.
- uses: actions/setup-node@v4
with:
node-version-file: package.json
- run: npm install --global yarn
- uses: actions/setup-node@v4
with:
node-version-file: package.json
cache: yarn
- uses: actions/setup-go@v5
with:
go-version-file: go.work
cache-dependency-path: src/go/**/go.sum
- uses: actions/setup-python@v5
with:
python-version: '3.x'
cache: pip
- run: pip install setuptools
- name: Install dependencies
run: yarn install --frozen-lockfile
- uses: ./.github/actions/yarn-install
- name: Disable admin-access before start up
run: |
mkdir -p $HOME/.config/rancher-desktop
Expand Down
30 changes: 1 addition & 29 deletions .github/workflows/macM1-e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,35 +17,7 @@ jobs:
with:
persist-credentials: false
ref: main
# For compatibility with runners without yarn, we need to install node
# once, install yarn, then install node again to get caching.
- uses: actions/setup-node@v4
with:
node-version-file: package.json
- run: npm install --global yarn
- uses: actions/setup-node@v4
with:
node-version-file: package.json
cache: yarn
- uses: actions/setup-go@v5
with:
go-version: go.work
cache-dependency-path: src/go/**/go.sum
- uses: actions/setup-python@v5
with:
python-version: '3.x'
cache: pip
- run: pip install setuptools
- name: Install dependencies
run: yarn install --frozen-lockfile
#The next steps is a workaround for an unexpected failure in launching electron before running e2e tests
#Such failure is addressed in issue #2915
- name: add tools to PATH
run: |
rm -fr $HOME/.rd/bin
mkdir -p $HOME/.rd/bin
cp -rf $HOME/actions-runner/_work/rancher-desktop/rancher-desktop/resources/darwin/bin/ $HOME/.rd/bin/
export PATH="$HOME/.rd/bin:$PATH"
- uses: ./.github/actions/yarn-install
- name: Disable admin-access before start up
run: |
mkdir -p $HOME/Library/Preferences/rancher-desktop
Expand Down
58 changes: 3 additions & 55 deletions .github/workflows/package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,28 +55,7 @@ jobs:
persist-credentials: false
# Needed to run `git describe` to get full version info
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version-file: package.json
cache: yarn
- uses: actions/setup-python@v5
with:
python-version: '3.x'
cache: pip
- uses: actions/setup-go@v5
with:
go-version-file: go.work
cache-dependency-path: src/go/**/go.sum
- name: Install Windows dependencies
if: runner.os == 'Windows'
shell: powershell
run: .\scripts\windows-setup.ps1 -SkipVisualStudio -SkipTools
- name: Flag build for M1
if: matrix.arch == 'aarch64' && matrix.platform == 'mac'
run: echo "M1=1" >> "${GITHUB_ENV}"
- run: pip install setuptools
- # Needs a network timeout for macos & windows. See https://github.com/yarnpkg/yarn/issues/8242 for more info
run: yarn install --frozen-lockfile --network-timeout 1000000
- uses: ./.github/actions/yarn-install
- run: yarn build
- run: yarn package
- name: Build bats.tar.gz
Expand Down Expand Up @@ -166,24 +145,7 @@ jobs:
- uses: actions/checkout@v4
with:
persist-credentials: false
- name: Install Windows dependencies
shell: powershell
run: .\scripts\windows-setup.ps1 -SkipVisualStudio -SkipTools
- uses: actions/setup-go@v5
with:
go-version-file: go.work
cache-dependency-path: src/go/**/go.sum
- uses: actions/setup-node@v4
with:
node-version-file: package.json
cache: yarn
- uses: actions/setup-python@v5
with:
python-version: '3.x'
cache: pip
- run: pip install setuptools
# Needs a network timeout for macos & windows. See https://github.com/yarnpkg/yarn/issues/8242 for more info
- run: yarn install --frozen-lockfile --network-timeout 1000000
- uses: ./.github/actions/yarn-install
- uses: actions/download-artifact@v4
name: Download artifact
with:
Expand Down Expand Up @@ -236,21 +198,7 @@ jobs:
- uses: actions/checkout@v4
with:
persist-credentials: false
- uses: actions/setup-go@v5
with:
go-version-file: go.work
cache-dependency-path: src/go/**/go.sum
- uses: actions/setup-node@v4
with:
node-version-file: package.json
cache: yarn
- uses: actions/setup-python@v5
with:
python-version: '3.x'
cache: pip
- run: pip install setuptools
# Needs a network timeout for macos & windows. See https://github.com/yarnpkg/yarn/issues/8242 for more info
- run: yarn install --frozen-lockfile --network-timeout 1000000
- uses: ./.github/actions/yarn-install
- uses: actions/download-artifact@v4
name: Download artifact
with:
Expand Down
18 changes: 1 addition & 17 deletions .github/workflows/rddepman.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,23 +29,7 @@ jobs:
with:
fetch-depth: 0

- uses: actions/setup-go@v5
with:
go-version-file: go.work
cache-dependency-path: src/go/**/go.sum

- uses: actions/setup-node@v4
with:
node-version-file: package.json
cache: yarn

- uses: actions/setup-python@v5
with:
python-version: '3.x'
cache: pip

- run: pip install setuptools
- run: yarn install --frozen-lockfile
- uses: ./.github/actions/yarn-install

- run: yarn rddepman
env:
Expand Down
21 changes: 1 addition & 20 deletions .github/workflows/release-merge-to-main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,26 +32,7 @@ jobs:
contents: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: package.json
- run: corepack enable yarn
- uses: actions/setup-node@v4
with:
node-version-file: package.json
cache: yarn
- uses: actions/setup-go@v5
with:
go-version-file: go.work
cache-dependency-path: src/go/**/go.sum
- uses: actions/setup-python@v5
with:
python-version: '3.x'
cache: pip
- run: pip install setuptools

- run: yarn install --frozen-lockfile

- uses: ./.github/actions/yarn-install
- run: node scripts/ts-wrapper.js scripts/release-merge-to-main.ts
env:
GITHUB_WRITE_TOKEN: ${{ github.token }}
Expand Down
20 changes: 1 addition & 19 deletions .github/workflows/screenshot.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -68,26 +68,8 @@ jobs:
- uses: actions/checkout@v4
with:
persist-credentials: false
- uses: actions/setup-node@v4
with:
node-version-file: package.json
- run: corepack enable yarn
- uses: actions/setup-node@v4
with:
node-version-file: package.json
cache: yarn
- uses: actions/setup-python@v5
with:
python-version: '3.x'
cache: pip
- uses: actions/setup-go@v5
with:
go-version-file: go.work
cache-dependency-path: src/go/**/go.sum
- uses: ./.github/actions/yarn-install
- uses: ./.github/actions/setup-environment
- run: pip install setuptools
- # Needs a network timeout for macos & windows. See https://github.com/yarnpkg/yarn/issues/8242 for more info
run: yarn install --frozen-lockfile --network-timeout 1000000
- name: Override version
if: inputs.mock_version
run: echo "RD_MOCK_VERSION=${{ inputs.mock_version }}" >> "${GITHUB_ENV}"
Expand Down
30 changes: 2 additions & 28 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,7 @@ jobs:
- uses: actions/checkout@v4
with:
persist-credentials: false
- uses: actions/setup-python@v5
with:
python-version: '3.x'
cache: pip
- uses: actions/setup-node@v4
with:
node-version-file: package.json
cache: yarn
- uses: actions/setup-go@v5
with:
go-version-file: go.work
cache-dependency-path: src/go/**/go.sum
- run: pip install setuptools
- run: yarn install --frozen-lockfile
- uses: ./.github/actions/yarn-install
- run: yarn build
- run: yarn lint:nofix
- name: Install shfmt
Expand All @@ -48,18 +35,5 @@ jobs:
- uses: actions/checkout@v4
with:
persist-credentials: false
- uses: actions/setup-node@v4
with:
node-version-file: package.json
cache: yarn
- uses: actions/setup-go@v5
with:
go-version-file: go.work
cache-dependency-path: src/go/**/go.sum
- uses: actions/setup-python@v5
with:
python-version: '3.x'
cache: pip
- run: pip install setuptools
- run: yarn install --frozen-lockfile
- uses: ./.github/actions/yarn-install
- run: yarn lint:nofix
18 changes: 1 addition & 17 deletions .github/workflows/ucmonitor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,23 +27,7 @@ jobs:
with:
fetch-depth: 0

- uses: actions/setup-node@v4
with:
node-version-file: package.json
cache: yarn

- uses: actions/setup-python@v5
with:
python-version: '3.x'
cache: pip

- uses: actions/setup-go@v5
with:
go-version-file: go.work
cache-dependency-path: src/go/**/go.sum

- run: pip install setuptools
- run: yarn install --frozen-lockfile
- uses: ./.github/actions/yarn-install

- run: yarn ucmonitor
env:
Expand Down
Loading

0 comments on commit 6a103ae

Please sign in to comment.