|
| 1 | +name: adex-cli |
| 2 | +on: [push] |
| 3 | + |
| 4 | +concurrency: |
| 5 | + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} |
| 6 | + cancel-in-progress: true |
| 7 | + |
| 8 | +env: |
| 9 | + BRANCH_NAME: ${{ github.head_ref || github.ref_name }} |
| 10 | + |
| 11 | +jobs: |
| 12 | + code-check: |
| 13 | + timeout-minutes: 60 |
| 14 | + runs-on: ${{ matrix.os }} |
| 15 | + strategy: |
| 16 | + matrix: |
| 17 | + os: [ubuntu-latest, macos-latest, windows-latest] |
| 18 | + steps: |
| 19 | + - uses: actions/checkout@v3 |
| 20 | + |
| 21 | + - name: pre scripts for ci container |
| 22 | + run: | |
| 23 | + git config --global --add safe.directory /__w/atomicDEX-API/atomicDEX-API |
| 24 | + echo "/bin" >> $GITHUB_PATH |
| 25 | + echo "/usr/bin" >> $GITHUB_PATH |
| 26 | + echo "/root/.cargo/bin" >> $GITHUB_PATH |
| 27 | +
|
| 28 | + - name: Calculate commit hash for PR commit |
| 29 | + if: github.event_name == 'pull_request' |
| 30 | + run: echo "COMMIT_HASH=$(git rev-parse --short=7 ${{ github.event.pull_request.head.sha }})" >> $GITHUB_ENV |
| 31 | + |
| 32 | + - name: Calculate commit hash for merge commit |
| 33 | + if: github.event_name != 'pull_request' |
| 34 | + run: echo "COMMIT_HASH=$(git rev-parse --short=7 HEAD)" >> $GITHUB_ENV |
| 35 | + |
| 36 | + - name: Start checking code format and lint |
| 37 | + run: | |
| 38 | + cargo fmt --manifest-path ./mm2src/adex_cli/Cargo.toml --all -- --check |
| 39 | + cargo clippy --manifest-path ./mm2src/adex_cli/Cargo.toml --all-targets --all-features -- --D warnings |
| 40 | +
|
| 41 | + test: |
| 42 | + timeout-minutes: 60 |
| 43 | + runs-on: ${{ matrix.os }} |
| 44 | + strategy: |
| 45 | + matrix: |
| 46 | + os: [ubuntu-latest, macos-latest, windows-latest] |
| 47 | + steps: |
| 48 | + - uses: actions/checkout@v3 |
| 49 | + |
| 50 | + - name: pre scripts for ci container |
| 51 | + run: | |
| 52 | + git config --global --add safe.directory /__w/atomicDEX-API/atomicDEX-API |
| 53 | + echo "/bin" >> $GITHUB_PATH |
| 54 | + echo "/usr/bin" >> $GITHUB_PATH |
| 55 | + echo "/root/.cargo/bin" >> $GITHUB_PATH |
| 56 | +
|
| 57 | + - name: Calculate commit hash for PR commit |
| 58 | + if: github.event_name == 'pull_request' |
| 59 | + run: echo "COMMIT_HASH=$(git rev-parse --short=7 ${{ github.event.pull_request.head.sha }})" >> $GITHUB_ENV |
| 60 | + |
| 61 | + - name: Calculate commit hash for merge commit |
| 62 | + if: github.event_name != 'pull_request' |
| 63 | + run: echo "COMMIT_HASH=$(git rev-parse --short=7 HEAD)" >> $GITHUB_ENV |
| 64 | + |
| 65 | + - name: Start testing |
| 66 | + run: | |
| 67 | + cargo test --manifest-path ./mm2src/adex_cli/Cargo.toml |
| 68 | +
|
| 69 | + build: |
| 70 | + timeout-minutes: 60 |
| 71 | + runs-on: ${{ matrix.os }} |
| 72 | + strategy: |
| 73 | + matrix: |
| 74 | + os: [ubuntu-latest, macos-latest, windows-latest] |
| 75 | + steps: |
| 76 | + - uses: actions/checkout@v3 |
| 77 | + |
| 78 | + - name: pre scripts for ci container |
| 79 | + run: | |
| 80 | + git config --global --add safe.directory /__w/atomicDEX-API/atomicDEX-API |
| 81 | + echo "/bin" >> $GITHUB_PATH |
| 82 | + echo "/usr/bin" >> $GITHUB_PATH |
| 83 | + echo "/root/.cargo/bin" >> $GITHUB_PATH |
| 84 | +
|
| 85 | + - name: Calculate commit hash for PR commit |
| 86 | + if: github.event_name == 'pull_request' |
| 87 | + run: echo "COMMIT_HASH=$(git rev-parse --short=7 ${{ github.event.pull_request.head.sha }})" >> $GITHUB_ENV |
| 88 | + |
| 89 | + - name: Calculate commit hash for merge commit |
| 90 | + if: github.event_name != 'pull_request' |
| 91 | + run: echo "COMMIT_HASH=$(git rev-parse --short=7 HEAD)" >> $GITHUB_ENV |
| 92 | + |
| 93 | + - name: Start building |
| 94 | + run: | |
| 95 | + cargo build --manifest-path ./mm2src/adex_cli/Cargo.toml |
0 commit comments