Skip to content
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

Reusable actions and update chrome(driver) #32

Merged
merged 11 commits into from
Dec 21, 2023
46 changes: 46 additions & 0 deletions .github/workflows/base-jobs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Base Website builder

on:
workflow_call:

jobs:
prepare-sources:
name: Prepare the website sources
runs-on: buildjet-4vcpu-ubuntu-2204
steps:
- name: Clone
uses: actions/checkout@v4

- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '11'
cache: 'maven'

- uses: actions/setup-node@v3
with:
node-version: 16
cache: yarn

- uses: browser-actions/setup-chrome@latest
with:
chrome-version: 'stable'
id: setup-chrome
- run: which chrome
- uses: nanasess/setup-chromedriver@v2
with:
chromedriver-version: ${{ steps.setup-chrome.outputs.chrome-version }}
- run: which chromedriver

# Copy docs from dependent projects, run tutor on local courses folder and copy results into docs and static/assets
- name: Run rascal-tutor and reuse libraries
run: MAVEN_OPTIONS="-Xss256m -Xmx3G" mvn -B clean package -Dwebdriver.chrome.driver=/usr/local/bin/chromedriver -Dwebdriver.chrome.browser=`which chrome`

# Big speedup over uploading seperate files
- name: Tar files
run: tar --exclude='target' --exclude='.git' --exclude='.github' --exclude='.vscode' --exclude='META-INF' -cvf sources.tar .

- uses: actions/upload-artifact@v3
with:
name: sources
path: sources.tar
39 changes: 13 additions & 26 deletions .github/workflows/pr-builder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,37 +6,24 @@ on:
- website-v2

jobs:
prepare-website:
uses: ./.github/workflows/base-jobs.yml

website-pr:
name: Build the Rascal website
runs-on: ubuntu-latest
name: Sanity check the Rascal website
runs-on: buildjet-4vcpu-ubuntu-2204
needs: prepare-website
steps:
- name: Clone
uses: actions/checkout@v3

- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '11'
cache: 'maven'

- uses: actions/setup-node@v3
with:
node-version: 16.x
cache: yarn

- uses: browser-actions/setup-chrome@latest
with:
chrome-version: 1047731 # v107
- run: which chrome
- uses: nanasess/setup-chromedriver@v1
# Download prepared sources from base
- name: Download sources
uses: actions/download-artifact@v3
with:
chromedriver-version: '107.0.5304.62'
- run: which chromedriver
name: sources

# Copy docs from dependent projects, run tutor on local courses folder and copy results into docs and static/assets
- name: Run rascal-tutor and reuse libraries
run: MAVEN_OPTS="-Xss256m -Xmx3G" mvn -B clean package -Dwebdriver.chrome.driver=/usr/local/bin/chromedriver -Dwebdriver.chrome.browser=`which chrome`
- name: Untar files
run: tar -xvf sources.tar

# Do a dummy build to see if there are errors
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Build website
Expand Down
40 changes: 14 additions & 26 deletions .github/workflows/website-builder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,37 +6,24 @@ on:
- website-v2

jobs:
prepare-website:
uses: ./.github/workflows/base-jobs.yml

website:
name: Build the Rascal website
name: Deploy the Rascal website
runs-on: buildjet-4vcpu-ubuntu-2204
needs: prepare-website
steps:
- name: Clone
uses: actions/checkout@v3

- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '11'
cache: 'maven'

- uses: actions/setup-node@v3
# Download prepared sources from base
- name: Download sources
uses: actions/download-artifact@v3
with:
node-version: 16
cache: yarn

- uses: browser-actions/setup-chrome@latest
with:
chrome-version: 1047731 # v107
- run: which chrome
- uses: nanasess/setup-chromedriver@v1
with:
chromedriver-version: '107.0.5304.62'
- run: which chromedriver

# Copy docs from dependent projects, run tutor on local courses folder and copy results into docs and static/assets
- name: Run rascal-tutor and reuse libraries
run: MAVEN_OPTIONS="-Xss256m -Xmx3G" mvn -B clean package -Dwebdriver.chrome.driver=/usr/local/bin/chromedriver -Dwebdriver.chrome.browser=`which chrome`
name: sources

- name: Untar files
run: tar -xvf sources.tar

# Production deploy
- name: Netlify Deploy
uses: jsmrcaga/[email protected]
with:
Expand All @@ -46,6 +33,7 @@ jobs:
install_command: yarn install --frozen-lockfile
build_command: yarn build

# Production reindex
- name: Algolia crawler creation and crawl
uses: algolia/[email protected]
id: algolia_crawler
Expand Down