Update README #62
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: Push Build | |
on: push | |
jobs: | |
build_and_test: | |
name: ${{matrix.config.name}} | |
runs-on: ${{matrix.config.os}} | |
strategy: | |
matrix: | |
config: | |
- { | |
name: "Linux Build & Test", | |
os: ubuntu-latest | |
} | |
- { | |
name: "Microsoft Windows Build & Test", | |
os: windows-latest | |
} | |
- { | |
name: "MacOs Build & Test", | |
os: macos-latest | |
} | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Install Cargo make | |
run: | | |
cargo install cargo-make | |
- name: Download files Linux | |
if: matrix.config.os == 'ubuntu-latest' | |
run: | | |
wget "https://github.com/neovim/neovim/releases/latest/download/nvim-linux64.tar.gz" | |
tar -xzf nvim-linux64.tar.gz | |
wget "https://ziglang.org/download/0.11.0/zig-linux-x86_64-0.11.0.tar.xz" | |
tar -xf zig-linux-x86_64-0.11.0.tar.xz | |
- name: Download files MacOs | |
if: matrix.config.os == 'macos-latest' | |
run: | | |
wget "https://github.com/neovim/neovim/releases/download/v0.9.1/nvim-macos.tar.gz" | |
tar -xzf nvim-macos.tar.gz | |
wget "https://ziglang.org/download/0.11.0/zig-macos-x86_64-0.11.0.tar.xz" | |
tar -xf zig-macos-x86_64-0.11.0.tar.xz | |
- name: Download files Windows | |
if: matrix.config.os == 'windows-latest' | |
run: | | |
Invoke-WebRequest "https://github.com/neovim/neovim/releases/download/stable/nvim-win64.zip" -OutFile .\nvim-win64.zip | |
Expand-Archive nvim-win64.zip | |
Invoke-WebRequest "https://ziglang.org/download/0.11.0/zig-windows-x86_64-0.11.0.zip" -OutFile .\zig-windows-x86_64-0.11.0.zip | |
Expand-Archive zig-windows-x86_64-0.11.0.zip | |
- name: Test For Linux | |
if: matrix.config.os == 'ubuntu-latest' | |
run: | | |
export PATH=$PWD/nvim-linux64/bin/:$PATH | |
export PATH=$PWD/zig-linux-x86_64-0.11.0/:$PATH | |
cargo make zig_test | |
nvim -l ./default_cfg/testing_linux.lua | |
rm ./lua/wasm_nvim.so | |
cargo make test | |
- name: Test For MacOs | |
if: matrix.config.os == 'macos-latest' | |
run: | | |
export PATH=$PWD/nvim-macos/bin/:$PATH | |
export PATH=$PWD/zig-macos-x86_64-0.11.0/:$PATH | |
cargo make zig_test | |
nvim -l ./default_cfg/testing_macos.lua | |
rm ./lua/wasm_nvim.so | |
cargo make test | |
- name: Test For Windows | |
if: matrix.config.os == 'windows-latest' | |
shell: pwsh | |
run: | | |
$env:CD = Get-Location | |
$env:PATH=$env:CD+'/nvim-win64/bin/;'+$env:PATH | |
$env:PATH=$env:CD+'/zig-windows-x86_64-0.11.0/zig-windows-x86_64-0.11.0/;'+$env:PATH | |
cargo make ci_zig_test | |
./nvim-win64/nvim-win64/bin/nvim -l ./default_cfg/testing_macos.lua | |
cargo make ci_test | |
- name: Zip file Unix | |
if: matrix.config.os != 'windows-latest' | |
run: | | |
cd ./lua | |
zip -r ./wasm_nvim_${{matrix.config.os}}.zip ./wasm_nvim.so | |
cp ./wasm_nvim_${{matrix.config.os}}.zip ../ | |
- name: Zip file Windows | |
if: matrix.config.os == 'windows-latest' | |
run: | | |
cd ./lua | |
tar -cf ./wasm_nvim_${{matrix.config.os}}.zip ./wasm_nvim.dll | |
copy wasm_nvim_${{matrix.config.os}}.zip ..\ | |
- uses: "actions/upload-artifact@v2" | |
id: upload_artifact | |
with: | |
path: ./wasm_nvim_${{matrix.config.os}}.zip | |
name: wasm_nvim_${{matrix.config.os}}.zip | |
release: | |
if: contains(github.ref, 'tags/v') | |
needs: build_and_test | |
runs-on: ubuntu-latest | |
steps: | |
- name: Create Release | |
id: create_release | |
uses: actions/[email protected] | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ github.ref }} | |
release_name: Release ${{ github.ref }} | |
draft: false | |
prerelease: false | |
- name: Store Release url | |
run: | | |
echo "${{ steps.create_release.outputs.upload_url }}" > ./upload_url | |
- uses: actions/upload-artifact@v1 | |
with: | |
path: ./upload_url | |
name: upload_url | |
publish: | |
needs: release | |
if: contains(github.ref, 'tags/v') | |
name: ${{ matrix.config.name }} | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
config: | |
- { | |
name: "Linux Release", | |
os: ubuntu-latest | |
} | |
- { | |
name: "Microsoft Windows Release", | |
os: windows-latest | |
} | |
- { | |
name: "MacOs Release", | |
os: macos-latest | |
} | |
steps: | |
- name: Download artifact | |
uses: actions/download-artifact@v1 | |
with: | |
name: wasm_nvim_${{matrix.config.os}}.zip | |
path: ./ | |
- name: Download URL | |
uses: actions/download-artifact@v1 | |
with: | |
name: upload_url | |
path: ./ | |
- name: Set Upload URL | |
id: set_upload_url | |
run: | | |
upload_url=`cat ./upload_url` | |
echo ::set-output name=upload_url::$upload_url | |
- name: Upload to Release | |
id: upload_to_release | |
uses: actions/[email protected] | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.set_upload_url.outputs.upload_url }} | |
asset_path: ./wasm_nvim_${{matrix.config.os}}.zip | |
asset_name: wasm_nvim_${{matrix.config.os}}.zip | |
asset_content_type: application/zip |