|
7 | 7 | branches: [master] |
8 | 8 |
|
9 | 9 | jobs: |
10 | | - test: |
| 10 | + build: |
11 | 11 | strategy: |
12 | 12 | fail-fast: false |
13 | 13 | matrix: |
|
48 | 48 | opam-depext: false |
49 | 49 |
|
50 | 50 | - name: Use Node.js |
51 | | - uses: actions/setup-node@v2.1.5 |
| 51 | + uses: actions/setup-node@v3 |
52 | 52 | with: |
53 | 53 | node-version: 16 |
54 | 54 |
|
|
57 | 57 | env: |
58 | 58 | RESCRIPT_FORCE_REBUILD: 1 |
59 | 59 |
|
60 | | - - name: ninja config |
61 | | - if: runner.os != 'Windows' |
62 | | - run: opam exec -- node ./scripts/ninja.js config |
63 | | - |
64 | | - - name: ninja build |
65 | | - if: runner.os != 'Windows' |
66 | | - run: opam exec -- node ./scripts/ninja.js build |
67 | | - |
68 | | - - name: Check for changes in lib folder |
69 | | - run: git diff --exit-code lib/js lib/es6 |
70 | | - |
71 | 60 | - name: Run tests |
72 | 61 | if: runner.os != 'Windows' |
73 | 62 | run: opam exec -- node scripts/ciTest.js -all |
|
80 | 69 | id: get_artifact_info |
81 | 70 | run: node .github/workflows/get_artifact_info.js |
82 | 71 |
|
83 | | - - name: Upload artifacts |
| 72 | + - name: "Upload artifacts: binaries" |
84 | 73 | uses: actions/upload-artifact@v3 |
85 | 74 | with: |
86 | 75 | name: ${{ steps.get_artifact_info.outputs.artifact_name }} |
87 | 76 | path: ${{ steps.get_artifact_info.outputs.artifact_path }} |
| 77 | + |
| 78 | + - name: "Upload artifacts: lib/ocaml" |
| 79 | + if: runner.os == 'Linux' |
| 80 | + uses: actions/upload-artifact@v3 |
| 81 | + with: |
| 82 | + name: lib-ocaml |
| 83 | + path: lib/ocaml |
| 84 | + |
| 85 | + # Important: the ninja build must run after the artifact upload because for some reason |
| 86 | + # the bsc.exe created by the ninja build does not find the Pervasives module. |
| 87 | + # So this is run here just to test the normal dev workflow, too. |
| 88 | + - name: ninja config |
| 89 | + if: runner.os != 'Windows' |
| 90 | + run: opam exec -- node ./scripts/ninja.js config |
| 91 | + |
| 92 | + - name: ninja build |
| 93 | + if: runner.os != 'Windows' |
| 94 | + run: opam exec -- node ./scripts/ninja.js build |
| 95 | + |
| 96 | + - name: Check for changes in lib folder |
| 97 | + run: git diff --exit-code lib/js lib/es6 |
| 98 | + |
| 99 | + package: |
| 100 | + needs: build |
| 101 | + runs-on: ubuntu-latest |
| 102 | + |
| 103 | + steps: |
| 104 | + - name: Checkout |
| 105 | + uses: actions/checkout@v3 |
| 106 | + with: |
| 107 | + submodules: true |
| 108 | + |
| 109 | + - name: Use Node.js |
| 110 | + uses: actions/setup-node@v3 |
| 111 | + with: |
| 112 | + node-version: 16 |
| 113 | + |
| 114 | + - name: NPM install |
| 115 | + run: npm ci --ignore-scripts |
| 116 | + |
| 117 | + - name: Download artifacts |
| 118 | + uses: actions/download-artifact@v3 |
| 119 | + |
| 120 | + - name: Copy artifacts |
| 121 | + run: ./scripts/moveArtifacts.sh |
| 122 | + |
| 123 | + - name: Create ninja.tar.gz |
| 124 | + run: git -C ninja archive --format=tar.gz HEAD -o ../vendor/ninja.tar.gz |
| 125 | + |
| 126 | + - name: Run prepublish.js |
| 127 | + run: node ./scripts/prepublish.js -nocheck |
| 128 | + |
| 129 | + - name: npm pack |
| 130 | + run: npm pack |
| 131 | + |
| 132 | + - name: Get package info |
| 133 | + id: get_package_info |
| 134 | + # For pull requests, pass the correct commit SHA explicitly as GITHUB_SHA points to the wrong commit. |
| 135 | + run: node .github/workflows/get_package_info.js ${{ github.event.pull_request.head.sha }} |
| 136 | + |
| 137 | + - name: "Upload artifact: npm package tarball" |
| 138 | + uses: actions/upload-artifact@v3 |
| 139 | + with: |
| 140 | + name: ${{ steps.get_package_info.outputs.artifact_name }} |
| 141 | + path: ${{ steps.get_package_info.outputs.artifact_path }} |
0 commit comments