|
|
@@ -37,6 +37,9 @@ on:
|
|
|
jobs:
|
|
|
build:
|
|
|
runs-on: ubuntu-latest
|
|
|
+ env:
|
|
|
+ # semantic-release only publishes from main (.releaserc.yaml); goreleaser runs in publishCmd.
|
|
|
+ WILL_PUBLISH: ${{ github.ref == 'refs/heads/main' && github.ref_type != 'tag' && github.event_name != 'pull_request' }}
|
|
|
outputs:
|
|
|
new_release_published: ${{ steps.release.outputs.new_release_published }}
|
|
|
new_release_git_tag: ${{ steps.release.outputs.new_release_git_tag }}
|
|
|
@@ -46,28 +49,24 @@ jobs:
|
|
|
- name: Checkout
|
|
|
uses: actions/checkout@v6
|
|
|
with:
|
|
|
- fetch-depth: 0
|
|
|
+ fetch-depth: ${{ env.WILL_PUBLISH == 'true' && '0' || '1' }}
|
|
|
|
|
|
- name: Set up QEMU
|
|
|
+ if: env.WILL_PUBLISH == 'true'
|
|
|
id: qemu
|
|
|
uses: docker/setup-qemu-action@v4
|
|
|
with:
|
|
|
image: tonistiigi/binfmt:latest
|
|
|
platforms: arm64,arm
|
|
|
|
|
|
- - name: Setup node (npm cache)
|
|
|
- if: github.event_name != 'pull_request'
|
|
|
- uses: actions/setup-node@v6.4.0
|
|
|
- with:
|
|
|
- node-version: '22'
|
|
|
- cache: 'npm'
|
|
|
- cache-dependency-path: frontend/package-lock.json
|
|
|
-
|
|
|
- name: Setup node
|
|
|
- if: github.event_name == 'pull_request'
|
|
|
uses: actions/setup-node@v6.4.0
|
|
|
with:
|
|
|
node-version: '22'
|
|
|
+ cache: 'npm'
|
|
|
+ cache-dependency-path: |
|
|
|
+ frontend/package-lock.json
|
|
|
+ integration-tests/package-lock.json
|
|
|
|
|
|
- name: Setup Go
|
|
|
uses: actions/setup-go@v6
|
|
|
@@ -80,14 +79,14 @@ jobs:
|
|
|
run: go version
|
|
|
|
|
|
- name: Login to Docker Hub
|
|
|
- if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork == false
|
|
|
+ if: env.WILL_PUBLISH == 'true'
|
|
|
uses: docker/login-action@v4
|
|
|
with:
|
|
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
|
password: ${{ secrets.DOCKERHUB_KEY }}
|
|
|
|
|
|
- name: Login to ghcr
|
|
|
- if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork == false
|
|
|
+ if: env.WILL_PUBLISH == 'true'
|
|
|
uses: docker/login-action@v4
|
|
|
with:
|
|
|
registry: ghcr.io
|
|
|
@@ -98,24 +97,23 @@ jobs:
|
|
|
run: |
|
|
|
echo "DATE=$(date +'%Y-%m-%d')" >> "$GITHUB_ENV"
|
|
|
|
|
|
- - name: make webui
|
|
|
- run: make -w webui-dist
|
|
|
-
|
|
|
- - name: unit tests
|
|
|
- run: make -w service-unittests
|
|
|
-
|
|
|
- - name: frontend unit tests
|
|
|
- run: make -w frontend-unittests
|
|
|
-
|
|
|
- - name: build service
|
|
|
- run: make -w service
|
|
|
+ - name: build and unit tests
|
|
|
+ run: |
|
|
|
+ make -w webui-dist &
|
|
|
+ webui_pid=$!
|
|
|
+ make -w service-unittests &
|
|
|
+ service_tests_pid=$!
|
|
|
+ wait "$webui_pid" "$service_tests_pid"
|
|
|
+ make -w frontend-unittests
|
|
|
|
|
|
- name: integration tests
|
|
|
+ env:
|
|
|
+ SKIP_WEBUI: 1
|
|
|
run: cd integration-tests && make -w
|
|
|
|
|
|
- name: Archive integration tests
|
|
|
uses: actions/upload-artifact@v7
|
|
|
- if: always()
|
|
|
+ if: failure()
|
|
|
with:
|
|
|
name: "OliveTin-integration-tests-${{ env.DATE }}-${{ github.sha }}"
|
|
|
path: |
|
|
|
@@ -123,21 +121,21 @@ jobs:
|
|
|
!integration-tests/node_modules
|
|
|
|
|
|
- name: Install wixl and msitools
|
|
|
- if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork == false
|
|
|
+ if: env.WILL_PUBLISH == 'true'
|
|
|
run: sudo apt-get update && sudo apt-get install -y wixl msitools
|
|
|
|
|
|
- name: Install goreleaser
|
|
|
- if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork == false
|
|
|
+ if: env.WILL_PUBLISH == 'true'
|
|
|
uses: goreleaser/goreleaser-action@v7
|
|
|
with:
|
|
|
install-only: true
|
|
|
|
|
|
- name: Set up Docker Buildx
|
|
|
- if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork == false
|
|
|
+ if: env.WILL_PUBLISH == 'true'
|
|
|
uses: docker/setup-buildx-action@v4
|
|
|
|
|
|
- name: Verify macOS signing certificate chain
|
|
|
- if: github.ref_type != 'tag' && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork == false)
|
|
|
+ if: env.WILL_PUBLISH == 'true'
|
|
|
env:
|
|
|
MACOS_SIGN_P12: ${{ secrets.MACOS_SIGN_P12 }}
|
|
|
MACOS_SIGN_PASSWORD: ${{ secrets.MACOS_SIGN_PASSWORD }}
|
|
|
@@ -145,7 +143,7 @@ jobs:
|
|
|
|
|
|
- name: release
|
|
|
id: release
|
|
|
- if: github.ref_type != 'tag' && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork == false)
|
|
|
+ if: env.WILL_PUBLISH == 'true'
|
|
|
uses: cycjimmy/semantic-release-action@v5
|
|
|
with:
|
|
|
extra_plugins: |
|
|
|
@@ -182,7 +180,7 @@ jobs:
|
|
|
if-no-files-found: error
|
|
|
|
|
|
- name: Archive binaries
|
|
|
- if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork == false
|
|
|
+ if: env.WILL_PUBLISH == 'true'
|
|
|
uses: actions/upload-artifact@v7
|
|
|
with:
|
|
|
name: "OliveTin-snapshot-${{ env.DATE }}-${{ github.sha }}"
|