fix: 2 async bugs #488
This file contains hidden or 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: release | |
| on: | |
| push: | |
| branches: | |
| - master | |
| - release/* | |
| paths: | |
| - '**.rs' | |
| - '**/Cargo.*' | |
| - '.github/workflows/release.yml' | |
| - '**.pi' | |
| - '**/Kagari.*' | |
| - 'codecov.yml' | |
| - 'plc.scoop' | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| artifacts: | |
| name: Artifacts | |
| runs-on: ${{ matrix.config.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| config: | |
| - os: "macos-14" | |
| dir: osx64 | |
| arch: darwin-arm64 | |
| artifacts: "plc" | |
| RUSTFLAGS: "-C link-args=-Wl,-ld_classic" | |
| libvm: "libvm.a" | |
| libvm_dylib: "libvm.dylib" | |
| libuv_dylib: "libuv.dylib" | |
| - os: "ubuntu-latest" | |
| dir: linux64 | |
| debdir: pivot-lang_0.1.0-1_amd64 | |
| artifacts: "plc" | |
| arch: linux-amd64 | |
| RUSTFLAGS: "" | |
| libvm: "libvm.a" | |
| libvm_dylib: "libvm.so" | |
| libuv_dylib: "libuv.so" | |
| - os: "windows-latest" | |
| dir: win64 | |
| artifacts: "plc.exe" | |
| RUSTFLAGS: "-Dwarnings -Ctarget-feature=+crt-static" | |
| libvm: "vm.lib" | |
| libvm_dylib: "vm.dll" | |
| libuv_dylib: "uv.dll" | |
| arch: windows-amd64 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: true | |
| - name: Install Rust (stable) | |
| uses: dsherret/rust-toolchain-file@v1 | |
| - uses: actions/cache@v3 | |
| name: Cache Cargo | |
| if: ${{ matrix.config.os != 'self-hosted' && matrix.config.os != 'windows-latest' }} | |
| with: | |
| path: | | |
| ~/.cargo/bin/ | |
| ~/.cargo/registry/index/ | |
| ~/.cargo/registry/cache/ | |
| ~/.cargo/git/db/ | |
| target/ | |
| key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
| - name: Install LLVM | |
| uses: Pivot-Studio/setup-llvm@main | |
| - uses: ilammy/msvc-dev-cmd@v1 | |
| if: ${{ matrix.config.os == 'windows-latest' }} | |
| - name: Cargo build vm | |
| env: | |
| RUSTFLAGS: ${{ matrix.config.RUSTFLAGS }} | |
| run: cd vm && cargo build --release | |
| - name: Cargo build | |
| env: | |
| RUSTFLAGS: ${{ matrix.config.RUSTFLAGS }} | |
| run: | | |
| cargo build --release | |
| - if: ${{ matrix.config.os == 'macos-14' }} | |
| name: rpath trick | |
| env: | |
| RUSTFLAGS: ${{ matrix.config.RUSTFLAGS }} | |
| run: | | |
| install_name_tool -change @rpath/libc++.1.dylib /usr/lib/libc++.1.dylib ./target/release/plc | |
| - run: mkdir -p ${{ matrix.config.dir }} | |
| - name: Move artifacts | |
| env: | |
| ARTIFACTS: ${{ matrix.config.artifacts }} | |
| OUT_DIR: ${{ matrix.config.dir }} | |
| OS: ${{ matrix.config.os }} | |
| run: | | |
| import os | |
| import shutil | |
| artifacts = os.environ['ARTIFACTS'].split() | |
| for artifact in artifacts: | |
| src = "target/release/%s" % artifact | |
| dst = os.environ['OUT_DIR'] + "/" + artifact | |
| shutil.copy(src, dst) | |
| shell: python | |
| - name: Move libvm | |
| env: | |
| ARTIFACTS: ${{ matrix.config.libvm }} | |
| OUT_DIR: ${{ matrix.config.dir }} | |
| OS: ${{ matrix.config.os }} | |
| run: | | |
| import os | |
| import shutil | |
| artifacts = os.environ['ARTIFACTS'].split() | |
| for artifact in artifacts: | |
| src = "target/release/%s" % artifact | |
| dst = os.environ['OUT_DIR'] + "/" + artifact | |
| shutil.copy(src, dst) | |
| shell: python | |
| - name: Move libvm dylib | |
| env: | |
| ARTIFACTS: ${{ matrix.config.libvm_dylib }} | |
| OUT_DIR: ${{ matrix.config.dir }} | |
| OS: ${{ matrix.config.os }} | |
| run: | | |
| import os | |
| import shutil | |
| artifacts = os.environ['ARTIFACTS'].split() | |
| for artifact in artifacts: | |
| src = "target/release/%s" % artifact | |
| dst = os.environ['OUT_DIR'] + "/" + artifact | |
| shutil.copy(src, dst) | |
| shell: python | |
| - name: Move libuv dylib | |
| env: | |
| ARTIFACTS: ${{ matrix.config.libuv_dylib }} | |
| OUT_DIR: ${{ matrix.config.dir }} | |
| OS: ${{ matrix.config.os }} | |
| run: | | |
| import os | |
| import shutil | |
| artifacts = os.environ['ARTIFACTS'].split() | |
| for artifact in artifacts: | |
| src = "target/release/%s" % artifact | |
| dst = os.environ['OUT_DIR'] + "/" + artifact | |
| shutil.copy(src, dst) | |
| shell: python | |
| - name: Move pllib | |
| env: | |
| ARTIFACTS: planglib | |
| OUT_DIR: ${{ matrix.config.dir }} | |
| OS: ${{ matrix.config.os }} | |
| run: | | |
| import os | |
| import shutil | |
| artifacts = os.environ['ARTIFACTS'].split() | |
| for artifact in artifacts: | |
| src = "%s" % artifact | |
| dst = os.environ['OUT_DIR'] + "/" + artifact | |
| shutil.copytree(src, dst) | |
| shell: python | |
| - if: ${{ matrix.config.os == 'ubuntu-latest' }} | |
| name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| - if: ${{ matrix.config.os == 'ubuntu-latest' }} | |
| name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - if: ${{ matrix.config.os == 'ubuntu-latest' }} | |
| name: Login to ali registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: registry.cn-hangzhou.aliyuncs.com | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| - if: ${{ matrix.config.os == 'ubuntu-latest' }} | |
| name: Build and push | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| push: true | |
| file: ./Dockerfile | |
| tags: registry.cn-hangzhou.aliyuncs.com/pivot_lang/pivot_lang:latest | |
| - name: prepare deb | |
| if: ${{ matrix.config.os == 'ubuntu-latest' }} | |
| run: | | |
| mkdir -p ${{ matrix.config.debdir }} | |
| cp -r deb/* ${{ matrix.config.debdir }}/ | |
| rm ${{ matrix.config.debdir }}/apt.yaml | |
| ls ${{ matrix.config.debdir }}/ | |
| chmod +x ${{ matrix.config.debdir }}/DEBIAN/postinst | |
| mkdir -p ${{ matrix.config.debdir }}/usr/bin | |
| cp ${{ matrix.config.dir }}/plc ${{ matrix.config.debdir }}/usr/bin | |
| mkdir -p ${{ matrix.config.debdir }}/pl | |
| cp -r ${{ matrix.config.dir }}/* ${{ matrix.config.debdir }}/pl | |
| rm ${{ matrix.config.debdir }}/pl/plc | |
| - uses: Pivot-Studio/build-deb-action@master | |
| if: ${{ matrix.config.os == 'ubuntu-latest' }} | |
| id: build-deb | |
| with: | |
| package: pivot-lang | |
| package_root: ${{ matrix.config.debdir }} | |
| maintainer: Chronos <[email protected]> | |
| version: 0.1.${{ github.run_number }} # refs/tags/v*.*.* | |
| arch: 'amd64' | |
| desc: 'pivot-lang compiler' | |
| depends: build-essential, git, libunwind-dev, libxml2 | |
| - name: move deb | |
| if: ${{ matrix.config.os == 'ubuntu-latest' }} | |
| run: | | |
| cp ${{ steps.build-deb.outputs.file_name }} ${{ matrix.config.dir }}/ | |
| - name: Update apt repo | |
| if: ${{ matrix.config.os == 'ubuntu-latest' }} | |
| uses: Pivot-Studio/apt-repo-action@master | |
| with: | |
| github_token: ${{ secrets.PAT }} | |
| repo_supported_arch: | | |
| amd64 | |
| repo_supported_version: | | |
| jammy | |
| focal | |
| file: ${{ steps.build-deb.outputs.file_name }} | |
| file_target_version: jammy | |
| public_key: ${{ secrets.PUBLIC }} | |
| private_key: ${{ secrets.PRIVATE }} | |
| key_passphrase: ${{ secrets.SECRET }} | |
| page_branch: master | |
| github_repository: Pivot-Studio/apt-repo | |
| - name: tar artifacts | |
| env: | |
| OUT_DIR: ${{ matrix.config.dir }} | |
| OS: ${{ matrix.config.os }} | |
| run: | | |
| import os | |
| src = os.environ['OUT_DIR'] | |
| dst = "pivot-lang-0.1.${{ github.run_number }}-${{ matrix.config.arch }}.tar.gz" | |
| os.system("tar -czvf %s %s" % (dst, src)) | |
| shell: python | |
| - name: Set outputs | |
| id: vars | |
| run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT | |
| - uses: ncipollo/release-action@v1 | |
| name: upload | |
| with: | |
| artifacts: "pivot-lang-0.1.${{ github.run_number }}-${{ matrix.config.arch }}.tar.gz" | |
| allowUpdates: true | |
| replacesArtifacts: false | |
| commit: master | |
| tag: v0.1.${{ github.run_number }} | |
| - name: generate scoop manifest | |
| if: ${{ matrix.config.os == 'windows-latest' }} | |
| run: | | |
| mkdir scoop | |
| $template=(cat .\plc.scoop) | |
| $version="v0.1.${{ github.run_number }}" | |
| $file="pivot-lang-0.1.${{ github.run_number }}-${{ matrix.config.arch }}.tar.gz" | |
| $sha256=($(certutil -hashfile $file SHA256)[1]) | |
| cd scoop | |
| $template -f $version,$file,$sha256>plc.json | |
| - name: Deploy | |
| uses: peaceiris/actions-gh-pages@v3 | |
| if: ${{ matrix.config.os == 'windows-latest' }} | |
| with: | |
| personal_token: ${{ secrets.PAT }} | |
| publish_dir: ./scoop | |
| publish_branch: scoop | |
| external_repository: Pivot-Studio/scoop |