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.

161 lines
4.6 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
  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 aarch64 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-latest
  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: ${{ matrix.target }}
  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. run: sudo apt-get install -y gcc-powerpc-linux-gnu
  119. - name: Compile
  120. uses: actions-rs/cargo@v1
  121. with:
  122. command: build
  123. args: --release --target=powerpc64-unknown-linux-gnu
  124. publish-docker:
  125. name: Build and Publish Docker Image
  126. if: github.event_name != 'pull_request' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v'))
  127. runs-on: ubuntu-latest
  128. needs: [check, test, lints]
  129. steps:
  130. - uses: actions/checkout@v2
  131. - uses: actions-rs/toolchain@v1
  132. with:
  133. toolchain: stable
  134. target: x86_64-unknown-linux-gnu
  135. override: true
  136. - name: Rust Cache
  137. uses: Swatinem/rust-cache@v1.2.0
  138. - name: Login to Docker Hub
  139. uses: docker/login-action@v1
  140. with:
  141. username: rohansircar
  142. password: ${{ secrets.DOCKER_LOGIN_PASSWORD }}
  143. - name: Compile
  144. uses: actions-rs/cargo@v1
  145. with:
  146. command: build
  147. args: --release
  148. - name: Build Image
  149. run: docker build -f ci.Dockerfile -t rohansircar/actix-demo:latest .
  150. env: DOCKER_BUILDKIT=1
  151. - name: Publish Image
  152. run: docker push rohansircar/actix-demo:latest