fork/static-web-server

git clone https://git.julia.blue/fork/static-web-server

Jose Quintanarefactor: update github ci workflows (#514)1c4929d

allow-symlink
6.7 KiB201 linesraw
1name: release-build-manual
2on:
3  pull_request:
4    types:
5      - labeled
6
7jobs:
8  build:
9    name: build
10    environment: release-build-manual
11    if: contains(github.event.label.name, 'release:manual:v2.')
12    runs-on: ${{ matrix.os }}
13    env:
14      # For some builds, we use cross to test on 32-bit and big-endian
15      # systems.
16      CARGO_BIN: cargo
17      # When CARGO_BIN is set to CROSS, this is set to `--target matrix.target`.
18      TARGET_FLAGS: ""
19      # When CARGO_BIN is set to CROSS, TARGET_DIR includes matrix.target.
20      TARGET_DIR: ./target
21      # Emit backtraces on panics.
22      RUST_BACKTRACE: 1
23      # Rustc flags needed by the `all` features
24      RUSTFLAGS: "--cfg tokio_unstable"
25      # SWS features for Cargo build
26      CARGO_FEATURES: "--features=all"
27    strategy:
28      matrix:
29        build:
30          - windows-msvc-arm64
31        include:
32        # - build: linux-musl
33        #   os: ubuntu-22.04
34        #   rust: stable
35        #   target: x86_64-unknown-linux-musl
36        # - build: linux-musl-i686
37        #   os: ubuntu-22.04
38        #   rust: stable
39        #   target: i686-unknown-linux-musl
40        # - build: linux-musl-arm64
41        #   os: ubuntu-22.04
42        #   rust: stable
43        #   target: aarch64-unknown-linux-musl
44        # - build: linux-gnu
45        #   os: ubuntu-22.04
46        #   rust: stable
47        #   target: x86_64-unknown-linux-gnu
48        # - build: linux-gnu-i686
49        #   os: ubuntu-22.04
50        #   rust: stable
51        #   target: i686-unknown-linux-gnu
52        # - build: linux-gnu-arm64
53        #   os: ubuntu-22.04
54        #   rust: stable
55        #   target: aarch64-unknown-linux-gnu
56        # - build: linux-arm-gnueabihf
57        #   os: ubuntu-22.04
58        #   rust: stable
59        #   target: arm-unknown-linux-gnueabihf
60        # - build: linux-musl-armv6
61        #   os: ubuntu-22.04
62        #   rust: stable
63        #   target: arm-unknown-linux-musleabihf
64        # - build: linux-musl-armv7
65        #   os: ubuntu-22.04
66        #   rust: stable
67        #   target: armv7-unknown-linux-musleabihf
68        # - build: linux-ppc64le
69        #   os: ubuntu-22.04
70        #   rust: stable
71        #   target: powerpc64le-unknown-linux-gnu
72        # - build: linux-s390x
73        #   os: ubuntu-22.04
74        #   rust: stable
75        #   target: s390x-unknown-linux-gnu
76        # # - build: linux-android-armv7
77        # #   os: ubuntu-22.04
78        # #   rust: stable
79        # #   target: armv7-linux-androideabi
80        # - build: linux-android-arm64
81        #   os: ubuntu-22.04
82        #   rust: stable
83        #   target: aarch64-linux-android
84        # - build: netbsd
85        #   os: ubuntu-22.04
86        #   rust: stable
87        #   target: x86_64-unknown-netbsd
88        # - build: illumos
89        #   os: ubuntu-22.04
90        #   rust: stable
91        #   target: x86_64-unknown-illumos
92        # - build: macos
93        #   os: macos-14
94        #   rust: stable
95        #   target: x86_64-apple-darwin
96        # - build: macos-arm64
97        #   os: macos-14
98        #   rust: stable
99        #   target: aarch64-apple-darwin
100        - build: windows-msvc
101          os: windows-2022
102          rust: stable
103          target: x86_64-pc-windows-msvc
104        - build: windows-msvc-i686
105          os: windows-2022
106          rust: stable
107          target: i686-pc-windows-msvc
108        - build: windows-msvc-arm64
109          os: windows-2022
110          rust: stable
111          target: aarch64-pc-windows-msvc
112        # - build: windows-pc-gnu
113        #   os: windows-2022
114        #   rust: stable-x86_64-gnu
115        #   target: x86_64-pc-windows-gnu
116
117    steps:
118    - name: Checkout repository
119      uses: actions/checkout@v4
120      with:
121        fetch-depth: 1
122
123    - name: Install Linux/BSD tools
124      if: ${{ !contains(matrix.os, 'windows') }}
125      run: scripts/ci/install_tools.sh --target=${{ matrix.target }}
126
127    - name: Install Rust
128      uses: dtolnay/rust-toolchain@stable
129      with:
130        toolchain: ${{ matrix.rust }}
131        target: ${{ matrix.target }}
132
133    - name: Set up Cross
134      shell: bash
135      run: |
136        if [ "${{ matrix.os }}" = "ubuntu-22.04" ]; then
137          # Use 'cargo.sh' script for Android targets only
138          if [[ "${{ matrix.build }}" == "linux-android-armv7" ]] || [[ "${{ matrix.build }}" == "linux-android-arm64" ]]; then
139            echo "CARGO_BIN=scripts/ci/cargo.sh" >> $GITHUB_ENV
140          else
141            cargo install cross@^0.2
142            echo "CARGO_BIN=cross" >> $GITHUB_ENV
143          fi
144        fi
145        echo "TARGET_FLAGS=--target=${{ matrix.target }}" >> $GITHUB_ENV
146        echo "TARGET_DIR=./target/${{ matrix.target }}" >> $GITHUB_ENV
147
148    - name: Setup Windows ARM64
149      if: ${{ contains(matrix.build, 'windows-msvc-arm64') }}
150      run: |
151        # ring crate: add Visual Studio Build Tools "VS 2022 C++ ARM64 build tools" and "clang" components
152        $env:Path += ";C:\Program Files (x86)\Microsoft Visual Studio\2022\Enterprise\VC\Tools\Llvm\x64\bin"
153
154    - name: Show command used for Cargo
155      run: |
156        echo "cargo command is: ${{ env.CARGO_BIN }}"
157        echo "target flag is: ${{ env.TARGET_FLAGS }}"
158        echo "target dir is: ${{ env.TARGET_DIR }}"
159
160    - name: Build release binary
161      run: ${{ env.CARGO_BIN }} build --bin static-web-server -vv --release ${{ env.CARGO_FEATURES }} ${{ env.TARGET_FLAGS }}
162
163    - name: Prepare Docker envs
164      shell: bash
165      run: |
166        version=${{ github.event.label.name }}
167        semver=${version#*release:manual:v}
168        echo "SEMVER=$semver" >> $GITHUB_ENV
169        echo "SEMVER_MAJOR=${semver%.*.*}" >> $GITHUB_ENV
170        echo "SEMVER_MINOR=${semver%.*}" >> $GITHUB_ENV
171
172    - name: Build archive
173      shell: bash
174      run: |
175        staging="static-web-server-${{ env.SEMVER }}-${{ matrix.target }}"
176        mkdir -p "$staging/"
177        mkdir -p bin
178
179        cp {README.md,LICENSE-APACHE,LICENSE-MIT} "$staging/"
180
181        if [ "${{ matrix.os }}" = "windows-2022" ]; then
182          cp "target/${{ matrix.target }}/release/static-web-server.exe" "$staging/"
183          7z a "$staging.zip" "$staging"
184          echo "ASSET=$staging.zip" >> $GITHUB_ENV
185        else
186          # The man page is only generated on Unix systems.
187          cp "target/${{ matrix.target }}/release/static-web-server" "$staging/"
188          cp "$staging/static-web-server" bin/
189          tar czf "$staging.tar.gz" "$staging"
190          echo "ASSET=$staging.tar.gz" >> $GITHUB_ENV
191        fi
192
193    - name: Upload release archive
194      uses: actions/upload-release-asset@v1.0.1
195      env:
196        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
197      with:
198        upload_url: ${{ secrets.RELEASE_UPLOAD_URL }}
199        asset_path: ${{ env.ASSET }}
200        asset_name: ${{ env.ASSET }}
201        asset_content_type: application/octet-stream