Skip to content

Make release job idempotent: skip release if tag already exists #343

Make release job idempotent: skip release if tag already exists

Make release job idempotent: skip release if tag already exists #343

Workflow file for this run

name: Build and test
on:
push:
schedule:
- cron: "0 0 7 * *"
jobs:
ubuntu:
runs-on: ubuntu-22.04
container:
image: ubuntu:22.04
env:
ARCH: ubuntu2204
UNPRIVILEGED: ubuntu
TEST_OUTPUT_DIR: /tmp/tests
WORKDIR: /tmp/workdir
steps:
- name: Install minimal dependencies
run: |
apt-get update
apt-get install -y --no-install-recommends git sudo gettext-base ca-certificates
- name: Check out repository code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Create an unprivileged user
run: |
useradd -m $UNPRIVILEGED
chown -R $UNPRIVILEGED:$UNPRIVILEGED .
echo "$UNPRIVILEGED ALL = NOPASSWD: $(which apt-get)" | tee -a /etc/sudoers
- name: Build package
run: sudo -u $UNPRIVILEGED --preserve-env=WORKDIR env SUDO=sudo build/ubuntu/mk
- name: Archive source package
uses: actions/upload-artifact@v4
with:
name: source-package.${{github.sha}}.${{env.ARCH}}
retention-days: 7
path: build/ubuntu/out/*.tar
- name: Install package
run: apt-get install -y ./build/ubuntu/out/*.deb
- name: Test system installation
run: |
export TOOLS=$(readlink -f "$WORKDIR"/*/tools)
run() {
sudo -u $UNPRIVILEGED --preserve-env=TEST_OUTPUT_DIR,TOOLS \
env SUT=$(which $1) SHOW_IDS=1 \
tools/test-harness -c $1
}
run hlua
run hpython
run hnode
run hsh
- name: Archive test results
uses: actions/upload-artifact@v4
if: success() || failure()
with:
name: tests.${{github.sha}}.${{env.ARCH}}
retention-days: 7
path: "${{env.TEST_OUTPUT_DIR}}/*-tests-*.tar.gz"
archlinux:
runs-on: ubuntu-22.04
container:
image: archlinux:latest
env:
ARCH: archlinux
UNPRIVILEGED: arch
TEST_OUTPUT_DIR: /tmp/tests
steps:
- name: Install minimal dependencies
run: pacman -Suy --noconfirm base-devel wget git
# workaround for upstream nodejs package does not include libnode.so
# https://gitlab.archlinux.org/archlinux/packaging/packages/nodejs/-/issues/1
- name: Install nodejs-shared
env:
GH_TOKEN: ${{github.token}}
run: |
pacman -S --noconfirm github-cli
gh --repo rootmos/nodejs-shared release download --pattern "nodejs-shared*x86_64*"
pacman --noconfirm -U nodejs-shared*x86_64*
- name: Check out repository code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Create an unprivileged user
run: |
useradd -m $UNPRIVILEGED
chown -R $UNPRIVILEGED:$UNPRIVILEGED .
tee -a /etc/sudoers.d/$UNPRIVILEGED <<< "$UNPRIVILEGED ALL = NOPASSWD: $(which pacman)"
- name: Create PKGBUILD
run: sudo -u $UNPRIVILEGED build/archlinux/mk
- name: Archive PKGBUILD
uses: actions/upload-artifact@v4
with:
name: PKGBUILD.${{github.sha}}
retention-days: 7
path: "build/archlinux/PKGBUILD"
- name: Build package
run: sudo -u $UNPRIVILEGED makepkg -si --noconfirm
working-directory: build/archlinux
- name: Test system installation
run: |
export TOOLS=$(readlink -f build/archlinux/src/*/tools)
run() {
sudo -u $UNPRIVILEGED --preserve-env=TEST_OUTPUT_DIR,TOOLS \
env SUT=$(which $1) SHOW_IDS=1 \
tools/test-harness -c $1
}
run hlua
run hpython
run hnode
run hsh
- name: Archive test results
uses: actions/upload-artifact@v4
if: success() || failure()
with:
name: tests.${{github.sha}}.${{env.ARCH}}
retention-days: 7
path: "${{env.TEST_OUTPUT_DIR}}/*-tests-*.tar.gz"