2020-11-24 03:13:06 +02:00
|
|
|
on:
|
|
|
|
push:
|
2020-11-24 04:09:51 +02:00
|
|
|
branches:
|
|
|
|
- '**'
|
2020-11-24 03:13:06 +02:00
|
|
|
tags-ignore:
|
2020-11-24 04:09:51 +02:00
|
|
|
- '*.*'
|
2020-11-24 03:13:06 +02:00
|
|
|
pull_request:
|
2020-11-24 04:12:33 +02:00
|
|
|
branches:
|
|
|
|
- '**'
|
2020-11-22 21:19:53 +02:00
|
|
|
env:
|
2020-11-23 06:06:15 +02:00
|
|
|
factorio_password: ${{ secrets.FACTORIO_PASSWORD }}
|
|
|
|
factorio_username: ${{ secrets.FACTORIO_USERNAME }}
|
|
|
|
mod_dir: 'dev'
|
|
|
|
mod_pack_dir: 'dev_pack'
|
|
|
|
dir: '../'
|
|
|
|
conf: '../../conf.json.example'
|
2020-11-22 02:50:48 +02:00
|
|
|
jobs:
|
2020-11-22 03:40:44 +02:00
|
|
|
test-npm:
|
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
os: [ubuntu-latest, windows-latest]
|
|
|
|
runs-on: ${{ matrix.os }}
|
2020-11-22 02:50:48 +02:00
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
- uses: actions/setup-node@v1
|
|
|
|
- run: make app/bundle
|
2020-11-22 03:40:44 +02:00
|
|
|
test-go:
|
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
os: [ubuntu-latest, windows-latest]
|
2020-11-22 03:51:53 +02:00
|
|
|
go: ['1.14', '1.15', '1']
|
2020-11-22 03:40:44 +02:00
|
|
|
runs-on: ${{ matrix.os }}
|
2020-11-22 03:51:53 +02:00
|
|
|
name: test-go ${{ matrix.go }} (${{ matrix.os }})
|
2020-11-22 03:40:44 +02:00
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
2020-11-22 03:51:53 +02:00
|
|
|
- name: Setup go
|
|
|
|
uses: actions/setup-go@v2
|
2020-11-22 03:40:44 +02:00
|
|
|
with:
|
2020-11-22 03:51:53 +02:00
|
|
|
go-version: ${{ matrix.go }}
|
2020-11-23 04:23:26 +02:00
|
|
|
- if: contains(matrix.os, 'ubuntu')
|
2020-11-23 03:52:57 +02:00
|
|
|
run: |
|
|
|
|
cd src
|
2020-11-23 04:02:44 +02:00
|
|
|
if [[ -z "$factorio_password" ]]; then
|
2020-11-23 04:05:50 +02:00
|
|
|
echo "run only short tests"
|
2020-11-23 03:52:57 +02:00
|
|
|
go test ./... -v -test.short
|
2020-11-23 04:02:44 +02:00
|
|
|
else
|
2020-11-23 04:05:50 +02:00
|
|
|
echo "run full test suit"
|
2020-11-23 04:02:44 +02:00
|
|
|
go test ./... -v
|
2020-11-23 03:52:57 +02:00
|
|
|
fi
|
2020-11-23 04:53:48 +02:00
|
|
|
- if: contains(matrix.os, 'windows')
|
|
|
|
run: |
|
|
|
|
cd src
|
2020-12-02 18:12:02 +02:00
|
|
|
if ([Environment]::GetEnvironmentVariable('factorio_password', 'Machine')) {
|
2020-12-02 17:51:22 +02:00
|
|
|
echo "run full test suit"
|
|
|
|
go test ./... -v
|
2020-12-02 18:12:02 +02:00
|
|
|
} else {
|
|
|
|
echo "run only short tests"
|
|
|
|
go test ./... -v "-test.short"
|
2020-11-23 04:59:46 +02:00
|
|
|
}
|
2020-11-22 05:54:15 +02:00
|
|
|
docker-push:
|
2020-11-22 06:23:29 +02:00
|
|
|
needs: [test-npm, test-go]
|
2020-11-22 05:54:15 +02:00
|
|
|
runs-on: ubuntu-latest
|
2021-01-14 21:59:51 +02:00
|
|
|
if: github.event_name == 'push' && github.ref != 'refs/heads/master'
|
2020-11-22 05:54:15 +02:00
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
2021-01-14 21:59:51 +02:00
|
|
|
- uses: rlespinasse/github-slug-action@v3.x
|
2020-11-22 05:54:15 +02:00
|
|
|
- uses: actions/setup-node@v1
|
|
|
|
- uses: actions/setup-go@v2
|
2020-11-22 06:02:34 +02:00
|
|
|
- uses: docker/setup-buildx-action@v1
|
2020-11-22 05:54:15 +02:00
|
|
|
- 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
|
2020-11-22 05:57:14 +02:00
|
|
|
with:
|
2020-11-22 06:15:59 +02:00
|
|
|
context: ./docker/
|
|
|
|
file: ./docker/Dockerfile-local
|
2020-11-22 05:57:14 +02:00
|
|
|
push: true
|
2021-01-14 21:59:51 +02:00
|
|
|
tags: ofsm/ofsm:${{ env.GITHUB_REF_SLUG }}
|