diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index eeb7d29c..5139cf7a 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -12,28 +12,28 @@ jobs: build: name: Build webR runs-on: ubuntu-latest - container: ghcr.io/r-wasm/webr-flang:main + container: ghcr.io/r-wasm/flang-wasm:main steps: + - uses: actions/checkout@v3 - uses: actions/setup-node@v3 with: node-version: 'lts/*' registry-url: 'https://registry.npmjs.org' - - uses: actions/checkout@v3 + - name: Set npm dist-tag to "next" if pre-release version + if: contains(github.ref_name, '-dev') || contains(github.ref_name, '-rc') + run: echo "DIST_TAG=next" >> $GITHUB_ENV - name: Install required system packages run: apt-get update && apt-get install -y gh jq sudo - uses: r-lib/actions/setup-r@v2 with: use-public-rspm: true - uses: quarto-dev/quarto-actions/setup@v2 - - name: Install required R packages + - name: Install required R packages for building documentation run: Rscript -e 'install.packages(c("rmarkdown", "rvest"))' - name: Configure webR for flang + env: + EMFC: /opt/flang/host/bin/flang-new run: ./configure - - name: Copy flang into webR tree - run: | - cp -r /opt/flang/wasm . - cp -r /opt/flang/host . - cp /opt/flang/emfc ./host/bin/emfc - name: Setup Emscripten PATH run: echo "/opt/emsdk:/opt/emsdk/upstream/emscripten" >> $GITHUB_PATH - name: Set Emscripten EM_NODE_JS @@ -44,7 +44,7 @@ jobs: - name: Build all optional wasm libs env: EMSDK: /opt/emsdk - run: cd libs && make all + run: cd libs && make all -j - name: Build webR env: EMSDK: /opt/emsdk @@ -53,6 +53,11 @@ jobs: - name: Build webR documentation run: cd src/docs && make shell: bash + - name: Publish to npm + if: "!contains(github.ref_name, 'main')" + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + run: cd src && make publish - name: Report code coverage uses: codecov/codecov-action@v3 with: diff --git a/.github/workflows/npm.yml b/.github/workflows/npm.yml deleted file mode 100644 index 862205ff..00000000 --- a/.github/workflows/npm.yml +++ /dev/null @@ -1,45 +0,0 @@ -name: Publish npm package -on: - push: - tags: - - "v*.*" - workflow_dispatch: -jobs: - build: - runs-on: ubuntu-latest - environment: deploy - container: ghcr.io/r-wasm/webr-flang:main - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 - with: - node-version: 'lts/*' - registry-url: 'https://registry.npmjs.org' - - name: Set npm dist-tag to "next" if pre-release version - if: contains(github.ref_name, '-dev') || contains(github.ref_name, '-rc') - run: echo "DIST_TAG=next" >> $GITHUB_ENV - - name: Set the webR CDN URL as the BASE_URL - run: echo "BASE_URL=https://webr.r-wasm.org/${{ github.ref_name }}/" > "$HOME/.webr-config.mk" - - name: Configure webR for flang - run: ./configure - - name: Copy flang into webR tree - run: | - cp -r /opt/flang/wasm . - cp -r /opt/flang/host . - cp /opt/flang/emfc ./host/bin/emfc - - name: Setup Emscripten PATH - run: echo "/opt/emsdk:/opt/emsdk/upstream/emscripten" >> $GITHUB_PATH - - name: Set Emscripten EM_NODE_JS - run: echo "EM_NODE_JS=$(which node)" >> $GITHUB_ENV - - name: Build all optional wasm libs - env: - EMSDK: /opt/emsdk - run: cd libs && make all - - name: Build webR - env: - EMSDK: /opt/emsdk - run: make - shell: bash - - run: cd src && make publish - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 25114fa2..37245ef6 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -7,9 +7,9 @@ on: workflow_dispatch: jobs: - build: + build-docker: runs-on: ubuntu-latest - container: ghcr.io/r-wasm/webr-flang:main + container: ghcr.io/r-wasm/flang-wasm:main steps: - uses: actions/setup-node@v3 with: @@ -17,12 +17,9 @@ jobs: registry-url: 'https://registry.npmjs.org' - uses: actions/checkout@v3 - name: Configure webR for flang + env: + EMFC: /opt/flang/host/bin/flang-new run: ./configure - - name: Copy flang into webR tree - run: | - cp -r /opt/flang/wasm . - cp -r /opt/flang/host . - cp /opt/flang/emfc ./host/bin/emfc - name: Setup Emscripten PATH run: echo "/opt/emsdk:/opt/emsdk/upstream/emscripten" >> $GITHUB_PATH - name: Set Emscripten EM_NODE_JS @@ -41,3 +38,11 @@ jobs: fail_ci_if_error: true verbose: true token: ${{ secrets.CC_TOKEN }} + build-nix: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: DeterminateSystems/nix-installer-action@main + - uses: DeterminateSystems/magic-nix-cache-action@main + - name: Build Nix package + run: nix build --print-build-logs