|
| 1 | +name: Build and Deploy |
| 2 | +on: |
| 3 | + pull_request: |
| 4 | + branches: |
| 5 | + - master |
| 6 | + push: |
| 7 | + branches: |
| 8 | + - master |
| 9 | + tags: '*' |
| 10 | +defaults: |
| 11 | + run: |
| 12 | + # default to use bash shell |
| 13 | + shell: bash |
| 14 | + |
| 15 | +jobs: |
| 16 | + test: |
| 17 | + name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }} |
| 18 | + runs-on: ${{ matrix.os }} |
| 19 | + |
| 20 | + env: |
| 21 | + COASTLINEDIR: ${{ github.workspace }}/coastline |
| 22 | + #JULIA_NUM_THREADS: 2 |
| 23 | + |
| 24 | + strategy: |
| 25 | + fail-fast: false |
| 26 | + matrix: |
| 27 | + version: |
| 28 | + #- '1.6' # Replace this with the minimum Julia version that your package supports. E.g. if your package requires Julia 1.5 or higher, change this to '1.5'. |
| 29 | + - '1.7' # Leave this line unchanged. '1' will automatically expand to the latest stable 1.x release of Julia. |
| 30 | + #- 'nightly' |
| 31 | + os: |
| 32 | + - ubuntu-latest |
| 33 | + #- ubuntu-18.04 |
| 34 | + #- macos-latest |
| 35 | + arch: |
| 36 | + - x64 |
| 37 | + include: |
| 38 | + # Linux |
| 39 | + - name: Linux - Compile only |
| 40 | + #os: ubuntu-18.04 |
| 41 | + os: ubuntu-latest |
| 42 | + run_in_pr : true |
| 43 | + #- name: macOS |
| 44 | + #os: macos-latest |
| 45 | + #run_in_pr : true |
| 46 | + |
| 47 | + steps: |
| 48 | + - name: Cancel Previous Runs |
| 49 | + |
| 50 | + with: |
| 51 | + access_token: ${{ github.token }} |
| 52 | + |
| 53 | + - name: Checkout |
| 54 | + uses: actions/checkout@v2 |
| 55 | + if: matrix.run_in_pr == true || github.event_name != 'pull_request' |
| 56 | + |
| 57 | + - name: Install GMT dependencies |
| 58 | + run: | |
| 59 | + # $RUNNER_OS can be Linux, macOS or Windows |
| 60 | + # The following command converts $RUNNER_OS to lowercase |
| 61 | + os=$(echo "$RUNNER_OS" | tr '[:upper:]' '[:lower:]') |
| 62 | + bash ci/install-dependencies-${os}.sh |
| 63 | + if: matrix.run_in_pr == true || github.event_name != 'pull_request' |
| 64 | + |
| 65 | + - name: Cache GSHHG and DCW data |
| 66 | + uses: actions/cache@v2 |
| 67 | + id: cache-coastline |
| 68 | + with: |
| 69 | + path: ${{ env.COASTLINEDIR }} |
| 70 | + key: coastline-${{ hashFiles('ci/download-coastlines.sh') }} |
| 71 | + if: matrix.run_in_pr == true || github.event_name != 'pull_request' |
| 72 | + |
| 73 | + - name: Install GMT |
| 74 | + run: | |
| 75 | + bash ci/build-gmt.sh |
| 76 | + # Add GMT PATH to bin |
| 77 | + GMT_INSTALL_DIR=${GMT_INSTALL_DIR:-${HOME}/gmt-install-dir} |
| 78 | + echo "${GMT_INSTALL_DIR}/bin" >> $GITHUB_PATH |
| 79 | + if: matrix.run_in_pr == true || github.event_name != 'pull_request' |
| 80 | + |
| 81 | + - name: Check a few simple commands |
| 82 | + run: | |
| 83 | + set -x -e |
| 84 | + gmt --version |
| 85 | + gmt --help |
| 86 | + gmt begin testmap; gmt basemap -R0/9/0/5 -Jx1 -Bf1a2 -Bx+lDistance -By+l"No of samples" -BWeS; gmt end |
| 87 | + if: matrix.run_in_pr == true || github.event_name != 'pull_request' |
| 88 | + |
| 89 | + - uses: actions/checkout@v2 |
| 90 | + - uses: julia-actions/setup-julia@v1 |
| 91 | + with: |
| 92 | + version: ${{ matrix.version }} |
| 93 | + arch: ${{ matrix.arch }} |
| 94 | + - uses: actions/cache@v1 |
| 95 | + env: |
| 96 | + cache-name: cache-artifacts |
| 97 | + with: |
| 98 | + path: ~/.julia/artifacts |
| 99 | + key: ${{ runner.os }}-test-${{ env.cache-name }}-${{ hashFiles('**/Project.toml') }} |
| 100 | + restore-keys: | |
| 101 | + ${{ runner.os }}-test-${{ env.cache-name }}- |
| 102 | + ${{ runner.os }}-test- |
| 103 | + ${{ runner.os }}- |
| 104 | + - uses: julia-actions/julia-buildpkg@v1 |
| 105 | + |
| 106 | + - run: julia -e ' |
| 107 | + using Pkg; |
| 108 | + Pkg.activate("."); |
| 109 | + Pkg.instantiate(); |
| 110 | + Pkg.add(PackageSpec(name="GMT", rev="master")); |
| 111 | + using NodeJS; |
| 112 | + run(`$(npm_cmd()) install highlight.js`); |
| 113 | + run(`$(npm_cmd()) install cheerio`); |
| 114 | + run(`$(npm_cmd()) install lunr`); |
| 115 | + using Franklin; |
| 116 | + serve(single=true, cleanup=false); |
| 117 | + lunr(); |
| 118 | + optimize(minify=false, prerender=false);' |
| 119 | + - name: Build and Deploy |
| 120 | + uses: JamesIves/github-pages-deploy-action@releases/v3 |
| 121 | + with: |
| 122 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 123 | + BRANCH: gh-pages |
| 124 | + FOLDER: __site |
0 commit comments