Set 1.35 as latest (#477) #168
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # `name` value will appear "as is" in the badge. | |
| # See https://docs.github.com/en/actions/configuring-and-managing-workflows/configuring-a-workflow#adding-a-workflow-status-badge-to-your-repository | |
| # yamllint --format github .github/workflows/packaging.yaml | |
| --- | |
| name: "packaging" | |
| on: | |
| push: # We run tests on non-tagged pushes to master | |
| tags: '' | |
| branches: master | |
| paths: | |
| - 'packaging/msi/*' | |
| - 'packaging/nfpm/*' | |
| - 'packaging/icon@48w.ico' | |
| - '.github/workflows/packaging.yaml' | |
| - 'Makefile' | |
| - 'Tools.mk' | |
| pull_request: # We also run tests on pull requests targeted at the master branch | |
| branches: master | |
| paths: | |
| - 'packaging/msi/*' | |
| - 'packaging/nfpm/*' | |
| - 'packaging/icon@48w.ico' | |
| - '.github/workflows/packaging.yaml' | |
| - 'Makefile' | |
| - 'Tools.mk' | |
| # workflow_dispatch will let us manually trigger the workflow from GitHub actions dashboard. | |
| # For example, you can try to build a branch without raising a pull request. | |
| # See https://docs.github.com/en/free-pro-team@latest/actions/managing-workflow-runs/manually-running-a-workflow | |
| workflow_dispatch: | |
| defaults: | |
| run: # use bash for all operating systems unless overridden | |
| shell: bash | |
| jobs: | |
| packaging: | |
| name: "Test packaging build (${{ matrix.os }})" | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: "Checkout" | |
| uses: actions/checkout@v4 | |
| - name: "Cache Go" | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/go/pkg/mod | |
| # go.mod for go release version, go.sum for modules used, and Tools.mk for 'go run' tools | |
| key: test-${{ runner.os }}-go-${{ hashFiles('go.mod', 'go.sum', 'Tools.mk') }} | |
| restore-keys: test-${{ runner.os }}-go- | |
| - name: "Build packages (Installer, Debian, RPM)" | |
| run: make dist | |
| # In order to share the built artifacts in the subsequent tests, we use cache instead of actions/upload-artifacts. | |
| # The reason is that upload-artifacts are not globally consistent and sometimes pre_release_test won't be able to | |
| # find the artifacts uploaded here. See https://github.com/actions/upload-artifact/issues/21 for more context. | |
| # Downside of this is that, we pressure the cache capacity set per repository. We delete all caches created | |
| # on PRs on close. See .github/workflows/clear_cache.yaml. On main branch, in any way this cache will be deleted | |
| # in 7 days, also this at most a few MB, so this won't be an issue. | |
| - uses: actions/cache@v4 | |
| id: cache | |
| with: | |
| # Use share the cache containing archives across OSes. | |
| enableCrossOsArchive: true | |
| # Note: this creates a cache per run. | |
| key: release-artifacts-${{ github.run_id }} | |
| path: | |
| dist/ | |
| # pre_release_test tests the artifacts built by pre_release in the OS dependent way. | |
| pre_release_test: | |
| needs: packaging | |
| name: Pre-release test (${{ matrix.os }}) | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false # don't fail fast as sometimes failures are arch/OS specific | |
| matrix: | |
| os: [ubuntu-latest, macos-latest] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/cache@v4 | |
| id: cache | |
| with: | |
| # We need this cache to run tests. | |
| fail-on-cache-miss: true | |
| enableCrossOsArchive: true | |
| key: release-artifacts-${{ github.run_id }} | |
| path: dist/ | |
| - name: "Test Debian package" | |
| if: runner.os == 'Linux' | |
| run: packaging/nfpm/verify_deb.sh | |
| - name: "Test RPM package (CentOS)" | |
| if: runner.os == 'Linux' | |
| run: docker run --rm -v $PWD:/work --entrypoint packaging/nfpm/verify_rpm.sh ${CENTOS_IMAGE} | |
| env: # CENTOS_IMAGE was built by internal-images.yaml | |
| CENTOS_IMAGE: ghcr.io/tetratelabs/func-e-internal:centos-9 |