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.

173 lines
5.0 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 Unit Tests
  38. uses: actions-rs/cargo@v1
  39. with:
  40. command: test
  41. args: --lib
  42. - name: Run Integration Tests
  43. uses: actions-rs/cargo@v1
  44. with:
  45. command: test
  46. args: --test integration
  47. env: ACTIX_DEMO_TEST_RUST_LOG=warn
  48. lints:
  49. name: Lints
  50. runs-on: ubuntu-latest
  51. steps:
  52. - name: Checkout sources
  53. uses: actions/checkout@v2
  54. - name: Install stable toolchain
  55. uses: actions-rs/toolchain@v1
  56. with:
  57. profile: minimal
  58. toolchain: stable
  59. override: true
  60. components: rustfmt, clippy
  61. - name: Rust Cache
  62. uses: Swatinem/rust-cache@v1.2.0
  63. - name: Run Cargo fmt
  64. uses: actions-rs/cargo@v1
  65. with:
  66. command: fmt
  67. args: --all -- --check
  68. - name: Run Cargo clippy
  69. uses: actions-rs/cargo@v1
  70. # continue-on-error: true
  71. with:
  72. command: clippy
  73. args: -- -D warnings
  74. build-aarch64:
  75. name: Build ARM64 Binaries
  76. if: github.event_name != 'pull_request' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v'))
  77. runs-on: ubuntu-latest
  78. needs: [check, test, lints]
  79. steps:
  80. - uses: actions/checkout@v2
  81. - uses: actions-rs/toolchain@v1
  82. with:
  83. toolchain: stable
  84. target: ${{ matrix.target }}
  85. override: true
  86. - uses: actions/cache@v2
  87. with:
  88. path: |
  89. ~/.cargo/registry
  90. ~/.cargo/git
  91. ~/.cargo/bin
  92. ~/.cargo/.crates2.json
  93. ~/.cargo/.crates.toml
  94. target
  95. key: ${{ runner.os }}-aarch64-unknown-linux-gnu-cargo-${{ hashFiles('**/Cargo.lock') }}
  96. - name: Compile
  97. uses: actions-rs/cargo@v1
  98. with:
  99. use-cross: true
  100. command: build
  101. args: --release --target=aarch64-unknown-linux-gnu
  102. build-ppc:
  103. name: Build PowerPC Binaries
  104. if: github.event_name != 'pull_request' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v'))
  105. continue-on-error: true
  106. runs-on: ubuntu-18.04
  107. needs: [check, test, lints]
  108. steps:
  109. - uses: actions/checkout@v2
  110. - uses: actions-rs/toolchain@v1
  111. with:
  112. toolchain: stable
  113. target: powerpc64-unknown-linux-gnu
  114. override: true
  115. - uses: actions/cache@v2
  116. with:
  117. path: |
  118. ~/.cargo/registry
  119. ~/.cargo/git
  120. ~/.cargo/bin
  121. ~/.cargo/.crates2.json
  122. ~/.cargo/.crates.toml
  123. target
  124. key: ${{ runner.os }}-powerpc64-unknown-linux-gnu-cargo-${{ hashFiles('**/Cargo.lock') }}
  125. - name: Install PowerPC gcc
  126. run: |
  127. sudo apt-get install -y gcc-powerpc64-linux-gnu
  128. sudo ln -s /usr/bin/powerpc64-linux-gnu-gcc-7 /usr/bin/powerpc-linux-gnu-gcc
  129. - name: Compile
  130. uses: actions-rs/cargo@v1
  131. with:
  132. command: build
  133. args: --release --target=powerpc64-unknown-linux-gnu
  134. env:
  135. RUSTFLAGS: "-C linker=powerpc64-linux-gnu-gcc-7"
  136. publish-docker:
  137. name: Build and Publish Docker Image
  138. if: github.event_name != 'pull_request' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v'))
  139. runs-on: ubuntu-18.04
  140. needs: [check, test, lints]
  141. steps:
  142. - uses: actions/checkout@v2
  143. - uses: actions-rs/toolchain@v1
  144. with:
  145. toolchain: 1.50.0
  146. target: x86_64-unknown-linux-gnu
  147. override: true
  148. - name: Rust Cache
  149. uses: Swatinem/rust-cache@v1.2.0
  150. - name: Login to Docker Hub
  151. uses: docker/login-action@v1
  152. with:
  153. username: rohansircar
  154. password: ${{ secrets.DOCKER_LOGIN_PASSWORD }}
  155. - name: Compile
  156. uses: actions-rs/cargo@v1
  157. with:
  158. command: build
  159. args: --release
  160. - name: Build Image
  161. run: docker build -f ci.Dockerfile -t rohansircar/actix-demo:latest .
  162. env:
  163. DOCKER_BUILDKIT: 1
  164. - name: Publish Image
  165. run: docker push rohansircar/actix-demo:latest