|
| 1 | +name: CI |
| 2 | + |
| 3 | +# Run this workflow every time a new commit is pushed to the repository |
| 4 | +on: |
| 5 | + push: |
| 6 | + branches: |
| 7 | + - master |
| 8 | + pull_request: |
| 9 | + |
| 10 | +jobs: |
| 11 | + ensure-conventions: |
| 12 | + name: Ensure conventions are followed |
| 13 | + runs-on: ubuntu-latest |
| 14 | + |
| 15 | + steps: |
| 16 | + # Checks out a copy of your repository on the ubuntu-latest machine |
| 17 | + - name: Checkout code |
| 18 | + uses: actions/checkout@v2 |
| 19 | + |
| 20 | + - name: Ensure src/lib.rs files exist |
| 21 | + run: bash ./_test/ensure-lib-src-rs-exist.sh |
| 22 | + |
| 23 | + - name: Count ignores |
| 24 | + run: sh ./_test/count-ignores.sh |
| 25 | + |
| 26 | + - name: Check UUIDs |
| 27 | + run: sh ./_test/check-uuids.sh |
| 28 | + |
| 29 | + - name: Verify exercise difficulties |
| 30 | + run: ./_test/verify-exercise-difficulties.sh |
| 31 | + |
| 32 | + - name: Check exercises for authors |
| 33 | + run: ./_test/check-exercises-for-authors.sh |
| 34 | + |
| 35 | + configlet: |
| 36 | + name: Setup configlet |
| 37 | + runs-on: ubuntu-latest |
| 38 | + |
| 39 | + steps: |
| 40 | + # Checks out master locally so that it is available to the scripts. |
| 41 | + - name: Checkout master |
| 42 | + uses: actions/checkout@v2 |
| 43 | + with: |
| 44 | + ref: master |
| 45 | + |
| 46 | + # Checks out a copy of your repository on the ubuntu-latest machine |
| 47 | + - name: Checkout code |
| 48 | + uses: actions/checkout@v2 |
| 49 | + |
| 50 | + # Sets TRAVIS_PULL_REQUEST to false if this is not a pull request. |
| 51 | + - name: set TRAVIS_PULL_REQUEST |
| 52 | + env: |
| 53 | + PR_NUMBER: ${{ github.event.pull_request.number }} |
| 54 | + run: echo "TRAVIS_PULL_REQUEST=${PR_NUMBER:-false}" >> $GITHUB_ENV |
| 55 | + |
| 56 | + - name: Fetch configlet |
| 57 | + run: ./bin/fetch-configlet |
| 58 | + |
| 59 | + - name: Check configlet format |
| 60 | + run: ./_test/check-configlet-fmt.sh |
| 61 | + |
| 62 | + - name: Ensure readmes are updated |
| 63 | + run: sh ./_test/ensure-readmes-are-updated.sh |
| 64 | + |
| 65 | + - name: Lint configlet |
| 66 | + run: ./bin/configlet lint . |
| 67 | + |
| 68 | + |
| 69 | + compilation: |
| 70 | + name: Check compilation |
| 71 | + runs-on: ubuntu-latest |
| 72 | + |
| 73 | + strategy: |
| 74 | + # Allows running the job multiple times with different configurations |
| 75 | + matrix: |
| 76 | + rust: ["stable", "beta"] |
| 77 | + deny_warnings: ['', '1'] |
| 78 | + |
| 79 | + steps: |
| 80 | + # Checks out master locally so that it is available to the scripts. |
| 81 | + - name: Checkout master |
| 82 | + uses: actions/checkout@v2 |
| 83 | + with: |
| 84 | + ref: master |
| 85 | + |
| 86 | + # Checks out a copy of your repository on the ubuntu-latest machine |
| 87 | + - name: Checkout code |
| 88 | + uses: actions/checkout@v2 |
| 89 | + |
| 90 | + - name: Setup toolchain |
| 91 | + uses: actions-rs/toolchain@v1 |
| 92 | + with: |
| 93 | + toolchain: ${{ matrix.rust }} |
| 94 | + default: true |
| 95 | + |
| 96 | + # Sets TRAVIS_PULL_REQUEST to false if this is not a pull request. |
| 97 | + - name: set TRAVIS_PULL_REQUEST |
| 98 | + env: |
| 99 | + PR_NUMBER: ${{ github.event.pull_request.number }} |
| 100 | + run: echo "TRAVIS_PULL_REQUEST=${PR_NUMBER:-false}" >> $GITHUB_ENV |
| 101 | + |
| 102 | + # run scripts as steps |
| 103 | + # TODO: the TRAVIS_PULL_REQUEST variable is a holdover from before the |
| 104 | + # migration to GitHub Actions. The scripts that use it do so in order to |
| 105 | + # run only on changed files. |
| 106 | + - name: Check exercises |
| 107 | + env: |
| 108 | + DENYWARNINGS: ${{ matrix.deny_warnings }} |
| 109 | + run: ./_test/check-exercises.sh |
| 110 | + continue-on-error: ${{ matrix.rust == 'beta' && matrix.deny_warnings == '1' }} |
| 111 | + |
| 112 | + - name: Ensure stubs compile |
| 113 | + env: |
| 114 | + DENYWARNINGS: ${{ matrix.deny_warnings }} |
| 115 | + run: sh ./_test/ensure-stubs-compile.sh |
| 116 | + continue-on-error: ${{ matrix.rust == 'beta' && matrix.deny_warnings == '1' }} |
| 117 | + |
| 118 | + - name: Check exercise crate |
| 119 | + env: |
| 120 | + DENYWARNINGS: ${{ matrix.deny_warnings }} |
| 121 | + run: sh ./_test/check-exercise-crate.sh |
| 122 | + continue-on-error: ${{ matrix.rust == 'beta' && matrix.deny_warnings == '1' }} |
| 123 | + |
| 124 | + nightly-compilation: |
| 125 | + name: Check exercises on nightly (benchmark enabled) |
| 126 | + runs-on: ubuntu-latest |
| 127 | + continue-on-error: true # It's okay if the nightly job fails |
| 128 | + |
| 129 | + steps: |
| 130 | + # Checks out master locally so that it is available to the scripts. |
| 131 | + - name: Checkout master |
| 132 | + uses: actions/checkout@v2 |
| 133 | + with: |
| 134 | + ref: master |
| 135 | + |
| 136 | + # Checks out a copy of your repository on the ubuntu-latest machine |
| 137 | + - name: Checkout code |
| 138 | + uses: actions/checkout@v2 |
| 139 | + |
| 140 | + - name: Setup nightly toolchain |
| 141 | + uses: actions-rs/toolchain@v1 |
| 142 | + with: |
| 143 | + toolchain: nightly |
| 144 | + default: true |
| 145 | + |
| 146 | + - name: Check exercises |
| 147 | + env: |
| 148 | + BENCHMARK: '1' |
| 149 | + run: ./_test/check-exercises.sh |
0 commit comments