mirror of
https://github.com/unraid/api.git
synced 2026-01-06 00:30:22 -06:00
feat: move to singular build and test step
This commit is contained in:
113
.github/workflows/main.yml
vendored
113
.github/workflows/main.yml
vendored
@@ -34,7 +34,8 @@ jobs:
|
||||
- name: Validate branch and tag
|
||||
run: exit 0
|
||||
|
||||
build-register-container:
|
||||
build-test-api:
|
||||
name: Build and Test API
|
||||
runs-on: ubuntu-latest
|
||||
defaults:
|
||||
run:
|
||||
@@ -50,54 +51,33 @@ jobs:
|
||||
- name: Build Builder Image
|
||||
run: docker buildx build --cache-from=type=gha --cache-to=type=gha,mode=max -t builder -f ./Dockerfile .
|
||||
|
||||
lint-api:
|
||||
needs: [build-register-container]
|
||||
continue-on-error: false
|
||||
defaults:
|
||||
run:
|
||||
working-directory: api
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout repo
|
||||
uses: actions/checkout@v4
|
||||
- name: Build with Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
with:
|
||||
context: .
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
install: true
|
||||
platforms: linux/amd64
|
||||
- name: Build Builder Image
|
||||
run: docker buildx build --cache-from=type=gha -t builder -f ./Dockerfile .
|
||||
|
||||
- name: Lint inside of the docker container
|
||||
run: |
|
||||
docker run --rm builder npm run lint
|
||||
|
||||
test-api:
|
||||
needs: [build-register-container]
|
||||
continue-on-error: false
|
||||
defaults:
|
||||
run:
|
||||
working-directory: api
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout repo
|
||||
uses: actions/checkout@v4
|
||||
- name: Build with Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
with:
|
||||
context: .
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
install: true
|
||||
platforms: linux/amd64
|
||||
- name: Build Builder Image
|
||||
run: docker buildx build --cache-from=type=gha -t builder -f ./Dockerfile .
|
||||
- name: Test inside of the docker container
|
||||
run: |
|
||||
docker run --rm builder npm run coverage
|
||||
- name: Build inside of the docker container
|
||||
id: build-pack-binary
|
||||
run: |
|
||||
docker run --rm -v ${{ github.workspace }}/api/deploy/release:/app/deploy/release builder npm run build
|
||||
API_VERSION=$(cat package.json | jq -r '.version')
|
||||
echo "::set-output name=API_VERSION::${API_VERSION}"
|
||||
|
||||
- name: Set Hashes
|
||||
id: set-hashes
|
||||
run: |
|
||||
API_MD5=$(md5sum ${{ github.workspace }}/api/deploy/release/*.tgz | awk '{ print $1 }')
|
||||
API_SHA256=$(sha256sum ${{ github.workspace }}/api/deploy/release/*.tgz | awk '{ print $1 }')
|
||||
echo "::set-output name=API_MD5::${API_MD5}"
|
||||
echo "::set-output name=API_SHA256::${API_SHA256}"
|
||||
|
||||
- name: Upload tgz to Github artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: unraid-api
|
||||
path: ${{ github.workspace }}/api/deploy/release/*.tgz
|
||||
lint-web:
|
||||
defaults:
|
||||
run:
|
||||
@@ -128,53 +108,6 @@ jobs:
|
||||
|
||||
- name: Lint files
|
||||
run: npm run lint
|
||||
|
||||
build-api:
|
||||
needs: [build-register-container]
|
||||
defaults:
|
||||
run:
|
||||
working-directory: api
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
outputs:
|
||||
API_VERSION: ${{ steps.build-pack-binary.outputs.API_VERSION }}
|
||||
API_MD5: ${{ steps.set-hashes.outputs.API_MD5 }}
|
||||
API_SHA256: ${{ steps.set-hashes.outputs.API_SHA256 }}
|
||||
|
||||
steps:
|
||||
- name: Checkout repo
|
||||
uses: actions/checkout@v4
|
||||
- name: Build with Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
with:
|
||||
context: .
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
install: true
|
||||
platforms: linux/amd64
|
||||
- name: Build Builder Image
|
||||
run: docker buildx build --cache-from=type=gha -t builder -f ./Dockerfile .
|
||||
- name: Build inside of the docker container
|
||||
id: build-pack-binary
|
||||
run: |
|
||||
docker run --rm -v ${{ github.workspace }}/api/deploy/release:/app/deploy/release builder npm run build
|
||||
API_VERSION=$(cat package.json | jq -r '.version')
|
||||
echo "::set-output name=API_VERSION::${API_VERSION}"
|
||||
|
||||
- name: Set Hashes
|
||||
id: set-hashes
|
||||
run: |
|
||||
API_MD5=$(md5sum ${{ github.workspace }}/api/deploy/release/*.tgz | awk '{ print $1 }')
|
||||
API_SHA256=$(sha256sum ${{ github.workspace }}/api/deploy/release/*.tgz | awk '{ print $1 }')
|
||||
echo "::set-output name=API_MD5::${API_MD5}"
|
||||
echo "::set-output name=API_SHA256::${API_SHA256}"
|
||||
|
||||
- name: Upload tgz to Github artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: unraid-api
|
||||
path: ${{ github.workspace }}/api/deploy/release/*.tgz
|
||||
|
||||
build-web:
|
||||
defaults:
|
||||
run:
|
||||
@@ -216,7 +149,7 @@ jobs:
|
||||
path: web/.nuxt/nuxt-custom-elements/dist/unraid-components
|
||||
|
||||
build-plugin:
|
||||
needs: [lint-api, lint-web, test-api, build-api, build-web]
|
||||
needs: [lint-web, build-test-api, build-web]
|
||||
defaults:
|
||||
run:
|
||||
working-directory: plugin
|
||||
|
||||
Reference in New Issue
Block a user