Various uncurried fixes #2160
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
name: CI | |
on: | |
push: | |
branches: [ master ] | |
tags: "*.*.*" | |
pull_request: | |
branches: [ master ] | |
jobs: | |
test: | |
strategy: | |
fail-fast: false | |
matrix: | |
# Stay on the oldest Ubuntu version that's still supported by Github Actions | |
# to avoid glibc incompatibilities as far as possible. | |
os: [macos-latest, macos-arm, ubuntu-20.04, windows-latest] | |
# syntax explanation: | |
# https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#example-including-additional-values-into-combinations | |
include: | |
- os: macos-latest | |
artifact-folder: darwin | |
- os: macos-arm | |
artifact-folder: darwinarm64 | |
- os: ubuntu-20.04 | |
artifact-folder: linux | |
- os: windows-latest | |
artifact-folder: win32 | |
runs-on: ${{matrix.os}} | |
steps: | |
# needed for Windows testing | |
- name: Set git to use LF | |
run: | | |
git config --global core.autocrlf false | |
git config --global core.eol lf | |
- uses: actions/checkout@v3 | |
- name: Cache OCaml's opam | |
uses: actions/cache@v3 | |
with: | |
path: ~/.opam | |
key: ${{matrix.os}}-rescript-vscode-v4 | |
- name: Use OCaml | |
uses: ocaml/setup-ocaml@v2 | |
with: | |
ocaml-compiler: 4.14.x | |
- name: Use Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 16 | |
- run: npm ci | |
- run: opam install dune cppo | |
- run: npm run compile | |
# These 2 runs (or just the second?) are for when you have opam dependencies. We don't. | |
# Don't add deps. But if you ever do, un-comment these and add an .opam file. | |
# - run: opam pin add rescript-editor-analysis.dev . --no-action | |
# - run: opam install . --deps-only --with-doc --with-test | |
- name: Build and test | |
run: opam exec -- make test | |
working-directory: analysis | |
# Also avoids artifacts upload permission loss: | |
# https://github.com/actions/upload-artifact/tree/ee69f02b3dfdecd58bb31b4d133da38ba6fe3700#permission-loss | |
- name: Compress files | |
run: | | |
cd analysis | |
mkdir ${{matrix.artifact-folder}} | |
mv rescript-editor-analysis.exe ${{matrix.artifact-folder}} | |
tar -cvf binary.tar ${{matrix.artifact-folder}} | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: ${{matrix.os}} | |
path: analysis/binary.tar | |
package: | |
needs: test | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Use Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 16 | |
- run: npm ci | |
- run: npm run compile | |
- name: Download MacOS binary | |
uses: actions/download-artifact@v3 | |
with: | |
name: macos-latest | |
path: ./server/analysis_binaries | |
- run: tar -xvf binary.tar | |
working-directory: ./server/analysis_binaries | |
- name: Download MacOS ARM binary | |
uses: actions/download-artifact@v3 | |
with: | |
name: macos-arm | |
path: ./server/analysis_binaries | |
- run: tar -xvf binary.tar | |
working-directory: ./server/analysis_binaries | |
- name: Download Linux binary | |
uses: actions/download-artifact@v3 | |
with: | |
name: ubuntu-20.04 | |
path: ./server/analysis_binaries | |
- run: tar -xvf binary.tar | |
working-directory: ./server/analysis_binaries | |
- name: Download Windows binary | |
uses: actions/download-artifact@v3 | |
with: | |
name: windows-latest | |
path: ./server/analysis_binaries | |
- run: tar -xvf binary.tar | |
working-directory: ./server/analysis_binaries | |
- name: Cleanup tar file | |
run: rm binary.tar | |
working-directory: ./server/analysis_binaries | |
- name: Store short commit SHA for filename | |
id: vars | |
env: | |
COMMIT_SHA: ${{ github.event.pull_request.head.sha || github.sha }} | |
run: echo "::set-output name=sha_short::${COMMIT_SHA:0:7}" | |
- name: Store tag name | |
id: tag_name | |
if: startsWith(github.ref, 'refs/tags/') | |
run: echo ::set-output name=tag::${GITHUB_REF#refs/*/} | |
- name: Increment pre-release version | |
if: github.ref == 'refs/heads/master' | |
id: increment_pre_release | |
run: | | |
JSON=$(npx vsce show chenglou92.rescript-vscode --json) | |
NEW_VERSION=$(echo $JSON | jq -r '.versions | .[0] | .["version"]') | |
node .github/workflows/bump-version.js ${NEW_VERSION} | |
- name: Package Extension | |
if: github.ref != 'refs/heads/master' | |
run: npx vsce package -o rescript-vscode-${{ steps.vars.outputs.sha_short }}.vsix | |
- name: Package Extension pre-release version | |
if: github.ref == 'refs/heads/master' | |
run: npx vsce package -o rescript-vscode-latest-master.vsix ${{ steps.increment_pre_release.outputs.new_version }} --no-git-tag-version | |
- name: Package Extension release version | |
if: startsWith(github.ref, 'refs/tags/') | |
run: npx vsce package -o rescript-vscode-${{ steps.tag_name.outputs.tag }}.vsix ${{ steps.tag_name.outputs.tag }} --no-git-tag-version | |
- uses: actions/upload-artifact@v3 | |
if: github.ref != 'refs/heads/master' | |
with: | |
name: rescript-vscode-${{ steps.vars.outputs.sha_short }}.vsix | |
path: rescript-vscode-${{ steps.vars.outputs.sha_short }}.vsix | |
- uses: actions/upload-artifact@v3 | |
if: github.ref == 'refs/heads/master' | |
with: | |
name: rescript-vscode-latest-master.vsix | |
path: rescript-vscode-latest-master.vsix | |
- uses: actions/upload-artifact@v3 | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
name: rescript-vscode-${{ steps.tag_name.outputs.tag }}.vsix | |
path: rescript-vscode-${{ steps.tag_name.outputs.tag }}.vsix | |
- name: Publish latest master to GitHub | |
if: github.ref == 'refs/heads/master' | |
uses: marvinpinto/action-automatic-releases@latest | |
with: | |
repo_token: "${{ secrets.GITHUB_TOKEN }}" | |
automatic_release_tag: "latest-master" | |
prerelease: true | |
title: "Latest master" | |
files: rescript-vscode-latest-master.vsix | |
- name: Publish release version to GitHub | |
if: startsWith(github.ref, 'refs/tags/') | |
uses: marvinpinto/action-automatic-releases@latest | |
with: | |
repo_token: "${{ secrets.GITHUB_TOKEN }}" | |
prerelease: false | |
title: ${{ steps.tag_name.outputs.tag }} | |
files: rescript-vscode-${{ steps.tag_name.outputs.tag }}.vsix | |
- name: Publish extension as pre-release | |
if: github.ref == 'refs/heads/master' | |
run: npx vsce publish --pat ${{ secrets.MARKETPLACE_TOKEN }} --pre-release ${{ steps.increment_pre_release.outputs.new_version }} --no-git-tag-version | |
- name: Publish extension as release | |
if: startsWith(github.ref, 'refs/tags/') | |
run: npx vsce publish --pat ${{ secrets.MARKETPLACE_TOKEN }} ${{ steps.tag_name.outputs.tag }} --no-git-tag-version |