forked from broamski/aws-mfa
-
Notifications
You must be signed in to change notification settings - Fork 0
76 lines (70 loc) · 1.97 KB
/
testworkflow.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# This workflow will build a golang project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go
name: Mock deploy workflow
on:
push:
branches: [ "master" ]
#pull_request:
# branches: [ "master" ]
workflow_dispatch:
inputs:
deployment_type:
description: 'Type of deployment'
required: true
default: "Development"
type: choice
options:
- Development
- Test
- Staging
- Production
env:
LOG_LEVEL: |
${{ fromJson('{ Development: "DEBUG", Production: "INFO" }')[github.event.inputs.deployment_type] }}
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.20'
- name: Build
run: echo 'Build some stuff'
- name: Test
run: echo 'Testing some stuff'
deploy:
runs-on: ubuntu-latest
needs: build
environment: ${{ github.event.inputs.deployment_type || 'Development' }}
steps:
- name: Output deploy type
run: echo 'Deploy type';echo '${{ github.event.inputs.deployment_type || 'Development' }}'
- name: Mock environmment deploy
run: echo "Deploy to ${{ vars.ACCOUNT_ID }} with log level $LOG_LEVEL. Shhh the secret is ${{ secrets.SECRET_PASSWORD_TEST }} (GitHub obsfucates this)"
test:
runs-on: ubuntu-latest
services:
docker:
image: docker:dind
options: --privileged --shm-size=2g
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
container:
image: ubuntu:latest
steps:
- name: Install Docker
run: |
apt-get update
apt-get install -y docker.io
- name: Test Docker
run: |
docker version
docker info
- uses: actions/checkout@v4
- name: Build and Run Docker
run: |
ls -la
docker build -t aws-mfa .
docker run aws-mfa