-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CI Fix: use docker for linux and local for mac and windows (#14)
- Loading branch information
Showing
10 changed files
with
131 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
on: | ||
push: | ||
branches: [ main, develop ] | ||
pull_request: | ||
branches: [ main ] | ||
name: Test-MacOs | ||
jobs: | ||
test: | ||
runs-on: macos-latest | ||
steps: | ||
- name: Install Go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: 1.16 | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
- name: Setup config script | ||
# using locals for mac-OS because github CI mac platforms don't have docker | ||
run: make prep-ci-local | ||
- name: Test | ||
run: go test -v ./... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
on: | ||
push: | ||
branches: [ main, develop ] | ||
pull_request: | ||
branches: [ main ] | ||
name: Test-Linux | ||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Install Go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: 1.16 | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
- name: Setup SSH server and config | ||
# run docker ssh container for ssh tests | ||
run: make prep-ci-ssh | ||
- name: Test | ||
run: go test -v ./... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
on: | ||
push: | ||
branches: [ main, develop ] | ||
pull_request: | ||
branches: [ main ] | ||
name: Test-Windows | ||
jobs: | ||
test: | ||
runs-on: windows-latest | ||
steps: | ||
- name: Install Go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: 1.16 | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
- name: Choco Install make | ||
uses: crazy-max/ghaction-chocolatey@v1 | ||
with: | ||
args: install make | ||
- name: Setup config script | ||
# using locals for Windows because github CI Windows platforms don't have docker | ||
run: make prep-ci-local-windows | ||
- name: Test | ||
run: go test -v ./... |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,3 +11,6 @@ vendor/ | |
*.swp | ||
|
||
docker-compose.yaml | ||
ssh-key/ci/ | ||
config-ci.yaml | ||
config-test.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Example: | ||
# make | ||
# make prep-ci-ssh | ||
.PHONY: prep-ci-ssh | ||
# Creates the ssh keys and docker container for running test | ||
prep-ci-ssh: | ||
./scripts/prep-test-ssh.sh | ||
cat config-test.yaml | ||
|
||
.PHONY: prep-ci-locals | ||
prep-ci-local: | ||
cp ./scripts/config.local.yaml config-test.yaml | ||
cat config-test.yaml | ||
|
||
.PHONY: prep-ci-local-windows | ||
# Because we are using make, we can use linux cp and cat commands | ||
prep-ci-local-windows: | ||
cp ".\scripts\config.local.yaml" ".\config-test.yaml" | ||
cat config-test.yaml | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Config file for local connection | ||
hosts: | ||
children: | ||
"127.0.0.1": | ||
connection: | ||
type: local | ||
|
||
metrics: | ||
- memory | ||
- cpu | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
set -e | ||
# Creates a docker container with ssh and a config file for connecting to it | ||
SSH_KEY_NAME=${SSH_KEY_NAME:-ci-test-key} | ||
SSH_KEY_PATH=$(pwd)/ssh-key/ci | ||
SSH_USER=ci-dev | ||
rm -rf $SSH_KEY_PATH | ||
mkdir -p $SSH_KEY_PATH | ||
ssh-keygen -f "$SSH_KEY_PATH/${SSH_KEY_NAME}" -N "" | ||
docker kill saido-linux-sshserver | true | ||
docker run -d -p 2222:2222 -e USER_NAME=$SSH_USER --name saido-linux-sshserver -v ${SSH_KEY_PATH}/${SSH_KEY_NAME}.pub:/config/.ssh/authorized_keys linuxserver/openssh-server | ||
cat <<EOF > config-test.yaml | ||
hosts: | ||
children: | ||
"$(docker inspect -f "{{ .NetworkSettings.IPAddress }}" saido-linux-sshserver)": | ||
connection: | ||
type: ssh | ||
port: 2222 | ||
username: ${SSH_USER} | ||
private_key_path: $(pwd)/${SSH_KEY_NAME} | ||
"127.0.0.1": | ||
connection: | ||
type: local | ||
metrics: | ||
- memory | ||
- cpu | ||
EOF |