-
Notifications
You must be signed in to change notification settings - Fork 3.9k
[No QA] Use setup-node and setup-ruby for caching and installs #9815
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| name: Set up Node | ||
| description: Set up Node | ||
|
|
||
| runs: | ||
| using: composite | ||
| steps: | ||
| # Version: 3.0.2 | ||
| - uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b | ||
|
|
||
| - uses: actions/setup-node@09ba51f18e18a3756fea1f54d09c6745c064491d | ||
| with: | ||
| node-version: 16 | ||
| cache: npm | ||
|
|
||
| - name: Install node packages | ||
| uses: nick-invision/retry@7c68161adf97a48beb850a595b8784ec57a98cbb | ||
| with: | ||
| timeout_minutes: 10 | ||
| max_attempts: 5 | ||
| command: npm ci | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -31,40 +31,12 @@ jobs: | |
| if: ${{ fromJSON(needs.validateActor.outputs.IS_DEPLOYER) }} | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v2 | ||
| - uses: Expensify/App/.github/actions/composite/setupNode@main | ||
|
|
||
| - uses: actions/setup-ruby@v1 | ||
| - uses: ruby/setup-ruby@08245253a76fa4d1e459b7809579c62bd9eb718a | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note the use of https://github.com/ruby/setup-ruby instead of deprecated https://github.com/actions/setup-ruby. |
||
| with: | ||
| ruby-version: '2.7' | ||
|
|
||
| - uses: actions/cache@v2 | ||
| with: | ||
| path: vendor/bundle | ||
| key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }} | ||
|
|
||
| - name: Install bundler | ||
| run: | | ||
| bundle config path vendor/bundle | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. From the ruby/setup-ruby docs:
Since the action already used |
||
| gem install bundler | ||
|
|
||
| - name: Install gems | ||
| run: bundle install | ||
|
|
||
| - name: Cache node modules | ||
| uses: actions/cache@v2 | ||
| env: | ||
| cache-name: cache-node-modules | ||
| with: | ||
| # npm cache files are stored in `~/.npm` on Linux/macOS | ||
| path: ~/.npm | ||
| key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} | ||
|
|
||
| - name: Install node packages | ||
| uses: nick-invision/retry@7c68161adf97a48beb850a595b8784ec57a98cbb | ||
| with: | ||
| timeout_minutes: 10 | ||
| max_attempts: 5 | ||
| command: npm ci | ||
| bundler-cache: true | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This flag runs 'bundle install' and caches installed gems automatically |
||
|
|
||
| - name: Decrypt keystore | ||
| run: cd android/app && gpg --quiet --batch --yes --decrypt --passphrase="$LARGE_SECRET_PASSPHRASE" --output my-upload-key.keystore my-upload-key.keystore.gpg | ||
|
|
@@ -117,28 +89,7 @@ jobs: | |
| if: ${{ fromJSON(needs.validateActor.outputs.IS_DEPLOYER) }} | ||
| runs-on: macos-11 | ||
| steps: | ||
| - uses: actions/checkout@v2 | ||
|
|
||
| - name: Setup Node | ||
| uses: actions/setup-node@v1 | ||
| with: | ||
| node-version: '14.x' | ||
|
|
||
| - name: Cache node modules | ||
| uses: actions/cache@v2 | ||
| env: | ||
| cache-name: cache-node-modules | ||
| with: | ||
| # npm cache files are stored in `~/.npm` on Linux/macOS | ||
| path: ~/.npm | ||
| key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} | ||
|
|
||
| - name: Install node packages | ||
| uses: nick-invision/retry@7c68161adf97a48beb850a595b8784ec57a98cbb | ||
| with: | ||
| timeout_minutes: 10 | ||
| max_attempts: 5 | ||
| command: npm ci | ||
| - uses: Expensify/App/.github/composite/setupNode@main | ||
|
|
||
| - name: Decrypt Developer ID Certificate | ||
| run: cd desktop && gpg --quiet --batch --yes --decrypt --passphrase="$DEVELOPER_ID_SECRET_PASSPHRASE" --output developer_id.p12 developer_id.p12.gpg | ||
|
|
@@ -173,45 +124,12 @@ jobs: | |
| if: ${{ fromJSON(needs.validateActor.outputs.IS_DEPLOYER) }} | ||
| runs-on: macos-11 | ||
| steps: | ||
| - uses: actions/checkout@v2 | ||
|
|
||
| - name: Setup Node | ||
| uses: actions/setup-node@v1 | ||
| with: | ||
| node-version: '14.x' | ||
| - uses: Expensify/App/.github/composite/setupNode@main | ||
|
|
||
| - uses: actions/setup-ruby@v1 | ||
| - uses: ruby/setup-ruby@08245253a76fa4d1e459b7809579c62bd9eb718a | ||
| with: | ||
| ruby-version: '2.7' | ||
|
|
||
| - uses: actions/cache@v2 | ||
| with: | ||
| path: vendor/bundle | ||
| key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }} | ||
|
|
||
| - name: Install bundler | ||
| run: | | ||
| bundle config path vendor/bundle | ||
| gem install bundler | ||
|
|
||
| - name: Install gems | ||
| run: bundle install | ||
|
|
||
| - name: Cache node modules | ||
| uses: actions/cache@v2 | ||
| env: | ||
| cache-name: cache-node-modules | ||
| with: | ||
| # npm cache files are stored in `~/.npm` on Linux/macOS | ||
| path: ~/.npm | ||
| key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} | ||
|
|
||
| - name: Install node packages | ||
| uses: nick-invision/retry@7c68161adf97a48beb850a595b8784ec57a98cbb | ||
| with: | ||
| timeout_minutes: 10 | ||
| max_attempts: 5 | ||
| command: npm ci | ||
| bundler-cache: true | ||
|
|
||
| - name: Install cocoapods | ||
| uses: nick-invision/retry@7c68161adf97a48beb850a595b8784ec57a98cbb | ||
|
|
@@ -278,12 +196,7 @@ jobs: | |
| if: ${{ fromJSON(needs.validateActor.outputs.IS_DEPLOYER) }} | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v2 | ||
|
|
||
| - name: Setup Node | ||
| uses: actions/setup-node@v1 | ||
| with: | ||
| node-version: '14.x' | ||
| - uses: Expensify/App/.github/composite/setupNode@main | ||
|
|
||
| - name: Setup python | ||
| run: sudo apt-get install python3-setuptools | ||
|
|
@@ -303,22 +216,6 @@ jobs: | |
| aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
| aws-region: us-east-1 | ||
|
|
||
| - name: Cache node modules | ||
| uses: actions/cache@v2 | ||
| env: | ||
| cache-name: cache-node-modules | ||
| with: | ||
| # npm cache files are stored in `~/.npm` on Linux/macOS | ||
| path: ~/.npm | ||
| key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} | ||
|
|
||
| - name: Install node packages | ||
| uses: nick-invision/retry@7c68161adf97a48beb850a595b8784ec57a98cbb | ||
| with: | ||
| timeout_minutes: 10 | ||
| max_attempts: 5 | ||
| command: npm ci | ||
|
|
||
| - name: Build web for production | ||
| if: ${{ fromJSON(env.SHOULD_DEPLOY_PRODUCTION) }} | ||
| run: npm run build | ||
|
|
@@ -427,14 +324,10 @@ jobs: | |
| if: ${{ always() }} | ||
| needs: [android, desktop, iOS, web] | ||
| steps: | ||
| - uses: actions/checkout@v2 | ||
| with: | ||
| fetch-depth: 0 | ||
| - uses: Expensify/App/.github/actions/composite/setupNode@main | ||
|
|
||
| - name: Setup Node | ||
| uses: actions/setup-node@v1 | ||
| with: | ||
| node-version: '14.x' | ||
| - name: Fetch tags | ||
| run: git fetch --tags | ||
|
|
||
| - name: Set version | ||
| run: echo "VERSION=$(npm run print-version --silent)" >> "$GITHUB_ENV" | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note the use of built-in caching as opposed to actions/cache. Since this is maintained by GitHub hopefully it will work better on average than our caching has in the past. Also it's easier / less configuration needed.