Skip to content
This repository has been archived by the owner on Feb 7, 2025. It is now read-only.

Commit

Permalink
Merge pull request #63 from silinternational/feature/use-github-actions
Browse files Browse the repository at this point in the history
Use GitHub actions
  • Loading branch information
jason-jackson authored Feb 22, 2024
2 parents f833e8e + 3e18dfe commit 7ac3941
Show file tree
Hide file tree
Showing 8 changed files with 115 additions and 149 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/test-and-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Test and Publish

on:
push:

jobs:
test-app:
name: Test App
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Run tests
run: docker-compose -f docker-compose.test.yml run --rm test ./run-tests.sh

build-and-publish:
name: Build and Publish
needs: test-app
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ vars.DOCKER_ORG }}/auth-proxy
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ caddy

# Local env files
*.env
!test.env
!*example.env

# Other files
Expand Down
56 changes: 0 additions & 56 deletions codeship-services.yml

This file was deleted.

21 changes: 0 additions & 21 deletions codeship-steps.yml

This file was deleted.

73 changes: 73 additions & 0 deletions docker-compose.test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
version: "3.7"

# Use extension fields, see https://docs.docker.com/compose/compose-file/11-extension/
x-common-variables: &test-variables
HOST: http://testapp
COOKIE_NAME: _proxy
TOKEN_SECRET: Rm9yIEdvZCBzbyBsb3ZlZCB0aGUgd29ybGQgdGhhdCBoZSBnYXZlIGhpcyBvbmUgYW5kIG9ubHkgU29uLCB0aGF0IHdob2V2ZXIgYmVsaWV2ZXMgaW4gaGltIHNoYWxsIG5vdCBwZXJpc2ggYnV0IGhhdmUgZXRlcm5hbCBsaWZlLiAtIEpvaG4gMzoxNg==
SITES: one:server1:80,two:server2:80,three:server3:80
MANAGEMENT_API: http://fakemanagementapi:80

services:
testapp:
build:
context: .
dockerfile: Dockerfile-dev
ports:
- "53063:80"
environment: *test-variables
volumes:
- ./:/app

test:
build:
context: .
dockerfile: Dockerfile-test
depends_on:
- testapp
- fakemanagementapi
- server1
- server2
- server3
environment: *test-variables
volumes:
- .:/src
- go-build:/root/.cache/go-build
- go-mod:/go/pkg/mod
working_dir: /src

fakemanagementapi:
image: caddy:2
environment:
SERVER: API
volumes:
- ./Caddyfile-test:/srv/Caddyfile
command: caddy run

server1:
image: caddy:2
environment:
SERVER: server1
volumes:
- ./Caddyfile-test:/srv/Caddyfile
command: caddy run

server2:
image: caddy:2
environment:
SERVER: server2
volumes:
- ./Caddyfile-test:/srv/Caddyfile
command: caddy run

server3:
image: caddy:2
environment:
SERVER: server3
volumes:
- ./Caddyfile-test:/srv/Caddyfile
command: caddy run

volumes:
go-build: {}
go-mod: {}
66 changes: 3 additions & 63 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
version: "3.7"

include:
- docker-compose.test.yml

services:
app:
build:
Expand All @@ -14,66 +17,3 @@ services:
- ./:/app
- go-build:/root/.cache/go-build
- go-mod:/go/pkg/mod

testapp:
build:
context: .
dockerfile: Dockerfile-dev
ports:
- "53063:80"
env_file: test.env
volumes:
- ./:/app

test:
build:
context: .
dockerfile: Dockerfile-test
env_file: test.env
volumes:
- .:/src
- go-build:/root/.cache/go-build
- go-mod:/go/pkg/mod
working_dir: /src
depends_on:
- testapp
- fakemanagementapi
- server1
- server2
- server3

fakemanagementapi:
image: caddy:2
environment:
SERVER: API
volumes:
- ./Caddyfile-test:/srv/Caddyfile
command: caddy run

server1:
image: caddy:2
environment:
SERVER: server1
volumes:
- ./Caddyfile-test:/srv/Caddyfile
command: caddy run

server2:
image: caddy:2
environment:
SERVER: server2
volumes:
- ./Caddyfile-test:/srv/Caddyfile
command: caddy run

server3:
image: caddy:2
environment:
SERVER: server3
volumes:
- ./Caddyfile-test:/srv/Caddyfile
command: caddy run

volumes:
go-build: {}
go-mod: {}
2 changes: 0 additions & 2 deletions dockercfg.encrypted

This file was deleted.

6 changes: 0 additions & 6 deletions test.env

This file was deleted.

0 comments on commit 7ac3941

Please sign in to comment.