|
1 | | -name: Build on push |
2 | | -on: [push] |
| 1 | +name: CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: {} |
| 5 | + pull_request: |
| 6 | + branches: [ main ] |
| 7 | + |
3 | 8 | jobs: |
4 | 9 | build: |
5 | | - runs-on: windows-latest |
| 10 | + runs-on: ubuntu-latest |
| 11 | + env: |
| 12 | + FORCE_COLOR: 1 |
6 | 13 | steps: |
7 | | - - name: Checkout |
8 | | - uses: actions/checkout@v2 |
9 | | - - name: GitVersion |
10 | | - id: gitversion |
11 | | - uses: PoshCode/Actions/gitversion@v1 |
12 | | - - name: Install-RequiredModules |
13 | | - uses: PoshCode/Actions/install-requiredmodules@v1 |
14 | | - - name: Build Module |
15 | | - id: build |
16 | | - uses: PoshCode/actions/build-module@v1 |
| 14 | + - uses: earthly/actions-setup@v1 |
17 | 15 | with: |
18 | | - path: ${{github.workspace}}/Source |
19 | | - version: ${{ steps.gitversion.outputs.LegacySemVerPadded }} |
20 | | - destination: ${{github.workspace}}/output |
21 | | - - name: Upload Build Output |
22 | | - uses: actions/upload-artifact@v2 |
| 16 | + github-token: ${{ secrets.GITHUB_TOKEN }} |
| 17 | + |
| 18 | + - uses: actions/checkout@v4 |
| 19 | + with: |
| 20 | + submodules: true |
| 21 | + fetch-depth: 0 |
| 22 | + |
| 23 | + - name: earthly +test |
| 24 | + if: github.ref != 'refs/heads/main' |
| 25 | + run: earthly --strict +test |
| 26 | + |
| 27 | + - name: earthly +push |
| 28 | + if: github.ref == 'refs/heads/main' |
| 29 | + run: earthly --push --secret NUGET_API_KEY --secret PSGALLERY_API_KEY --strict +all |
| 30 | + env: |
| 31 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 32 | + NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }} |
| 33 | + PSGALLERY_API_KEY: ${{ secrets.PSGALLERY_API_KEY }} |
| 34 | + |
| 35 | + - uses: actions/upload-artifact@v4 |
| 36 | + with: |
| 37 | + name: ModuleBuilder |
| 38 | + path: Modules/ModuleBuilder |
| 39 | + |
| 40 | + - uses: actions/upload-artifact@v4 |
| 41 | + with: |
| 42 | + name: TestResults |
| 43 | + path: Modules/ModuleBuilder-TestResults |
| 44 | + |
| 45 | + - uses: actions/upload-artifact@v4 |
23 | 46 | with: |
24 | | - name: Modules |
25 | | - path: ${{github.workspace}}/output |
| 47 | + name: Packages |
| 48 | + path: Modules/ModuleBuilder-Packages |
| 49 | + |
26 | 50 | - name: Upload Tests |
27 | | - uses: actions/upload-artifact@v2 |
| 51 | + uses: actions/upload-artifact@v4 |
28 | 52 | with: |
29 | 53 | name: PesterTests |
30 | 54 | path: ${{github.workspace}}/Tests |
31 | 55 | - name: Upload RequiredModules.psd1 |
32 | | - uses: actions/upload-artifact@v2 |
| 56 | + uses: actions/upload-artifact@v4 |
33 | 57 | with: |
34 | 58 | name: RequiredModules |
35 | 59 | path: ${{github.workspace}}/RequiredModules.psd1 |
36 | | - - name: Upload PSScriptAnalyzerSettings.psd1 |
37 | | - uses: actions/upload-artifact@v2 |
38 | | - with: |
39 | | - name: ScriptAnalyzer |
40 | | - path: ${{github.workspace}}/PSScriptAnalyzerSettings.psd1 |
41 | | - lint: |
42 | | - needs: build |
43 | | - name: Run PSScriptAnalyzer |
44 | | - runs-on: ubuntu-latest |
45 | | - steps: |
46 | | - - name: Download Build Output |
47 | | - uses: actions/download-artifact@v2 |
48 | | - - name: Invoke-ScriptAnalyzer |
49 | | - uses: devblackops/github-action-psscriptanalyzer@master |
50 | | - with: |
51 | | - rootPath: Modules/ModuleBuilder |
52 | | - repoToken: ${{ secrets.GITHUB_TOKEN }} |
53 | 60 | test: |
54 | 61 | needs: build |
55 | 62 | runs-on: ${{ matrix.os }} |
|
59 | 66 | os: [windows-latest, ubuntu-latest, macos-latest] |
60 | 67 | steps: |
61 | 68 | - name: Download Build Output |
62 | | - uses: actions/download-artifact@v2 |
| 69 | + uses: actions/download-artifact@v4 |
| 70 | + with: |
| 71 | + name: ModuleBuilder |
| 72 | + path: Modules/ModuleBuilder |
| 73 | + - name: Download Pester Tests |
| 74 | + uses: actions/download-artifact@v4 |
| 75 | + with: |
| 76 | + name: PesterTests |
| 77 | + path: PesterTests |
| 78 | + - name: Download RequiredModules |
| 79 | + uses: actions/download-artifact@v4 |
| 80 | + with: |
| 81 | + name: RequiredModules |
| 82 | + |
63 | 83 | - uses: PoshCode/Actions/install-requiredmodules@v1 |
64 | 84 | - uses: PoshCode/Actions/pester@v1 |
65 | 85 | with: |
|
0 commit comments