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.

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