You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

163 lines
4.7 KiB

3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
  1. # Based on https://github.com/actions-rs/meta/blob/master/recipes/quickstart.md
  2. on: [push, pull_request]
  3. name: Continuous Integration
  4. jobs:
  5. check:
  6. name: Check
  7. runs-on: ubuntu-latest
  8. steps:
  9. - name: Checkout sources
  10. uses: actions/checkout@v2
  11. - name: Install stable toolchain
  12. uses: actions-rs/toolchain@v1
  13. with:
  14. profile: minimal
  15. toolchain: stable
  16. override: true
  17. - name: Rust Cache
  18. uses: Swatinem/rust-cache@v1.2.0
  19. - name: Run Cargo Check
  20. uses: actions-rs/cargo@v1
  21. with:
  22. command: check
  23. test:
  24. name: Test Suite
  25. runs-on: ubuntu-latest
  26. steps:
  27. - name: Checkout sources
  28. uses: actions/checkout@v2
  29. - name: Install stable toolchain
  30. uses: actions-rs/toolchain@v1
  31. with:
  32. profile: minimal
  33. toolchain: stable
  34. override: true
  35. - name: Rust Cache
  36. uses: Swatinem/rust-cache@v1.2.0
  37. - name: Run Tests
  38. uses: actions-rs/cargo@v1
  39. with:
  40. command: test
  41. lints:
  42. name: Lints
  43. runs-on: ubuntu-latest
  44. steps:
  45. - name: Checkout sources
  46. uses: actions/checkout@v2
  47. - name: Install stable toolchain
  48. uses: actions-rs/toolchain@v1
  49. with:
  50. profile: minimal
  51. toolchain: stable
  52. override: true
  53. components: rustfmt, clippy
  54. - name: Rust Cache
  55. uses: Swatinem/rust-cache@v1.2.0
  56. - name: Run Cargo fmt
  57. uses: actions-rs/cargo@v1
  58. with:
  59. command: fmt
  60. args: --all -- --check
  61. - name: Run Cargo clippy
  62. uses: actions-rs/cargo@v1
  63. # continue-on-error: true
  64. with:
  65. command: clippy
  66. args: -- -D warnings
  67. build-aarch64:
  68. name: Build ARM64 Binaries
  69. if: github.event_name != 'pull_request' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v'))
  70. runs-on: ubuntu-latest
  71. needs: [check, test, lints]
  72. steps:
  73. - uses: actions/checkout@v2
  74. - uses: actions-rs/toolchain@v1
  75. with:
  76. toolchain: stable
  77. target: ${{ matrix.target }}
  78. override: true
  79. - uses: actions/cache@v2
  80. with:
  81. path: |
  82. ~/.cargo/registry
  83. ~/.cargo/git
  84. ~/.cargo/bin
  85. ~/.cargo/.crates2.json
  86. ~/.cargo/.crates.toml
  87. target
  88. key: ${{ runner.os }}-aarch64-unknown-linux-gnu-cargo-${{ hashFiles('**/Cargo.lock') }}
  89. - name: Compile
  90. uses: actions-rs/cargo@v1
  91. with:
  92. use-cross: true
  93. command: build
  94. args: --release --target=aarch64-unknown-linux-gnu
  95. build-ppc:
  96. name: Build PowerPC Binaries
  97. if: github.event_name != 'pull_request' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v'))
  98. continue-on-error: true
  99. runs-on: ubuntu-18.04
  100. needs: [check, test, lints]
  101. steps:
  102. - uses: actions/checkout@v2
  103. - uses: actions-rs/toolchain@v1
  104. with:
  105. toolchain: stable
  106. target: powerpc64-unknown-linux-gnu
  107. override: true
  108. - uses: actions/cache@v2
  109. with:
  110. path: |
  111. ~/.cargo/registry
  112. ~/.cargo/git
  113. ~/.cargo/bin
  114. ~/.cargo/.crates2.json
  115. ~/.cargo/.crates.toml
  116. target
  117. key: ${{ runner.os }}-powerpc64-unknown-linux-gnu-cargo-${{ hashFiles('**/Cargo.lock') }}
  118. - name: Install PowerPC gcc
  119. run: sudo apt-get install -y gcc-powerpc-linux-gnu
  120. - name: Compile
  121. uses: actions-rs/cargo@v1
  122. with:
  123. command: build
  124. args: --release --target=powerpc64-unknown-linux-gnu
  125. publish-docker:
  126. name: Build and Publish Docker Image
  127. if: github.event_name != 'pull_request' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v'))
  128. runs-on: ubuntu-18.04
  129. needs: [check, test, lints]
  130. steps:
  131. - uses: actions/checkout@v2
  132. - uses: actions-rs/toolchain@v1
  133. with:
  134. toolchain: stable
  135. target: x86_64-unknown-linux-gnu
  136. override: true
  137. - name: Rust Cache
  138. uses: Swatinem/rust-cache@v1.2.0
  139. - name: Login to Docker Hub
  140. uses: docker/login-action@v1
  141. with:
  142. username: rohansircar
  143. password: ${{ secrets.DOCKER_LOGIN_PASSWORD }}
  144. - name: Compile
  145. uses: actions-rs/cargo@v1
  146. with:
  147. command: build
  148. args: --release
  149. - name: Build Image
  150. run: docker build -f ci.Dockerfile -t rohansircar/actix-demo:latest .
  151. env:
  152. DOCKER_BUILDKIT: 1
  153. - name: Publish Image
  154. run: docker push rohansircar/actix-demo:latest