-
Notifications
You must be signed in to change notification settings - Fork 141
83 lines (83 loc) · 2.4 KB
/
test-workflow.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
77
78
79
80
81
82
83
on:
push:
branches:
- '**'
tags-ignore:
- '*.*'
pull_request:
branches:
- '**'
env:
factorio_password: ${{ secrets.FACTORIO_PASSWORD }}
factorio_username: ${{ secrets.FACTORIO_USERNAME }}
FSM_MODPACK_DIR: 'dev_pack'
FSM_DIR: '../'
FSM_CONF: '../../conf.json.example'
jobs:
test-npm:
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- run: make app/bundle
test-go:
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
go: ['1.18', '1.20', '1']
runs-on: ${{ matrix.os }}
name: test-go ${{ matrix.go }} (${{ matrix.os }})
steps:
- uses: actions/checkout@v2
- name: Setup go
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go }}
- if: contains(matrix.os, 'ubuntu')
run: |
cd src
if [[ -z "$factorio_password" ]]; then
echo "run only short tests"
go test ./... -v -test.short
else
echo "run full test suit"
go test ./... -v
fi
- if: contains(matrix.os, 'windows')
run: |
cd src
if ([Environment]::GetEnvironmentVariable('factorio_password', 'Machine')) {
echo "run full test suit"
go test ./... -v
} else {
echo "run only short tests"
go test ./... -v "-test.short"
}
docker-push:
needs: [test-npm, test-go]
runs-on: ubuntu-latest
if: github.event_name == 'push' && github.ref != 'refs/heads/master'
steps:
- uses: actions/checkout@v2
- uses: rlespinasse/[email protected]
- uses: actions/setup-node@v2
with:
node-version: '16'
- uses: actions/setup-go@v2
- uses: docker/setup-buildx-action@v1
- name: Login to dockerhub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- run: make build; cp build/factorio-server-manager-linux.zip docker/factorio-server-manager-linux.zip
- id: docker_build
uses: docker/build-push-action@v2
with:
context: ./docker/
file: ./docker/Dockerfile-local
push: true
tags: ofsm/ofsm:${{ env.GITHUB_REF_SLUG }}