diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..285ee11 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,57 @@ +name: build + +on: + push: + branches: + - 'master' + tags: + - 'v*' + pull_request: + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Set up Go + uses: actions/setup-go@v2.1.5 + with: + go-version: 1.16 + + - name: Set up nodejs + uses: actions/setup-node@v2 + with: + node-version: '17' + run: cd public && npm ci && npm run bundle + + - name: Cache Go modules + uses: actions/cache@v1 + with: + path: ~/go/pkg/mod + key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} + restore-keys: | + ${{ runner.os }}-go- + + - name: Tests + run: | + go mod tidy + go test -v ./... + + - name: Docker Login + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Run GoReleaser + uses: goreleaser/goreleaser-action@v2 + if: success() && startsWith(github.ref, 'refs/tags/') + with: + version: latest + args: release --rm-dist + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/jshint.yml b/.github/workflows/jshint.yml index faee99d..203828b 100644 --- a/.github/workflows/jshint.yml +++ b/.github/workflows/jshint.yml @@ -10,11 +10,10 @@ jobs: steps: - uses: actions/checkout@v2 - - name: apt - run: sudo apt-get install -y nodejs npm - - - name: jshint install - run: sudo npm i -g jshint - - - name: jshint run - run: cd public/js && jshint + - name: Set up nodejs + uses: actions/setup-node@v2 + with: + node-version: '17' + + - name: Run jshint + run: cd public && npm ci && npm run jshint diff --git a/readme.md b/readme.md index 3fea270..2766809 100644 --- a/readme.md +++ b/readme.md @@ -3,6 +3,7 @@ Minetest mapserver ![](https://github.com/minetest-mapserver/mapserver/workflows/jshint/badge.svg) ![](https://github.com/minetest-mapserver/mapserver/workflows/go-test/badge.svg) +![](https://github.com/minetest-mapserver/mapserver/workflows/build/badge.svg) ![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/minetest-mapserver/mapserver) ![GitHub repo size](https://img.shields.io/github/repo-size/minetest-mapserver/mapserver.svg)