Skip to content

Fix release gh action and adds SLSA provenance to releases #1

Fix release gh action and adds SLSA provenance to releases

Fix release gh action and adds SLSA provenance to releases #1

Workflow file for this run

## %CopyrightBegin%

Check failure on line 1 in .github/workflows/maint-27.yaml

View workflow run for this annotation

GitHub Actions / .github/workflows/maint-27.yaml

Invalid workflow file

(Line: 82, Col: 17): Unexpected value 'writ'
##
## SPDX-License-Identifier: Apache-2.0
##
## Copyright Ericsson AB 2024-2026. All Rights Reserved.
##
## Licensed under the Apache License, Version 2.0 (the "License");
## you may not use this file except in compliance with the License.
## You may obtain a copy of the License at
##
## http://www.apache.org/licenses/LICENSE-2.0
##
## Unless required by applicable law or agreed to in writing, software
## distributed under the License is distributed on an "AS IS" BASIS,
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
## See the License for the specific language governing permissions and
## limitations under the License.
##
## %CopyrightEnd%
name: Build and check Erlang/OTP 27 (reusable)
on:
workflow_call:
secrets:
TRIGGER_ERLANG_ORG_BUILD:
description: 'Token to trigger erlang.org rebuild'
required: false
## concurrency and env cannot be set in a reusable workflow called via workflow_call;
## they must be set in the caller workflow.
permissions:
contents: read
jobs:
setup:
uses: ./.github/workflows/reusable-setup.yaml
## no 'with:' needed - reusable-setup derives everything from github context
pack:
name: Build Erlang/OTP (64-bit)
needs: setup
permissions:
contents: read
actions: write
uses: ./.github/workflows/reusable-pack.yaml
with:
base_branch: ${{ needs.setup.outputs.base_branch }}
full_build_and_check: ${{ needs.setup.outputs.full_build_and_check }}
bypass_erlang_repo: false
build-macos:
name: Build Erlang/OTP (macOS)
needs: pack
permissions:
contents: read
actions: write
if: needs.pack.outputs.build-c-code == 'true'
uses: ./.github/workflows/reusable-build-macos.yaml
with:
base_branch: ${{ needs.pack.outputs.base_branch }}
build-ios:
name: Build Erlang/OTP (iOS)
needs: pack
if: needs.pack.outputs.build-c-code == 'true'
permissions:
contents: read
actions: write
uses: ./.github/workflows/reusable-build-ios.yaml
with:
base_branch: ${{ needs.pack.outputs.base_branch }}
build-windows:
name: Build Erlang/OTP (Windows)
needs: pack
if: needs.pack.outputs.build-c-code == 'true'
permissions:
contents: read
actions: writ
uses: ./.github/workflows/reusable-build-windows.yaml
with:
base_branch: ${{ needs.pack.outputs.base_branch }}
build-flavors:
name: Build Erlang/OTP (Types and Flavors)
runs-on: ubuntu-latest
needs: pack
if: needs.pack.outputs.c-code-changes
permissions:
contents: read
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: ./.github/actions/build-base-image
with:
BASE_BRANCH: ${{ env.BASE_BRANCH }}
- name: Build Erlang/OTP flavors and types
run: |
TYPES="opt debug lcnt"
FLAVORS="emu jit"
for TYPE in ${TYPES}; do
for FLAVOR in ${FLAVORS}; do
echo "::group::{TYPE=$TYPE FLAVOR=$FLAVOR}"
docker run otp "make TYPE=$TYPE FLAVOR=$FLAVOR"
echo "::endgroup::"
done
done
build:
name: Build Erlang/OTP
needs:
- pack
if: needs.pack.outputs.build-c-code == 'true'
permissions:
contents: read
uses: ./.github/workflows/reusable-build-otp.yaml
with:
base_branch: ${{ needs.setup.outputs.base_branch }}
# keep documentation before overhaul (OTP-27)
documentation:
name: Build and check documentation
runs-on: ubuntu-latest
needs:
- setup
- pack
permissions:
contents: read
actions: write
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- uses: ./.github/actions/build-base-image
with:
## BASE_BRANCH env var is not available here; compute inline
BASE_BRANCH: ${{ github.event_name == 'pull_request' && github.base_ref || github.ref_name }}
## Build all the documentation
- name: Build documentation
env:
BASE_URL: ${{ github.event_name == 'pull_request' &&
format('{0}/blob/{1}/',github.event.pull_request.head.repo.full_name,github.event.pull_request.head.ref) ||
format('{0}/blob/{1}/',github.repository,github.ref_name)
}}
run: |
docker build --build-arg BASE_URL="$BASE_URL" -t otp - <<EOF
FROM otp
ENV BASE_URL=$BASE_URL
RUN ./otp_build download_ex_doc
RUN make release docs release_docs && sudo make install-docs
EOF
- name: Release docs to publish
run: .github/scripts/release-docs.sh
- name: Upload html documentation archive
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
with:
name: otp_doc_html
path: otp_doc_html.tar.gz
- name: Upload man documentation archive
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
with:
name: otp_doc_man
path: otp_doc_man.tar.gz
- name: Trigger rebuild of erlang.org/docs/
if: github.ref_name == 'master' && github.repository == 'erlang/otp'
env:
GITHUB_TOKEN: ${{ secrets.TRIGGER_ERLANG_ORG_BUILD }}
run: |
curl -H "Authorization: token ${GITHUB_TOKEN}" -X POST -H "Accept: application/vnd.github.v3+json" "https://api.github.com/repos/erlang/erlang-org/actions/workflows/update-gh-cache.yaml/dispatches" -d '{"ref":"master"}'
- name: Run html link check
run: docker run -v $PWD/:/github otp "cd /github/docs && /github/scripts/otp_check_html_links.exs"
static:
name: Run static analysis
runs-on: ubuntu-latest
needs:
- setup
- pack
permissions:
contents: read
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: ./.github/actions/build-base-image
with:
BASE_BRANCH: ${{ env.BASE_BRANCH }}
- name: Install clang-format
run: |
docker build -t otp - <<EOF
FROM otp
RUN sudo apt-get install -y clang-format
EOF
## Check formatting of cpp code
- name: Check format
run: docker run otp "make format-check"
## Run dialyzer
- name: Run dialyzer
run: docker run -v $PWD/:/github otp '/github/scripts/run-dialyzer'
# different way to build make prevents us from using reusable-test.
test:
name: Test Erlang/OTP
runs-on: ubuntu-latest
needs: pack
if: needs.pack.outputs.changes != '[]'
permissions:
contents: read
actions: write
strategy:
matrix:
type: ${{ fromJson(needs.pack.outputs.changes) }}
fail-fast: false
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- uses: ./.github/actions/build-base-image
with:
## BASE_BRANCH env var is not available here; compute inline
BASE_BRANCH: ${{ github.event_name == 'pull_request' && github.base_ref || github.ref_name }}
- name: Run tests
id: run-tests
env:
MATRIX_TYPE: ${{ matrix.type }}
run: |
set -x
mkdir $PWD/make_test_dir
APP="${MATRIX_TYPE}"
## Need to specialize for epmd, emulator and debug
case "${APP}" in
emulator) DIR=erts/emulator/ ;;
epmd) DIR=erts/epmd ;;
debug) DIR=lib/os_mon; APP=os_mon; TYPE=debug ;;
*) DIR=lib/${MATRIX_TYPE} ;;
esac
## Remove systemd-coredump
! sudo apt remove systemd-coredump
## Removing systemd-coredump, caused apport to be installed instead, so we disable it
! sudo service apport stop
sudo bash -c "echo 'core.%p' > /proc/sys/kernel/core_pattern"
docker run --ulimit core=-1 --ulimit nofile=5000:5000 --pids-limit 1024 \
-e CTRUN_TIMEOUT=90 -e SPEC_POSTFIX=gh \
-e TEST_NEEDS_RELEASE=true -e "RELEASE_ROOT=/buildroot/otp/Erlang ∅⊤ℝ" \
-e EXTRA_ARGS="-ct_hooks cth_surefire [{path,\"/buildroot/otp/$DIR/make_test_dir/${MATRIX_TYPE}_junit.xml\"}]" \
-v "$PWD/make_test_dir:/buildroot/otp/$DIR/make_test_dir" \
-v "$PWD/scripts:/buildroot/otp/scripts" \
otp "make TYPE=${TYPE} && make ${APP}_test TYPE=${TYPE}"
## Rename os_mon to debug for debug build
if [ "$APP" != "${MATRIX_TYPE}" ]; then
mv make_test_dir/${APP}_test "make_test_dir/${MATRIX_TYPE}_test"
fi
- name: Cleanup tests
if: ${{ !cancelled() }}
env:
MATRIX_TYPE: ${{ matrix.type }}
run: |
rm -rf make_test_dir/otp || true
sudo bash -c "chown -R `whoami` make_test_dir && chmod -R +r make_test_dir"
tar czf ${MATRIX_TYPE}_test_results.tar.gz make_test_dir
- name: Upload test results
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
if: ${{ !cancelled() }}
with:
name: ${{ matrix.type }}_test_results
path: ${{ matrix.type }}_test_results.tar.gz
system-test:
name: Test Erlang/OTP (system)
if: ${{ !cancelled() && needs.pack.result == 'success' }} # Run even if the need has failed
permissions:
contents: read
actions: write
needs:
- pack
- test
uses: ./.github/workflows/reusable-system-test.yaml
with:
base_branch: ${{ needs.pack.outputs.base_branch }}
## If this is an "OTP-*" tag that has been pushed, create a release
release:
name: Release Erlang/OTP
needs:
- setup
- documentation
permissions:
contents: write
attestations: write
id-token: write
actions: write
if: startsWith(github.ref, 'refs/tags/OTP-') && github.repository == 'erlang/otp'
uses: ./.github/workflows/reusable-release.yaml
with:
otp_branch: ${{ needs.setup.outputs.otp_version }}
otp_sbom_version: ''
tag: ${{ needs.setup.outputs.tag }}
vsn: ${{ needs.setup.outputs.vsn }}
secrets:
TRIGGER_ERLANG_ORG_BUILD: ${{ secrets.TRIGGER_ERLANG_ORG_BUILD }}
# GITHUB_TOKEN is already available in called workflow.
event_file:
name: "Event File"
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Upload
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
with:
name: Event File
path: ${{ github.event_path }}