|
| 1 | +# |
| 2 | +# File: %linux-gcc-build.yml |
| 3 | +# |
| 4 | +#=============================================================================# |
| 5 | +# |
| 6 | +# This does Linux builds on GitHub's Ubuntu container, using gcc. |
| 7 | +# |
| 8 | + |
| 9 | +name: Linux GCC |
| 10 | + |
| 11 | + |
| 12 | +# When To Trigger Builds |
| 13 | +# |
| 14 | +on: |
| 15 | + push: |
| 16 | + branches: [ |
| 17 | + master, # for now do a linux build on every push to master |
| 18 | + linux, # pushing to a branch called "linux" builds this |
| 19 | + github-workflow # specifically pushing github-workflow branch |
| 20 | + ] |
| 21 | + pull_request: |
| 22 | + branches: [ |
| 23 | + master |
| 24 | + ] |
| 25 | + workflow_dispatch: # Allows running this workflow manually from Actions tab |
| 26 | + |
| 27 | + |
| 28 | +# Standardize to use bash on all platforms. |
| 29 | +# |
| 30 | +defaults: |
| 31 | + run: |
| 32 | + shell: bash |
| 33 | + |
| 34 | + |
| 35 | +# Each "Job" runs in its own VM, and a workflow run is made up of one or more |
| 36 | +# jobs that can run sequentially or in parallel. |
| 37 | +# |
| 38 | +jobs: |
| 39 | + linux-gcc-build: # Name of this workflow's only job |
| 40 | + |
| 41 | + # https://github.com/actions/virtual-environments#available-environments |
| 42 | + # |
| 43 | + # Building on older available Ubuntus means the GLIBC used by the EXE will |
| 44 | + # run on newer Ubuntus. The reverse is not true. |
| 45 | + # |
| 46 | + runs-on: ubuntu-20.04 |
| 47 | + |
| 48 | + |
| 49 | + # Build Matrix (add as many permutations as desired) |
| 50 | + # |
| 51 | + strategy: |
| 52 | + matrix: |
| 53 | + include: |
| 54 | + - rigorous: ON |
| 55 | + build_type: Debug |
| 56 | + sanitize: ON |
| 57 | + |
| 58 | + - rigorous: ON |
| 59 | + build_type: Release |
| 60 | + sanitize: OFF |
| 61 | + |
| 62 | + |
| 63 | + # Environment Variables |
| 64 | + # |
| 65 | + # (Proxy build matrix variables to environment variables so that behavior |
| 66 | + # in script code used here doesn't need GitHub-Workflow-specific syntax) |
| 67 | + # |
| 68 | + env: |
| 69 | + RIGOROUS: ${{ matrix.rigorous }} |
| 70 | + BUILD_TYPE: ${{ matrix.build_type }} |
| 71 | + SANITIZE: ${{ matrix.sanitize }} |
| 72 | + |
| 73 | + |
| 74 | + # Steps are a sequence of tasks that will be executed within a single VM |
| 75 | + # as part of the job. |
| 76 | + # |
| 77 | + steps: # (no indentatation needed below; so indent the minimum!) |
| 78 | + |
| 79 | + |
| 80 | + #====# CHECKOUT STEPS #=====================================================# |
| 81 | + |
| 82 | + |
| 83 | + # Checkout Action |
| 84 | + # |
| 85 | + # https://github.com/actions/checkout |
| 86 | + # |
| 87 | + - uses: actions/checkout@v4 |
| 88 | + with: |
| 89 | + path: "bezitopo/" |
| 90 | + |
| 91 | + |
| 92 | + # Portably Capture Git Hashes |
| 93 | + # |
| 94 | + - name: Grab Git Hash and Short Hash Into Environment Variables |
| 95 | + run: | |
| 96 | + cd bezitopo |
| 97 | + git_commit="$(git show --format="%H" --no-patch)" |
| 98 | + git_commit_short="$(git show --format="%h" --no-patch)" |
| 99 | + echo "GIT_COMMIT=$git_commit" >> $GITHUB_ENV |
| 100 | + echo "GIT_COMMIT_SHORT=$git_commit_short" >> $GITHUB_ENV |
| 101 | +
|
| 102 | +
|
| 103 | + #====# TOOLCHAIN INSTALLATION STEPS #=======================================# |
| 104 | + |
| 105 | + |
| 106 | + # Install Qt Libraries |
| 107 | + # |
| 108 | + # https://github.com/jurplel/install-qt-action |
| 109 | + # |
| 110 | + - name: Install Qt |
| 111 | + uses: jurplel/install-qt-action@v4 |
| 112 | + with: |
| 113 | + aqtversion: '==3.1.*' |
| 114 | + version: '5.15.2' |
| 115 | + host: 'linux' |
| 116 | + target: 'desktop' |
| 117 | + arch: 'gcc_64' |
| 118 | + cache: 'true' |
| 119 | + cache-key-prefix: 'install-qt-action' |
| 120 | + |
| 121 | + |
| 122 | + # Install OpenGL Dependencies |
| 123 | + # |
| 124 | + # Mesa is an open-source implementation of the OpenGL specification for 3D |
| 125 | + # graphics. GLU is the OpenGL Utility library, which includes higher-level |
| 126 | + # drawing routines and support for NURBS (Non-Uniform Rational B-Splines) |
| 127 | + # |
| 128 | + - name: Install Mesa Common and GLU Libraries |
| 129 | + run: | |
| 130 | + sudo apt install mesa-common-dev libglu1-mesa-dev |
| 131 | +
|
| 132 | +
|
| 133 | + # Show a little bit of sanity check information. |
| 134 | + # |
| 135 | + - name: Output System Information |
| 136 | + run: | |
| 137 | + echo "GCC version check:" |
| 138 | + gcc -v |
| 139 | +
|
| 140 | +
|
| 141 | + #====# BUILD STEPS #========================================================# |
| 142 | + |
| 143 | + |
| 144 | + # Generate Makefile |
| 145 | + # |
| 146 | + # Note: Should not have to set -DCMAKE_PREFIX_PATH=<...> as the GitHub |
| 147 | + # Action that installed Qt is supposed to set the enviornment correctly. |
| 148 | + # |
| 149 | + - name: Use CMake to Generate a makefile |
| 150 | + run: | |
| 151 | + mkdir build |
| 152 | + cd build |
| 153 | +
|
| 154 | + cmake \ |
| 155 | + -DRIGOROUS=$RIGOROUS \ |
| 156 | + -DSANITIZE=$SANITIZE \ |
| 157 | + -DCMAKE_BUILD_TYPE=$BUILD_TYPE \ |
| 158 | + ../bezitopo/ # directory containing CMakeLists.txt |
| 159 | +
|
| 160 | +
|
| 161 | + # Run Make |
| 162 | + # |
| 163 | + # At time of writing, 2 jobs is the most the GitHub Workflow runners do. |
| 164 | + # |
| 165 | + - name: Run Make |
| 166 | + working-directory: build/ |
| 167 | + run: | |
| 168 | + make -j 2 |
| 169 | +
|
| 170 | +
|
| 171 | + # https://github.com/actions/upload-artifact |
| 172 | + # |
| 173 | + - name: Optional Download of Build Files Before Tests |
| 174 | + if: false # Change this to true to download a file |
| 175 | + uses: actions/upload-artifact@v4 |
| 176 | + with: |
| 177 | + name: downloaded-file-name.ext |
| 178 | + path: build/some-file.ext |
| 179 | + |
| 180 | + |
| 181 | + #====# TESTING STEPS #======================================================# |
| 182 | + |
| 183 | + - name: Basic Smoke Test (Run Bezitopo and Exit) |
| 184 | + working-directory: build/ |
| 185 | + run: | |
| 186 | + echo "exit" | ./bezitopo |
| 187 | +
|
| 188 | +
|
| 189 | + - name: Fetch Independence Park File From Website |
| 190 | + working-directory: build/ |
| 191 | + run: | |
| 192 | + curl -o topo0.asc http://bezitopo.org/topo0.asc |
| 193 | +
|
| 194 | +
|
| 195 | + - name: Test Independence Park Processing Command |
| 196 | + working-directory: build/ |
| 197 | + run: | |
| 198 | + (echo "indpark"; echo "exit") | ./bezitopo |
| 199 | +
|
| 200 | +
|
| 201 | + - name: Run Bezitest |
| 202 | + if: false # !!! At time of writing, bezitest segfaults |
| 203 | + working-directory: build/ |
| 204 | + run: | |
| 205 | + ./bezitest |
| 206 | +
|
| 207 | +
|
| 208 | + #====# DEPLOY STEPS (TBD) #==================================================# |
| 209 | + |
| 210 | + # !!! This is how you would do deployments of the build products to AWS if |
| 211 | + # that were something you wanted to do. |
| 212 | + |
| 213 | + |
| 214 | + # Configure AWS Credentials |
| 215 | + # |
| 216 | + # https://github.com/aws-actions/configure-aws-credentials |
| 217 | + # |
| 218 | + # This is disabled with `if: false`, but would be something along the |
| 219 | + # lines of `if: github.ref = 'refs/heads/master` |
| 220 | + # |
| 221 | + - name: Configure AWS Credentials |
| 222 | + if: false # disabled |
| 223 | + uses: aws-actions/configure-aws-credentials@v4 |
| 224 | + with: |
| 225 | + aws-access-key-id: ${{ secrets.YOUR_GITHUB_AWS_ACCESS_KEY }} |
| 226 | + aws-secret-access-key: ${{ secrets.YOUR_GITHUB_AWS_SECRET_KEY }} |
| 227 | + aws-region: us-east-1 |
| 228 | + |
| 229 | + |
| 230 | + # Upload Files to AWS |
| 231 | + # |
| 232 | + - name: Upload Files to AWS |
| 233 | + if: false # disabled |
| 234 | + run: | |
| 235 | + cd build |
| 236 | + NEW_NAME="bezitopo-${GIT_COMMIT_SHORT}${VARIATION}" |
| 237 | + MIME_TYPE="" # e.g. "--content-type application/wasm" |
| 238 | +
|
| 239 | + local=bezitopo |
| 240 | + lastpart=ci-builds/${NEW_NAME} |
| 241 | + remote=s3://${AWS_S3_BUCKET_NAME}/$lastpart |
| 242 | + aws s3 cp $local $remote $MIME_TYPE |
0 commit comments