|
| 1 | +name: Build and test Linux |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ "master" ] |
| 6 | + paths: |
| 7 | + - 'src/Build/Include/Makefile.inc' |
| 8 | + - 'src/Build/CMakeLists.txt' |
| 9 | + - 'src/Build/build_cmake_deb.sh' |
| 10 | + - 'src/Common/*.h' |
| 11 | + - 'src/Common/*.cpp' |
| 12 | + - 'src/Common/*.c' |
| 13 | + - 'src/Core/**' |
| 14 | + - 'src/Crypto/**' |
| 15 | + - 'src/Driver/Fuse/**' |
| 16 | + - 'src/Main/**' |
| 17 | + - 'src/PKCS11/**' |
| 18 | + - 'src/Platform/**' |
| 19 | + - 'src/Resources/**' |
| 20 | + - 'src/Setup/Linux/**' |
| 21 | + - 'src/Volume/**' |
| 22 | + - 'src/Makefile' |
| 23 | + - '.github/workflows/build-linux.yml' |
| 24 | + pull_request: |
| 25 | + branches: [ "master" ] |
| 26 | + paths: |
| 27 | + - 'src/Build/Include/Makefile.inc' |
| 28 | + - 'src/Build/CMakeLists.txt' |
| 29 | + - 'src/Build/build_cmake_deb.sh' |
| 30 | + - 'src/Common/*.h' |
| 31 | + - 'src/Common/*.cpp' |
| 32 | + - 'src/Common/*.c' |
| 33 | + - 'src/Core/**' |
| 34 | + - 'src/Crypto/**' |
| 35 | + - 'src/Driver/Fuse/**' |
| 36 | + - 'src/Main/**' |
| 37 | + - 'src/PKCS11/**' |
| 38 | + - 'src/Platform/**' |
| 39 | + - 'src/Resources/**' |
| 40 | + - 'src/Setup/Linux/**' |
| 41 | + - 'src/Volume/**' |
| 42 | + - 'src/Makefile' |
| 43 | + - '.github/workflows/build-linux.yml' |
| 44 | + |
| 45 | +concurrency: |
| 46 | + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} |
| 47 | + cancel-in-progress: true |
| 48 | + |
| 49 | +env: |
| 50 | + WXWIDGETS_VERSION: 3.2.5 |
| 51 | + |
| 52 | +jobs: |
| 53 | + ubuntu-build: |
| 54 | + |
| 55 | + runs-on: ubuntu-22.04 |
| 56 | + timeout-minutes: 30 |
| 57 | + |
| 58 | + steps: |
| 59 | + - name: Checkout repository |
| 60 | + uses: actions/checkout@v4 |
| 61 | + |
| 62 | + - name: Generate cache key |
| 63 | + id: cache-key |
| 64 | + run: | |
| 65 | + echo "cache_key=$(echo ${{ env.WXWIDGETS_VERSION }}-$(sha256sum src/Makefile .github/workflows/build-linux.yml | awk '{print $1}'))" >> $GITHUB_OUTPUT |
| 66 | +
|
| 67 | + - name: Cache wxBuildConsole |
| 68 | + uses: actions/cache@v3 |
| 69 | + id: cache-wxbuildconsole |
| 70 | + with: |
| 71 | + path: /tmp/wxBuildConsole |
| 72 | + key: wxBuildConsole-${{ steps.cache-key.outputs.cache_key }} |
| 73 | + |
| 74 | + - name: Cache wxBuildGUI |
| 75 | + uses: actions/cache@v3 |
| 76 | + id: cache-wxbuildgui |
| 77 | + with: |
| 78 | + path: /tmp/wxBuildGUI |
| 79 | + key: wxBuildGUI-${{ steps.cache-key.outputs.cache_key }} |
| 80 | + |
| 81 | + - name: Cache wxWidgets |
| 82 | + uses: actions/cache@v3 |
| 83 | + id: cache-wxwidgets |
| 84 | + with: |
| 85 | + path: /tmp/wxWidgets-${{ env.WXWIDGETS_VERSION }} |
| 86 | + key: wxWidgets-${{ steps.cache-key.outputs.cache_key }} |
| 87 | + |
| 88 | + - name: Install dependencies |
| 89 | + run: sudo apt-get update && sudo apt-get install -y wget tar libpcsclite-dev libfuse-dev yasm libgtk-3-dev libayatana-appindicator3-dev cmake debhelper |
| 90 | + |
| 91 | + - name: Download and extract wxWidgets to /tmp if build folders are missing |
| 92 | + if: steps.cache-wxbuildconsole.outputs.cache-hit != 'true' || steps.cache-wxbuildgui.outputs.cache-hit != 'true' || steps.cache-wxwidgets.outputs.cache-hit != 'true' |
| 93 | + run: | |
| 94 | + wget https://github.com/wxWidgets/wxWidgets/releases/download/v${{ env.WXWIDGETS_VERSION }}/wxWidgets-${{ env.WXWIDGETS_VERSION }}.tar.bz2 -O /tmp/wxWidgets-${{ env.WXWIDGETS_VERSION }}.tar.bz2 |
| 95 | + mkdir -p /tmp/wxWidgets-${{ env.WXWIDGETS_VERSION }} |
| 96 | + tar -xjf /tmp/wxWidgets-${{ env.WXWIDGETS_VERSION }}.tar.bz2 -C /tmp/wxWidgets-${{ env.WXWIDGETS_VERSION }} --strip-components=1 |
| 97 | +
|
| 98 | + - name: Build VeraCrypt .deb packages |
| 99 | + run: | |
| 100 | + chmod +x src/Build/build_cmake_deb.sh |
| 101 | + src/Build/build_cmake_deb.sh WXSTATIC INDICATOR |
| 102 | +
|
| 103 | + - name: Upload GUI .deb packages |
| 104 | + uses: actions/upload-artifact@v3 |
| 105 | + with: |
| 106 | + name: veracrypt-gui-debs |
| 107 | + path: /tmp/VeraCrypt_Packaging/GUI/Packaging/veracrypt-*.* |
| 108 | + |
| 109 | + - name: Upload Console .deb packages |
| 110 | + uses: actions/upload-artifact@v3 |
| 111 | + with: |
| 112 | + name: veracrypt-console-debs |
| 113 | + path: /tmp/VeraCrypt_Packaging/Console/Packaging/veracrypt-console-*.* |
| 114 | + |
| 115 | + - name: Install and test VeraCrypt GUI .deb packages |
| 116 | + run: | |
| 117 | + sudo apt install -y /tmp/VeraCrypt_Packaging/GUI/Packaging/veracrypt-*.deb |
| 118 | + veracrypt --text --test && veracrypt --text --version |
| 119 | + sudo veracrypt --text --non-interactive Tests/test.sha256.hc --hash sha256 --slot 1 --password test --mount-options=ro |
| 120 | + sudo veracrypt --text --non-interactive Tests/test.sha512.hc --hash sha512 --slot 2 --password test --mount-options=ro |
| 121 | + sudo veracrypt --text --non-interactive Tests/test.streebog.hc --hash streebog --slot 3 --password test --mount-options=ro |
| 122 | + sudo veracrypt --text --non-interactive Tests/test.whirlpool.hc --hash whirlpool --slot 4 --password test --mount-options=ro |
| 123 | + sudo veracrypt --text --list |
| 124 | + echo -n "Dummy" > /tmp/expected_content.txt |
| 125 | + if cmp -s /media/veracrypt1/Dummy.txt /tmp/expected_content.txt; then |
| 126 | + echo "Content of test.sha256.hc is valid." |
| 127 | + else |
| 128 | + echo "Content of test.sha256.hc is invalid!" |
| 129 | + exit 1 |
| 130 | + fi |
| 131 | + if cmp -s /media/veracrypt2/Dummy.txt /tmp/expected_content.txt; then |
| 132 | + echo "Content of test.sha512.hc is valid." |
| 133 | + else |
| 134 | + echo "Content of test.sha512.hc is invalid!" |
| 135 | + exit 1 |
| 136 | + fi |
| 137 | + if cmp -s /media/veracrypt3/Dummy.txt /tmp/expected_content.txt; then |
| 138 | + echo "Content of test.streebog.hc is valid." |
| 139 | + else |
| 140 | + echo "Content of test.streebog.hc is invalid!" |
| 141 | + exit 1 |
| 142 | + fi |
| 143 | + if cmp -s /media/veracrypt4/Dummy.txt /tmp/expected_content.txt; then |
| 144 | + echo "Content of test.whirlpool.hc is valid." |
| 145 | + else |
| 146 | + echo "Content of test.whirlpool.hc is invalid!" |
| 147 | + exit 1 |
| 148 | + fi |
| 149 | + sudo veracrypt -d |
| 150 | + sudo apt remove -y veracrypt |
| 151 | +
|
| 152 | + - name: Install and test VeraCrypt Console .deb packages |
| 153 | + run: | |
| 154 | + sudo apt install -y /tmp/VeraCrypt_Packaging/Console/Packaging/veracrypt-console-*.deb |
| 155 | + veracrypt --test && veracrypt --version |
| 156 | + sudo veracrypt --non-interactive Tests/test.sha256.hc --hash sha256 --slot 1 --password test --mount-options=ro |
| 157 | + sudo veracrypt --non-interactive Tests/test.sha512.hc --hash sha512 --slot 2 --password test --mount-options=ro |
| 158 | + sudo veracrypt --non-interactive Tests/test.streebog.hc --hash streebog --slot 3 --password test --mount-options=ro |
| 159 | + sudo veracrypt --non-interactive Tests/test.whirlpool.hc --hash whirlpool --slot 4 --password test --mount-options=ro |
| 160 | + sudo veracrypt --list |
| 161 | + echo -n "Dummy" > /tmp/expected_content.txt |
| 162 | + if cmp -s /media/veracrypt1/dummy.txt /tmp/expected_content.txt; then |
| 163 | + echo "Content of test.sha256.hc is valid." |
| 164 | + else |
| 165 | + echo "Content of test.sha256.hc is invalid!" |
| 166 | + exit 1 |
| 167 | + fi |
| 168 | + if cmp -s /media/veracrypt2/dummy.txt /tmp/expected_content.txt; then |
| 169 | + echo "Content of test.sha512.hc is valid." |
| 170 | + else |
| 171 | + echo "Content of test.sha512.hc is invalid!" |
| 172 | + exit 1 |
| 173 | + fi |
| 174 | + if cmp -s /media/veracrypt3/dummy.txt /tmp/expected_content.txt; then |
| 175 | + echo "Content of test.streebog.hc is valid." |
| 176 | + else |
| 177 | + echo "Content of test.streebog.hc is invalid!" |
| 178 | + exit 1 |
| 179 | + fi |
| 180 | + if cmp -s /media/veracrypt4/dummy.txt /tmp/expected_content.txt; then |
| 181 | + echo "Content of test.whirlpool.hc is valid." |
| 182 | + else |
| 183 | + echo "Content of test.whirlpool.hc is invalid!" |
| 184 | + exit 1 |
| 185 | + fi |
| 186 | + sudo veracrypt -d |
| 187 | + sudo apt remove -y veracrypt-console |
| 188 | +
|
| 189 | + - name: Cleanup old caches |
| 190 | + uses: actions/github-script@v6 |
| 191 | + if: always() |
| 192 | + with: |
| 193 | + github-token: ${{ secrets.GITHUB_TOKEN }} |
| 194 | + script: | |
| 195 | + const caches = await github.rest.actions.getActionsCacheList({ |
| 196 | + owner: context.repo.owner, |
| 197 | + repo: context.repo.repo, |
| 198 | + }) |
| 199 | + for (const cache of caches.data.actions_caches) { |
| 200 | + if (cache.key.startsWith('wxBuildConsole-') || cache.key.startsWith('wxBuildGUI-') || cache.key.startsWith('wxWidgets-')) { |
| 201 | + if (cache.key !== `wxBuildConsole-${{ steps.cache-key.outputs.cache_key }}` && |
| 202 | + cache.key !== `wxBuildGUI-${{ steps.cache-key.outputs.cache_key }}` && |
| 203 | + cache.key !== `wxWidgets-${{ steps.cache-key.outputs.cache_key }}`) { |
| 204 | + console.log(`Deleting cache with key: ${cache.key}`) |
| 205 | + await github.rest.actions.deleteActionsCacheById({ |
| 206 | + owner: context.repo.owner, |
| 207 | + repo: context.repo.repo, |
| 208 | + cache_id: cache.id, |
| 209 | + }) |
| 210 | + } |
| 211 | + } |
| 212 | + } |
| 213 | +
|
0 commit comments