Skip to content

Commit 9c977bb

Browse files
committed
Move from Travis to GitHub Actions for CI/CD
1 parent 40a7fda commit 9c977bb

File tree

11 files changed

+137
-136
lines changed

11 files changed

+137
-136
lines changed

.github/workflows/ci.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
on: [push, pull_request]
2+
jobs:
3+
ci:
4+
name: CI
5+
strategy:
6+
matrix:
7+
go-version: [1.16.x]
8+
os: [ubuntu-latest, macos-latest, windows-latest]
9+
runs-on: ${{ matrix.os }}
10+
steps:
11+
12+
- name: 'Install Go'
13+
uses: actions/setup-go@v2
14+
with:
15+
go-version: ${{ matrix.go-version }}
16+
17+
- name: Checkout
18+
uses: actions/checkout@v2
19+
20+
- name: Build
21+
run: make build
22+
23+
- name: 'Bundle Zip'
24+
if: github.repository == 'Crunchydata/pg_tileserv' && github.ref_name == 'master'
25+
env:
26+
MATRIX_OS: ${{ matrix.os }}
27+
run: ./ci/github-bundle.sh
28+
shell: bash
29+
30+
- name: 'Login to AWS'
31+
if: github.repository == 'Crunchydata/pg_tileserv' && github.ref_name == 'master'
32+
uses: aws-actions/configure-aws-credentials@v1
33+
with:
34+
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
35+
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
36+
aws-region: us-east-1
37+
38+
- name: 'Upload Zip'
39+
if: github.repository == 'Crunchydata/pg_tileserv' && github.ref_name == 'master'
40+
run: aws s3 sync ./upload s3://postgisftw

.github/workflows/docker.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
on:
2+
push:
3+
branches:
4+
- master
5+
6+
jobs:
7+
docker:
8+
name: Docker
9+
runs-on: ubuntu-latest
10+
if: github.repository == 'Crunchydata/pg_tileserv'
11+
steps:
12+
13+
- name: Install Go
14+
uses: actions/setup-go@v2
15+
with:
16+
go-version: 1.16.x
17+
18+
- name: Checkout
19+
uses: actions/checkout@v2
20+
21+
- name: Build
22+
run: make build && make build-docker
23+
24+
- name: Docker Upload
25+
env:
26+
DOCKER_USER: ${{ secrets.DOCKER_USER }}
27+
DOCKER_PASS: ${{ secrets.DOCKER_PASS }}
28+
DOCKER_REPO: pramsey/pg_tileserv
29+
run: ./ci/github-docker.sh

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,6 @@ pg_tileserv.exe
33
*.code-workspace
44
docs/
55
public/
6+
config/pg_tileserv*.toml
7+
server.crt
8+
server.key

.travis.yml

Lines changed: 0 additions & 62 deletions
This file was deleted.

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Builds of the latest code:
2020

2121
* [Linux](https://postgisftw.s3.amazonaws.com/pg_tileserv_latest_linux.zip)
2222
* [Windows](https://postgisftw.s3.amazonaws.com/pg_tileserv_latest_windows.zip)
23-
* [OSX](https://postgisftw.s3.amazonaws.com/pg_tileserv_latest_osx.zip)
23+
* [MacOS](https://postgisftw.s3.amazonaws.com/pg_tileserv_latest_macos.zip)
2424
* [Docker](https://hub.docker.com/r/pramsey/pg_tileserv)
2525

2626
## Basic Operation
@@ -29,7 +29,7 @@ The executable will read user/connection information from the `DATABASE_URL` and
2929

3030
For **production deployment**, place an HTTP proxy caching layer (eg [Varnish](https://varnish-cache.org/)) in between the tile server and clients to reduce database load and increase application performance.
3131

32-
### Linux/OSX
32+
### Linux/MacOS
3333

3434
```sh
3535
export DATABASE_URL=postgresql://username:password@host/dbname

ci/github-bundle.sh

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#!/bin/bash
2+
3+
# Exit on failure
4+
set -e
5+
6+
echo "GITHUB_REF_NAME = $GITHUB_REF_NAME"
7+
echo "MATRIX_OS = $MATRIX_OS"
8+
9+
if [ "$MATRIX_OS" = "ubuntu-latest" ]; then
10+
TARGET="linux"
11+
elif [ "$MATRIX_OS" = "macos-latest" ]; then
12+
TARGET="macos"
13+
elif [ "$MATRIX_OS" = "windows-latest" ]; then
14+
TARGET="windows"
15+
else
16+
echo "ERROR: Unsupported OS, $MATRIX_OS"
17+
exit 1
18+
fi
19+
20+
if [ "$GITHUB_REF_NAME" = "master" ]; then
21+
TAG="latest"
22+
else
23+
TAG=$GITHUB_REF_NAME
24+
fi
25+
26+
if [ "$MATRIX_OS" = "windows-latest" ]; then
27+
BINARY=pg_tileserv.exe
28+
else
29+
BINARY=pg_tileserv
30+
fi
31+
32+
PAYLOAD="${BINARY} README.md LICENSE.md assets/ config/"
33+
ZIPFILE="pg_tileserv_${TAG}_${TARGET}.zip"
34+
35+
echo "ZIPFILE = $ZIPFILE"
36+
echo "PAYLOAD = $PAYLOAD"
37+
38+
mkdir upload
39+
#zip -r upload/$ZIPFILE $PAYLOAD
40+
7z a upload/$ZIPFILE $PAYLOAD

ci/github-docker.sh

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/bin/bash
2+
3+
# Exit on failure
4+
set -e
5+
6+
DATE=`date +%Y%m%d`
7+
8+
echo "GITHUB_REF_NAME = $GITHUB_REF_NAME"
9+
echo "GITHUB_HEAD_REF = $GITHUB_HEAD_REF"
10+
echo "DOCKER_REPO = $DOCKER_REPO"
11+
echo "DATE = $DATE"
12+
13+
if [ "$GITHUB_REF_NAME" = "master" ]; then
14+
TAG="latest"
15+
else
16+
TAG=$GITHUB_REF_NAME
17+
fi
18+
19+
if [ "$GITHUB_REF_NAME" = "master" ] && [ "$GITHUB_HEAD_REF"x = "x" ]; then
20+
echo "Logging in..."
21+
echo $DOCKER_PASS | docker login -u $DOCKER_USER --password-stdin
22+
docker push $DOCKER_REPO
23+
fi

ci/travis-after-success.sh

Lines changed: 0 additions & 31 deletions
This file was deleted.

ci/travis-build.sh

Lines changed: 0 additions & 9 deletions
This file was deleted.

ci/travis-docs-deploy.sh

Lines changed: 0 additions & 18 deletions
This file was deleted.

0 commit comments

Comments
 (0)