Bump actions/upload-artifact from 3 to 4 #1153
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This workflow will do a clean install of node dependencies, cache/restore them, build the source code and run tests across different versions of node | |
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions | |
name: Node.js CI | |
on: | |
push: | |
branches: [ master ] | |
tags: '*' | |
pull_request: | |
branches: [ master ] | |
release: | |
types: [ published ] | |
# see https://github.community/t/treating-warnings-as-errors-because-process-env-ci-true/18032 | |
env: | |
CI: false | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
needs: [webasm_package] | |
strategy: | |
matrix: | |
node-version: [16.x, 18.x] | |
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/ | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
cache: 'npm' | |
- uses: actions/download-artifact@v3 | |
with: | |
name: wasm files | |
path: src | |
- name: Display structure of downloaded files | |
run: ls -R | |
working-directory: src | |
- uses: actions/download-artifact@v3 | |
with: | |
name: wasm files | |
path: src/static/js | |
- name: Display structure of downloaded files | |
run: ls -R | |
working-directory: src/static/js | |
- run: npm ci | |
- run: npm run build --if-present | |
# - run: npm test | |
webasm_package: | |
runs-on: ubuntu-latest | |
# needs: [build] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Test submodule checkout | |
run: | | |
ls -al | |
ls -al library | |
- uses: mymindstorm/setup-emsdk@v12 | |
- name: Cache compiled GSL | |
uses: actions/cache@v3 | |
env: | |
cache-name: cache-node-modules | |
with: | |
path: $HOME/usr | |
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/main.yml') }} | |
restore-keys: | | |
${{ runner.os }}-build-${{ env.cache-name }}- | |
${{ runner.os }}-build- | |
${{ runner.os }}- | |
- name: Compile GSL | |
run: | | |
wget -q "http://ftpmirror.gnu.org/gnu/gsl/gsl-latest.tar.gz" | |
mkdir $HOME/gsl-latest | |
tar -xzf gsl-latest.tar.gz -C $HOME/gsl-latest | |
mv $HOME/gsl-latest/** $HOME/gsl-latest/gsl | |
mkdir $HOME/usr | |
cd $HOME/gsl-latest/gsl/ && emconfigure ./configure --prefix=$HOME/usr --disable-shared && emmake make -j2 && emmake make install | |
ls -al $HOME/usr/lib/ | |
- name: Compile libamtrack webassembly package | |
run: | | |
cp $HOME/usr/lib/libgsl.a library/distributions/JavaScript/ | |
cp $HOME/usr/lib/libgslcblas.a library/distributions/JavaScript/ | |
cd library/distributions/JavaScript && GSL_INCLUDE_DIRS=$HOME/usr/include GSL_LIBRARY=$HOME/usr/lib/libgsl.a GSL_CBLAS_LIBRARY=$HOME/usr/lib/libgslcblas.a ./compile_to_js.sh | |
- name: 'Upload Artifact' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: wasm files | |
path: | | |
library/distributions/JavaScript/output/libat.wasm | |
library/distributions/JavaScript/output/libat.js | |
if-no-files-found: error | |
retention-days: 5 | |
test_and_deploy: | |
runs-on: ubuntu-latest | |
needs: [build] | |
steps: | |
- name: Checkout 🛎️ | |
uses: actions/checkout@v4 | |
- name: Use Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '18' | |
- name: Install 🔧 | |
run: npm install | |
- uses: actions/download-artifact@v3 | |
with: | |
name: wasm files | |
path: src | |
- name: Display structure of downloaded files | |
run: ls -R | |
working-directory: src | |
- uses: actions/download-artifact@v3 | |
with: | |
name: wasm files | |
path: src/static/js | |
- name: Display structure of downloaded files | |
run: ls -R | |
working-directory: src/static/js | |
- name: Adjust build info | |
run: | | |
sed -i '6s/web/web_dev/' package.json | |
TZ=Europe/Warsaw | |
current_date_time="`date`" | |
sed -i 's/NO_DEPLOY_DATE/'"$current_date_time"'/' ./src/static/json/GlobalConfig.json | |
sed -i 's~NO_DEPLOY_BRANCH~'"${{ github.ref }}"'~' ./src/static/json/GlobalConfig.json | |
sed -i 's/NO_DEPLOY_COMMIT/'"${{ github.sha }}"'/' ./src/static/json/GlobalConfig.json | |
- name: webfactory/ssh-agent | |
if: github.ref == 'refs/heads/master' | |
uses: webfactory/ssh-agent@v0.8.0 | |
with: | |
# Private SSH key to register in the SSH agent | |
ssh-private-key: ${{ secrets.WEBDEV }} | |
- name: Deploy to development server | |
if: github.ref == 'refs/heads/master' | |
run: | | |
git remote set-url origin git@github.com:libamtrack/web_dev.git | |
npm run deploy -- -u "github-actions-bot <support+actions@github.com>" -r "git@github.com:libamtrack/web_dev.git" | |
- name: Prepare production version to deploy | |
run: | | |
npm run build | |
- name: Deploy to production server 🚀 | |
uses: peaceiris/actions-gh-pages@v3 | |
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v') | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./dist |