|
| 1 | +name: Continuous integration |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ trunk ] |
| 6 | + pull_request: |
| 7 | + branches: [ trunk ] |
| 8 | + |
| 9 | +env: |
| 10 | + CARGO_TERM_COLOR: always |
| 11 | + |
| 12 | +jobs: |
| 13 | + linux: |
| 14 | + name: Linux |
| 15 | + runs-on: ubuntu-latest |
| 16 | + steps: |
| 17 | + - uses: actions/checkout@v2 |
| 18 | + with: |
| 19 | + submodules: 'recursive' |
| 20 | + # cache cargo |
| 21 | + - uses: actions/cache@v2 |
| 22 | + with: |
| 23 | + path: | |
| 24 | + ~/.cargo/registry |
| 25 | + ~/.cargo/git |
| 26 | + target |
| 27 | + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} |
| 28 | + # deps |
| 29 | + - name: GTK development librarys |
| 30 | + run: sudo apt-get update -y && sudo apt-get install -y libgtk-3-dev |
| 31 | + - uses: actions-rs/toolchain@v1 |
| 32 | + with: |
| 33 | + profile: minimal |
| 34 | + toolchain: stable |
| 35 | + override: true |
| 36 | + # check |
| 37 | + - uses: actions-rs/cargo@v1 |
| 38 | + with: |
| 39 | + command: check |
| 40 | + # test |
| 41 | + - uses: actions-rs/cargo@v1 |
| 42 | + with: |
| 43 | + command: test |
| 44 | + args: -- --nocapture |
| 45 | + # rustfmt |
| 46 | + - run: rustup component add rustfmt |
| 47 | + - uses: actions-rs/cargo@v1 |
| 48 | + with: |
| 49 | + command: fmt |
| 50 | + args: --all -- --check |
| 51 | + # clippy |
| 52 | + - run: rustup component add clippy |
| 53 | + - uses: actions-rs/cargo@v1 |
| 54 | + with: |
| 55 | + command: clippy |
| 56 | + args: -- -D warnings |
| 57 | + |
| 58 | + macos: |
| 59 | + name: MacOS |
| 60 | + runs-on: macos-latest |
| 61 | + steps: |
| 62 | + - uses: actions/checkout@v2 |
| 63 | + with: |
| 64 | + submodules: 'recursive' |
| 65 | + # deps |
| 66 | + - name: GTK development librarys |
| 67 | + run: brew install gtk+3 pkg-config |
| 68 | + # build |
| 69 | + - name: build |
| 70 | + run: cargo build |
| 71 | + # test |
| 72 | + - name: test |
| 73 | + run: cargo test -- --nocapture |
| 74 | + |
| 75 | + windows: |
| 76 | + name: Windows |
| 77 | + runs-on: windows-latest |
| 78 | + steps: |
| 79 | + - uses: actions/checkout@v2 |
| 80 | + with: |
| 81 | + submodules: 'recursive' |
| 82 | + # cache cargo |
| 83 | + - uses: actions/cache@v2 |
| 84 | + with: |
| 85 | + path: | |
| 86 | + ~/.cargo/registry |
| 87 | + ~/.cargo/git |
| 88 | + target |
| 89 | + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} |
| 90 | + # get the last commit of gvsbuild, this will be used as the cache key |
| 91 | + - name: get last gvsbuild commit |
| 92 | + run: git ls-remote https://github.com/wingtk/gvsbuild.git refs/heads/master > commit.txt |
| 93 | + shell: cmd |
| 94 | + # cache gvsbuild |
| 95 | + - uses: actions/cache@v2 |
| 96 | + id: cache |
| 97 | + with: |
| 98 | + path: release\** |
| 99 | + key: ${{ runner.os }}-gvsbuild--${{ hashFiles('**/commit.txt') }} |
| 100 | + - name: make release directory |
| 101 | + run: mkdir C:\gtk-build\gtk\x64\release |
| 102 | + shell: cmd |
| 103 | + if: steps.cache.outputs.cache-hit == 'true' |
| 104 | + - name: move release files |
| 105 | + run: xcopy /e /i release C:\gtk-build\gtk\x64\release |
| 106 | + shell: cmd |
| 107 | + if: steps.cache.outputs.cache-hit == 'true' |
| 108 | + - name: debug tree |
| 109 | + run: tree C:\gtk-build\gtk\x64\release |
| 110 | + shell: cmd |
| 111 | + if: steps.cache.outputs.cache-hit == 'true' |
| 112 | + # if there was a cache miss, clone |
| 113 | + - name: gvsbuild |
| 114 | + run: git clone https://github.com/wingtk/gvsbuild.git C:\gtk-build\github\gvsbuild |
| 115 | + if: steps.cache.outputs.cache-hit != 'true' |
| 116 | + # remove git's bin, there are conflicting cygwin dll's |
| 117 | + - name: remove Git |
| 118 | + run: rmdir "C:\Program Files\Git\usr\bin" /s /q |
| 119 | + shell: cmd |
| 120 | + # fetch gtk dependencies |
| 121 | + - name: GTK development librarys |
| 122 | + run: python .\build.py build -p=x64 --vs-ver=16 --msys-dir=C:\msys64 -k --enable-gi --py-wheel --py-egg gtk3 gdk-pixbuf |
| 123 | + working-directory: C:\gtk-build\github\gvsbuild |
| 124 | + if: steps.cache.outputs.cache-hit != 'true' |
| 125 | + - name: Add gvsbuild bin directory to Path |
| 126 | + run: echo "::add-path::C:\gtk-build\gtk\x64\release\bin" |
| 127 | + # build |
| 128 | + - name: build |
| 129 | + run: cargo build |
| 130 | + # test |
| 131 | + - name: test |
| 132 | + run: cargo test -- --nocapture |
| 133 | + # copy lib files for cacheing |
| 134 | + - name: make release folder |
| 135 | + run: mkdir release |
| 136 | + shell: cmd |
| 137 | + if: steps.cache.outputs.cache-hit != 'true' |
| 138 | + - name: move release files |
| 139 | + run: xcopy /e /i C:\gtk-build\gtk\x64\release %cd%\release |
| 140 | + shell: cmd |
| 141 | + if: steps.cache.outputs.cache-hit != 'true' |
| 142 | + |
0 commit comments