1name: CI23on: [push]45jobs:6 test:7 name: Test Suite8 runs-on: ubuntu-latest9 steps:10 - name: Checkout sources11 uses: actions/checkout@v212 - name: Install stable toolchain13 uses: actions-rs/toolchain@v114 with:15 toolchain: stable16 override: true17 - name: Run tests18 uses: actions-rs/cargo@v119 with:20 command: test21 args: --all2223 cargo-release:24 if: startsWith(github.ref, 'refs/tags/') && !endsWith(github.ref, '-test')25 needs: [test]26 runs-on: ubuntu-latest27 steps:28 - name: Checkout sources29 uses: actions/checkout@v230 - name: Install stable toolchain31 uses: actions-rs/toolchain@v132 with:33 toolchain: stable34 override: true35 - name: Install cargo release command36 uses: actions-rs/cargo@v137 with:38 command: install39 args: cargo-release40 - name: Run cargo login41 uses: actions-rs/cargo@v142 with:43 command: login44 args: ${{ secrets.CARGO_TOKEN }}45 - name: Publish crates46 uses: actions-rs/cargo@v147 with:48 command: release49 args: --no-dev-version --skip-push --skip-tag --no-confirm5051 github-release:52 if: startsWith(github.ref, 'refs/tags/')53 needs: [test]54 strategy:55 matrix:56 target:57 58 - aarch64-unknown-linux-gnu59 - i686-unknown-linux-gnu60 - x86_64-unknown-linux-gnu61 - x86_64-apple-darwin62 - i686-pc-windows-msvc63 - x86_64-pc-windows-msvc6465 66 - x86_64-unknown-linux-musl67 include:68 - target: aarch64-unknown-linux-gnu69 os: ubuntu-latest70 bin: jrsonnet71 name: jrsonnet-linux-gnu-aarch6472 - target: i686-pc-windows-msvc73 os: windows-latest74 bin: jrsonnet.exe75 name: jrsonnet-windows-msvc-i686.exe76 - target: i686-unknown-linux-gnu77 os: ubuntu-latest78 bin: jrsonnet79 name: jrsonnet-linux-gnu-i68680 - target: x86_64-apple-darwin81 os: macOS-latest82 bin: jrsonnet83 name: jrsonnet-darwin-amd6484 - target: x86_64-pc-windows-msvc85 os: windows-latest86 bin: jrsonnet.exe87 name: jrsonnet-windows-msvc-amd64.exe88 - target: x86_64-unknown-linux-gnu89 os: ubuntu-latest90 bin: jrsonnet91 name: jrsonnet-linux-gnu-amd649293 - target: x86_64-unknown-linux-musl94 os: ubuntu-latest95 bin: jrsonnet96 name: jrsonnet-linux-static-amd6497 runs-on: ${{ matrix.os }}98 steps:99 - name: Install stable toolchain100 uses: actions-rs/toolchain@v1101 with:102 toolchain: stable103 override: true104 target: ${{ matrix.target }}105106 - name: Checkout107 uses: actions/checkout@v2108109 - name: Linux x86 cross compiler110 if: ${{ matrix.target == 'i686-unknown-linux-gnu' }}111 run: sudo apt install gcc-multilib112113 - name: Musl gcc114 if: ${{ endsWith(matrix.target, '-musl') }}115 run: sudo apt install musl musl-tools116117 - name: ARM cross compiler118 if: ${{ startsWith(matrix.target, 'aarch64-unknown-linux-') }}119 uses: actions-rs/cargo@v1120 with:121 command: install122 args: cross123124 - name: ARM gcc125 if: ${{ startsWith(matrix.target, 'aarch64-unknown-linux-') }}126 run: sudo apt install gcc-aarch64-linux-gnu127128 - name: Run ARM build129 if: ${{ startsWith(matrix.target, 'aarch64-unknown-linux-') }}130 shell: bash131 run: cross build --bin=jrsonnet --release --target ${{ matrix.target }}132133 - name: Run ARM strip134 if: ${{ startsWith(matrix.target, 'aarch64-unknown-linux-') }}135 shell: bash136 run: aarch64-linux-gnu-strip target/${{ matrix.target }}/release/${{ matrix.bin }}137138 - name: Run build139 if: ${{ !startsWith(matrix.target, 'aarch64-unknown-linux-') }}140 uses: actions-rs/cargo@v1141 with:142 command: build143 args: --bin=jrsonnet --release --target ${{ matrix.target }}144145 - name: Run strip146 if: ${{ !startsWith(matrix.target, 'aarch64-unknown-linux-') }}147 shell: bash148 run: strip target/${{ matrix.target }}/release/${{ matrix.bin }}149150 - name: Package151 shell: bash152 run: |153 cd target/${{ matrix.target }}/release154155 cp ${{ matrix.bin }} ../../../${{ matrix.name }}156 cd -157158 - name: Generate SHA-256159 run: shasum -a 256 ${{ matrix.name }} > ${{ matrix.name }}.sha256160161 - name: Publish162 uses: softprops/action-gh-release@v1163 with:164 draft: true165 files: "jrsonnet*"166 env:167 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}