Skip to content

Test armv7 #6

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

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
263 changes: 17 additions & 246 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,256 +16,27 @@ env:
DUNE_PROFILE: release

jobs:
# Build statically linked Linux binaries in an Alpine-based Docker container
# See https://ocamlpro.com/blog/2021_09_02_generating_static_and_portable_executables_with_ocaml
# for more info.
# The container already comes with all required tools pre-installed
# (see https://github.com/rescript-lang/docker-rescript-ci-build/blob/main/Dockerfile).
static-binaries-linux:
armv7-linux:
runs-on: ubuntu-latest

container:
image: ghcr.io/rescript-lang/rescript-ci-build

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Apply static linking patch
run: git apply scripts/dune-static-linking.patch

- name: Build compiler binaries
run: opam exec -- dune build

- name: Build ninja binary
working-directory: ninja
env:
LDFLAGS: -static
run: python3 configure.py --bootstrap --verbose

- name: "Upload artifacts"
uses: actions/upload-artifact@v3
with:
name: static-binaries-linux
path: |
_build/install/default/bin
ninja/ninja

build:
needs: static-binaries-linux

strategy:
fail-fast: false
matrix:
os: [macos-latest, ubuntu-latest, windows-latest, macos-arm]
ocaml_compiler: [4.14.0]

runs-on: ${{matrix.os}}

env:
OCAMLRUNPARAM: b
DUNE_PROFILE: release

steps:
- name: "Windows: Set git to use LF"
if: runner.os == 'Windows'
run: |
git config --global core.autocrlf false
git config --global core.eol lf

- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 2 # to be able to check for changes in subfolder res_syntax later

- name: Download static linux binaries
if: runner.os == 'Linux'
uses: actions/download-artifact@v3
with:
name: static-binaries-linux

- name: Make static linux binaries executable
if: runner.os == 'Linux'
run: |
chmod +x ninja/ninja
chmod +x _build/install/default/bin/*

- name: Use OCaml ${{matrix.ocaml_compiler}}
uses: ocaml/setup-ocaml@v2
with:
ocaml-compiler: ${{matrix.ocaml_compiler}}
opam-pin: false
opam-depext: false

- name: "Install OPAM dependencies"
run: opam install . --deps-only

- name: "Build compiler"
if: runner.os != 'Linux'
run: opam exec -- dune build

- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: 16

- name: Install npm packages
run: npm ci --ignore-scripts

- name: "Windows: Use MSVC for ninja build"
if: runner.os == 'Windows'
uses: TheMrMilchmann/setup-msvc-dev@v2
with:
arch: x64

- name: Build ninja
if: runner.os != 'Linux'
run: node scripts/buildNinjaBinary.js

- name: Copy exes to platform bin dirs
run: node ./scripts/copyExes.js

- name: "Check if syntax subfolder has changed"
id: syntax-diff
shell: bash
run: |
if git diff --name-only --exit-code HEAD^ HEAD -- res_syntax; then
echo "syntax_status=unchanged" >> $GITHUB_ENV
else
echo "syntax_status=changed" >> $GITHUB_ENV
fi

- name: "Syntax: Run roundtrip tests"
if: ${{ env.syntax_status == 'changed' && runner.os != 'Windows' }}
run: make test-syntax-roundtrip

- name: "Syntax: Run tests (Windows)"
if: ${{ env.syntax_status == 'changed' && runner.os == 'Windows' }}
run: make test-syntax

- name: Build runtime/stdlib
if: runner.os != 'Windows'
run: |
opam exec -- node ./scripts/ninja.js config
opam exec -- node ./scripts/ninja.js build

- name: Check for changes in lib folder
run: git diff --exit-code lib/js lib/es6

- name: Run tests
if: runner.os != 'Windows'
run: node scripts/ciTest.js -all

- name: Run tests (Windows)
if: runner.os == 'Windows'
run: node scripts/ciTest.js -mocha -theme -format

- name: Prepare artifact upload
- uses: uraimo/run-on-arch-action@v2
name: Run commands
id: runcmd
with:
arch: armv7
distro: alpine_latest
githubToken: ${{ github.token }}
run: |
apk update
apk add gcc libc-dev musl-dev make opam
opam init -y --compiler=4.14.0
echo ::set-output name=uname::$(uname -a)

- name: Get the output
# Echo the `uname` output parameter from the `runcmd` step
run: |
./scripts/prebuilt.js
node .github/workflows/get_artifact_info.js

- name: "Upload artifacts: binaries"
uses: actions/upload-artifact@v3
with:
name: ${{ env.artifact_name }}
path: ${{ env.artifact_path }}

- name: "Upload artifacts: lib/ocaml"
if: runner.os == 'Linux'
uses: actions/upload-artifact@v3
with:
name: lib-ocaml
path: lib/ocaml

- name: "Upload artifacts: cmi cache"
if: runner.os == 'Linux'
uses: actions/upload-artifact@v3
with:
name: cmij-cache
path: |
lib/cmi_cache.bin
lib/cmj_cache.bin

package:
needs: build
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: true

- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: 16

- name: NPM install
run: npm ci --ignore-scripts

- name: Download artifacts
uses: actions/download-artifact@v3

- name: Move artifacts
run: ./scripts/moveArtifacts.sh

- name: Check artifact list
run: node ./scripts/makeArtifactList.js -check

- name: npm pack (rescript)
run: npm pack

- name: Copy JS files to stdlib package
run: mkdir -p packages/std/lib && cp -R lib/es6 lib/js packages/std/lib

- name: npm pack (@rescript/std)
run: npm pack
working-directory: packages/std

- name: Get package info
# For pull requests, pass the correct commit SHA explicitly as GITHUB_SHA points to the wrong commit.
run: node .github/workflows/get_package_info.js ${{ github.event.pull_request.head.sha }}

- name: "Upload artifact: npm packages"
uses: actions/upload-artifact@v3
with:
name: npm-packages
path: |
${{ env.rescript_package }}
${{ env.stdlib_package }}

installationTest:
needs: package
strategy:
fail-fast: false
matrix:
os: [macos-latest, ubuntu-latest, windows-latest, macos-arm]

runs-on: ${{matrix.os}}

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: 16

- name: Download artifacts
uses: actions/download-artifact@v3
with:
name: npm-packages
path: packages/test

- name: Install ReScript package
run: npm i rescript-11*.tgz
shell: bash
working-directory: packages/test

- name: Test installation
run: npx rescript -h && npx rescript build && cat src/Test.bs.js
shell: bash
working-directory: packages/test
echo "The uname output was ${{ steps.runcmd.outputs.uname }}"