factorio-server-manager/.github/workflows/test-workflow.yml

83 lines
2.4 KiB
YAML
Raw Normal View History

2020-11-24 03:13:06 +02:00
on:
push:
branches:
- '**'
2020-11-24 03:13:06 +02:00
tags-ignore:
- '*.*'
2020-11-24 03:13:06 +02:00
pull_request:
2020-11-24 04:12:33 +02:00
branches:
- '**'
env:
factorio_password: ${{ secrets.FACTORIO_PASSWORD }}
factorio_username: ${{ secrets.FACTORIO_USERNAME }}
mod_dir: 'dev'
mod_pack_dir: 'dev_pack'
dir: '../'
conf: '../../conf.json.example'
jobs:
2020-11-22 03:40:44 +02:00
test-npm:
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
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]
go: ['1.14', '1.15', '1']
2020-11-22 03:40:44 +02:00
runs-on: ${{ matrix.os }}
name: test-go ${{ matrix.go }} (${{ matrix.os }})
2020-11-22 03:40:44 +02:00
steps:
- uses: actions/checkout@v2
- name: Setup go
uses: actions/setup-go@v2
2020-11-22 03:40:44 +02:00
with:
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
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
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
}
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/github-slug-action@v3.x
- uses: actions/setup-node@v1
- uses: actions/setup-go@v2
2020-11-22 06:02:34 +02:00
- 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
2020-11-22 05:57:14 +02:00
with:
context: ./docker/
file: ./docker/Dockerfile-local
2020-11-22 05:57:14 +02:00
push: true
tags: ofsm/ofsm:${{ env.GITHUB_REF_SLUG }}