Bootstrap Rust #90
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: Bootstrap Rust | |
| on: | |
| schedule: | |
| - cron: '43 10 * * *' | |
| workflow_dispatch: | |
| jobs: | |
| artifacts: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| llvm_version: ${{ steps.versions.outputs.llvm_version }} | |
| steps: | |
| - uses: dawidd6/action-download-artifact@v10 | |
| with: | |
| workflow: bootstrap_llvm.yml | |
| workflow_conclusion: success | |
| branch: ${{ github.ref_name }} | |
| name: packages | |
| path: pkgs | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| - id: versions | |
| name: versions | |
| run: cat pkgs/llvm_version.txt >> "$GITHUB_OUTPUT" | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: packages | |
| path: | | |
| pkgs/ | |
| cross_rust: | |
| runs-on: windows-latest | |
| needs: artifacts | |
| steps: | |
| - run: git config --global core.autocrlf input | |
| - uses: actions/checkout@v4 | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| name: packages | |
| path: pkgs | |
| - id: msys2 | |
| uses: msys2/setup-msys2@v2 | |
| with: | |
| release: true | |
| update: true | |
| msystem: MINGW64 | |
| install: >- | |
| mingw-w64-x86_64-python | |
| mingw-w64-x86_64-llvm | |
| mingw-w64-x86_64-clang | |
| - id: cache-restore | |
| uses: actions/cache/restore@v4 | |
| with: | |
| key: cygwin-packages- | |
| restore-keys: | | |
| cygwin-packages- | |
| path: cygwin-packages | |
| - run: IF EXIST cygwin-packages move /y cygwin-packages D:\ | |
| shell: cmd | |
| - id: cygwin | |
| uses: cygwin/cygwin-install-action@master | |
| with: | |
| site: >- | |
| http://mirrors.kernel.org/sourceware/cygwin/ | |
| file://${{ github.workspace }}/pkgs | |
| check-sig: false | |
| packages: | | |
| cygutils-extra | |
| cmake | |
| calm | |
| cygport | |
| flexdll | |
| gdb | |
| git | |
| make | |
| ninja | |
| ocaml | |
| python3 | |
| libxml2-devel | |
| zlib-devel | |
| libzstd-devel | |
| vim | |
| python39-sphinx | |
| python39-pytz | |
| python39-tomli | |
| libgit2_1.9 | |
| libgit2-devel | |
| libssh2-devel | |
| libssl-devel=3.0.16-2 | |
| libssl3=3.0.16-2 | |
| openssl=3.0.16-2 | |
| libcurl-devel | |
| libllvm20.1=${{needs.artifacts.outputs.llvm_version}} | |
| libllvm-devel=${{needs.artifacts.outputs.llvm_version}} | |
| llvm=${{needs.artifacts.outputs.llvm_version}} | |
| - name: prepare cache | |
| run: | | |
| if (Test-Path `${{ steps.cygwin.outputs.package-cache }}\file`* ) { | |
| rm -r -fo `${{ steps.cygwin.outputs.package-cache }}\file`* | |
| } | |
| move "${{ steps.cygwin.outputs.package-cache }}" . | |
| - uses: actions/cache/save@v4 | |
| if: ${{ steps.cache-restore.outputs.cache-matched-key != format('cygwin-packages-{0}', hashFiles('cygwin-packages/**', '!cygwin-packages/**/setup.ini')) }} | |
| with: | |
| key: cygwin-packages-${{ hashFiles('cygwin-packages/**', '!cygwin-packages/**/setup.ini') }} | |
| path: cygwin-packages | |
| - name: post cache | |
| run: move /Y cygwin-packages "${{ steps.cygwin.outputs.package-cache }}" | |
| shell: cmd | |
| - name: build | |
| run: | | |
| export PATH=/usr/local/bin:/usr/bin:/bin:$PATH | |
| export GITHUB_WORKSPACE="$(cygpath -u '${{github.workspace}}')" | |
| mv "$GITHUB_WORKSPACE/pkgs" . | |
| mkdir -p pkgs/x86_64/release | |
| cp "$GITHUB_WORKSPACE/"* . | |
| mkdir bin | |
| gcc -o bin/llvm-config.exe llvm-config-wrapper.c | |
| gcc -o bin/gcc.exe wrapper.c | |
| for b in g++ ar ranlib x86_64-pc-cygwin-gcc curl-config; do | |
| ln bin/gcc.exe bin/${b}.exe | |
| done | |
| RUST_URL="$(python3 -c "import tomli; from urllib.request import urlopen; x = tomli.load(urlopen('https://static.rust-lang.org/dist/channel-rust-nightly.toml')); a = [y for y in x['artifacts']['source-code']['target']['*'] if y['url'].endswith('.xz')]; print(a[0]['url'])")" | |
| echo "$RUST_URL" | tee rust-url.txt | |
| curl -LO "$RUST_URL" | |
| tar -Jxf rustc-nightly-src.tar.xz | |
| cd rustc-nightly-src | |
| MSYS2_ROOT="$(cygpath -m '${{ steps.msys2.outputs.msys2-location }}')" WORKSPACE="$(cygpath -ma "$HOME/bin")" envsubst < ../bootstrap.toml > bootstrap.toml | |
| export PATH="$HOME/bin:$(cygpath -u '${{ steps.msys2.outputs.msys2-location }}')/mingw64/bin:$PATH" | |
| PKG_CONFIG_SYSROOT_DIR="$(cygpath -w /)" \ | |
| PKG_CONFIG="$(cygpath -w /usr/bin/pkgconf.exe)" \ | |
| LIBGIT2_NO_VENDOR=1 \ | |
| OPENSSL_DIR="$(cygpath -w /usr)" \ | |
| OPENSSL_LIB_DIR="$(cygpath -w /usr/lib)" \ | |
| OPENSSL_STATIC=0 \ | |
| DESTDIR="$(cygpath -w "$PWD/build-Cygwin/dest-rust")" \ | |
| python x.py install --stage 2 | |
| cd build-Cygwin/dest-rust && tar -Jcf ~/rust-prefix.tar.xz * | |
| shell: d:\cygwin\bin\bash.exe -leo pipefail -o igncr '{0}' | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: rust-prefix | |
| path: | | |
| ${{steps.cygwin.outputs.root}}/home/runneradmin/rust-url.txt | |
| ${{steps.cygwin.outputs.root}}/home/runneradmin/rust-prefix.tar.xz | |
| ${{steps.cygwin.outputs.root}}/home/runneradmin/rustc-nightly-src.tar.xz | |
| - run: DEL /F ${{ steps.cygwin.outputs.root }}\bin\git.exe | |
| if: always() | |
| shell: cmd | |
| native_rust: | |
| runs-on: windows-latest | |
| needs: [artifacts, cross_rust] | |
| steps: | |
| - run: git config --global core.autocrlf input | |
| - uses: actions/checkout@v4 | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| name: packages | |
| path: pkgs | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| name: rust-prefix | |
| path: rust-prefix | |
| - id: cache-restore | |
| uses: actions/cache/restore@v4 | |
| with: | |
| key: cygwin-packages- | |
| restore-keys: | | |
| cygwin-packages- | |
| path: cygwin-packages | |
| - run: IF EXIST cygwin-packages move /y cygwin-packages D:\ | |
| shell: cmd | |
| - id: cygwin | |
| uses: cygwin/cygwin-install-action@master | |
| with: | |
| site: >- | |
| http://mirrors.kernel.org/sourceware/cygwin/ | |
| file://${{ github.workspace }}/pkgs | |
| check-sig: false | |
| packages: | | |
| cygutils-extra | |
| cmake | |
| calm | |
| cygport | |
| flexdll | |
| gdb | |
| git | |
| make | |
| ninja | |
| ocaml | |
| python3 | |
| libxml2-devel | |
| zlib-devel | |
| libzstd-devel | |
| vim | |
| python39-sphinx | |
| python39-pytz | |
| python39-tomli | |
| libgit2_1.9 | |
| libgit2-devel | |
| libssh2-devel | |
| libssl-devel=3.0.16-2 | |
| libssl3=3.0.16-2 | |
| openssl=3.0.16-2 | |
| libcurl-devel | |
| libllvm20.1=${{needs.artifacts.outputs.llvm_version}} | |
| libllvm-devel=${{needs.artifacts.outputs.llvm_version}} | |
| llvm=${{needs.artifacts.outputs.llvm_version}} | |
| - name: prepare cache | |
| run: | | |
| if (Test-Path `${{ steps.cygwin.outputs.package-cache }}\file`* ) { | |
| rm -r -fo `${{ steps.cygwin.outputs.package-cache }}\file`* | |
| } | |
| move "${{ steps.cygwin.outputs.package-cache }}" . | |
| - uses: actions/cache/save@v4 | |
| if: ${{ steps.cache-restore.outputs.cache-matched-key != format('cygwin-packages-{0}', hashFiles('cygwin-packages/**', '!cygwin-packages/**/setup.ini')) }} | |
| with: | |
| key: cygwin-packages-${{ hashFiles('cygwin-packages/**', '!cygwin-packages/**/setup.ini') }} | |
| path: cygwin-packages | |
| - name: post cache | |
| run: move /Y cygwin-packages "${{ steps.cygwin.outputs.package-cache }}" | |
| shell: cmd | |
| - name: build | |
| run: | | |
| export PATH=/usr/local/bin:/usr/bin:/bin:$PATH | |
| export GITHUB_WORKSPACE="$(cygpath -u '${{github.workspace}}')" | |
| mv "$GITHUB_WORKSPACE/pkgs" . | |
| mkdir -p pkgs/x86_64/release | |
| cp "$GITHUB_WORKSPACE/rust-prefix/rust-url.txt" . | |
| (cd / && tar -Jxvf "$GITHUB_WORKSPACE/rust-prefix/rust-prefix.tar.xz" | grep -E -- '^usr/bin/[^/]+-[0-9a-f]{16}.dll$' | grep -v rustc_driver | xargs rm) | |
| rebase -s /usr/bin/rustc_driver*.dll | |
| tar -Jxf "$GITHUB_WORKSPACE/rust-prefix/rustc-nightly-src.tar.xz" | |
| cd rustc-nightly-src | |
| cp "$GITHUB_WORKSPACE/bootstrap-native.toml" bootstrap.toml | |
| LIBGIT2_NO_VENDOR=1 \ | |
| OPENSSL_STATIC=0 \ | |
| DESTDIR="$PWD/build-Cygwin/dest-rust" \ | |
| python3 x.py install --stage 2 | |
| cd build-Cygwin/dest-rust && tar -Jcf ~/rust-prefix.tar.xz * | |
| shell: d:\cygwin\bin\bash.exe -leo pipefail -o igncr '{0}' | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: rust-prefix | |
| overwrite: true | |
| path: | | |
| ${{steps.cygwin.outputs.root}}/home/runneradmin/rust-url.txt | |
| ${{steps.cygwin.outputs.root}}/home/runneradmin/rust-prefix.tar.xz | |
| - run: DEL /F ${{ steps.cygwin.outputs.root }}\bin\git.exe | |
| if: always() | |
| shell: cmd |