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.

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