Skip to content

Commit

Permalink
test: packaging with validation (#440)
Browse files Browse the repository at this point in the history
Co-authored-by: bitsandfoxes <reg@bitfox.at>
  • Loading branch information
bruno-garcia and bitsandfoxes authored Nov 30, 2021
1 parent df74925 commit dd1351d
Show file tree
Hide file tree
Showing 5 changed files with 422 additions and 0 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,30 @@ jobs:
name: Test results (editmode)
path: artifacts/test/editmode

package-validation:
needs: [build]
name: UPM Package validation
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:
- name: Checkout
uses: actions/checkout@v2.3.3

- name: Download UPM package
uses: actions/download-artifact@v2
with:
# Artifact name is the commit sha. Which is what craft uses to find the relevant artifact.
name: ${{ github.sha }}

- name: Verify package content against snapshot
shell: pwsh
# If this step fails, you can accept the new file content by
# running the following script locally with 'accept' as an argument
# and committing the new snapshot file to your branch. i.e:
# pwsh ./test/Scripts.Tests/test-pack-contents.ps1 accept
run: ./test/Scripts.Tests/test-pack-contents.ps1

android-smoke-test:
needs: [build]
name: Smoke Test - Android ${{ matrix.api-level }} Unity ${{ matrix.unity-version }}
Expand Down
9 changes: 9 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,15 @@ In order to run the tests
* open `TestRunner` via `Windows -> General -> Test Runner`
* run `PlayMode` or `EditMode` tests

### Package validation

In CI, a workflow validates that the content of the package doesn't change accidentally.
If you intentially want to add or remove files in the final UPM package. You need to accept the diff:

```
pwsh ./test/Scripts.Tests/test-pack-contents.ps1 accept
```

## Release

The release is done by pushing the artifact built in CI [to a new repo](https://github.com/getsentry/unity). The artifact is built by using the template files in the `package` directory. In order to make a release, the contents of `package-dev/Editor` and `package-dev/Runtime` folders should be copied into `package`.
Expand Down
1 change: 1 addition & 0 deletions scripts/pack.ps1
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
Remove-Item "package-release" -Recurse -ErrorAction SilentlyContinue
New-Item "package-release" -ItemType Directory

$exclude = @(
Expand Down
Loading

0 comments on commit dd1351d

Please sign in to comment.