|
| 1 | +name: Rust |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: ["main"] |
| 6 | + tags: |
| 7 | + - "v*" |
| 8 | + pull_request: |
| 9 | + branches: ["main"] |
| 10 | + |
| 11 | +env: |
| 12 | + CARGO_TERM_COLOR: always |
| 13 | + |
| 14 | +jobs: |
| 15 | + linux-build-test: |
| 16 | + runs-on: ubuntu-latest |
| 17 | + steps: |
| 18 | + - uses: actions/checkout@v3 |
| 19 | + |
| 20 | + - name: Install latest rust toolchain |
| 21 | + uses: actions-rs/toolchain@v1 |
| 22 | + with: |
| 23 | + toolchain: stable |
| 24 | + default: true |
| 25 | + override: true |
| 26 | + |
| 27 | + - name: Build |
| 28 | + run: cargo build --verbose |
| 29 | + - name: Run tests |
| 30 | + run: cargo test --all-features --verbose |
| 31 | + |
| 32 | + mac-build-test: |
| 33 | + runs-on: macos-latest |
| 34 | + |
| 35 | + steps: |
| 36 | + - uses: actions/checkout@v3 |
| 37 | + - name: Build |
| 38 | + run: cargo build --verbose |
| 39 | + - name: Run tests |
| 40 | + run: cargo test --all-features --verbose |
| 41 | + |
| 42 | + windows-build-test: |
| 43 | + runs-on: windows-latest |
| 44 | + |
| 45 | + steps: |
| 46 | + - uses: actions/checkout@v3 |
| 47 | + - name: Build |
| 48 | + run: cargo build --verbose |
| 49 | + - name: Run tests |
| 50 | + run: cargo test --all-features --verbose |
| 51 | + |
| 52 | + create-release: |
| 53 | + runs-on: ubuntu-latest |
| 54 | + if: startsWith(github.event.ref, 'refs/tags/v') |
| 55 | + steps: |
| 56 | + - uses: actions/checkout@v4 |
| 57 | + - uses: taiki-e/create-gh-release-action@v1 |
| 58 | + with: |
| 59 | + changelog: CHANGELOG.md |
| 60 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 61 | + |
| 62 | + upload-assets: |
| 63 | + if: startsWith(github.event.ref, 'refs/tags/v') |
| 64 | + needs: create-release |
| 65 | + strategy: |
| 66 | + matrix: |
| 67 | + include: |
| 68 | + - target: x86_64-unknown-linux-gnu |
| 69 | + os: ubuntu-latest |
| 70 | + - target: x86_64-apple-darwin |
| 71 | + os: macos-latest |
| 72 | + - target: x86_64-pc-windows-msvc |
| 73 | + os: windows-latest |
| 74 | + runs-on: ${{ matrix.os }} |
| 75 | + steps: |
| 76 | + - uses: actions/checkout@v4 |
| 77 | + - uses: taiki-e/upload-rust-binary-action@v1 |
| 78 | + with: |
| 79 | + bin: mpm |
| 80 | + target: ${{ matrix.target }} |
| 81 | + tar: unix |
| 82 | + zip: windows |
| 83 | + token: ${{ secrets.CARGO_REGISTRY_TOKEN }} |
0 commit comments