diff --git a/.github/workflows/base-jobs.yml b/.github/workflows/base-jobs.yml new file mode 100644 index 000000000..9185b7b32 --- /dev/null +++ b/.github/workflows/base-jobs.yml @@ -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 \ No newline at end of file diff --git a/.github/workflows/pr-builder.yml b/.github/workflows/pr-builder.yml index 2a1adae10..708e57d27 100644 --- a/.github/workflows/pr-builder.yml +++ b/.github/workflows/pr-builder.yml @@ -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 diff --git a/.github/workflows/website-builder.yml b/.github/workflows/website-builder.yml index 4ed6b941a..3d2a33063 100644 --- a/.github/workflows/website-builder.yml +++ b/.github/workflows/website-builder.yml @@ -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/action-netlify-deploy@v2.0.0 with: @@ -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/algoliasearch-crawler-github-actions@v1.1.10 id: algolia_crawler