-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: rtorrero <[email protected]>
- Loading branch information
1 parent
12fe492
commit b3170b9
Showing
1 changed file
with
91 additions
and
5 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,8 +18,12 @@ env: | |
jobs: | ||
elixir-deps: | ||
name: Elixir dependencies | ||
runs-on: ubuntu-latest | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- name: Cancel Previous Runs | ||
uses: styfle/[email protected] | ||
with: | ||
access_token: ${{ github.token }} | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
|
@@ -68,8 +72,12 @@ jobs: | |
static-code-analysis: | ||
name: Static Code Analysis | ||
needs: elixir-deps | ||
runs-on: ubuntu-latest | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- name: Cancel Previous Runs | ||
uses: styfle/[email protected] | ||
with: | ||
access_token: ${{ github.token }} | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
|
@@ -91,7 +99,7 @@ jobs: | |
_build/test | ||
priv/plts | ||
key: ${{ runner.os }}-${{ env.OTP_VERSION }}-${{ env.ELIXIR_VERSION }}-${{ hashFiles('mix.lock') }} | ||
- name: Check for Unused Dependencies | ||
- name: Check for unused dependencies | ||
run: mix deps.unlock --check-unused | ||
- name: Check Code Format | ||
run: mix format --check-formatted | ||
|
@@ -126,6 +134,10 @@ jobs: | |
ports: | ||
- 5674:5672 | ||
steps: | ||
- name: Cancel Previous Runs | ||
uses: styfle/[email protected] | ||
with: | ||
access_token: ${{ github.token }} | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
|
@@ -167,14 +179,14 @@ jobs: | |
fetch-depth: 0 | ||
- uses: docker/setup-buildx-action@v2 | ||
- name: Log in to the Container registry | ||
uses: docker/login-action@49ed152c8eca782a232dede0303416e8f356c37b | ||
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Extract metadata (tags, labels) for Docker | ||
id: meta | ||
uses: docker/metadata-action@69f6fc9d46f2f8bf0d5491e4aabe0bb8c6a4678a | ||
uses: docker/metadata-action@507c2f2dc502c992ad446e3d7a5dfbe311567a96 | ||
with: | ||
images: ${{ env.IMAGE_REPOSITORY }} | ||
- name: Build and push container image | ||
|
@@ -221,3 +233,77 @@ jobs: | |
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
publish_dir: ./doc | ||
|
||
obs-commit: | ||
name: Commit the project on OBS | ||
runs-on: ubuntu-20.04 | ||
if: github.event_name == 'release' || (github.event_name == 'push' && github.ref_name == 'main') || github.event_name == 'workflow_dispatch' | ||
needs: [static-code-analysis, test] | ||
container: | ||
image: ghcr.io/trento-project/continuous-delivery:main | ||
env: | ||
GITHUB_OAUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
DEST_FOLDER: "/tmp/osc_project" | ||
NAME: trento-wanda-image | ||
OBS_USER: ${{ secrets.OBS_USER }} | ||
OBS_PASS: ${{ secrets.OBS_PASS }} | ||
OBS_PROJECT: ${{ secrets.OBS_PROJECT }} | ||
FOLDER: packaging/suse | ||
REPOSITORY: ${{ github.repository }} | ||
options: -u 0:0 | ||
steps: | ||
- name: Cancel Previous Runs | ||
uses: styfle/[email protected] | ||
with: | ||
access_token: ${{ github.token }} | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- uses: actions-ecosystem/action-get-latest-tag@v1 | ||
id: latest-tag | ||
with: | ||
semver_only: true | ||
initial_version: 0.0.1 | ||
- name: Setup rust | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: 1.66 | ||
- name: Get mix deps | ||
run: mix local.hex --force && mix local.rebar --force && mix deps.clean --all && mix deps.get | ||
- name: cargo vendor | ||
run: | | ||
cd deps/rhai_rustler/native/rhai_rustler | ||
cargo vendor | ||
printf '\n\n[source.crates-io]\nreplace-with = "vendored-sources"\n\n[source.vendored-sources]\ndirectory = "vendor"\n' >> .cargo/config | ||
- name: Configure OSC | ||
# OSC credentials must be configured beforehand as the HOME variables cannot be changed from /github/home | ||
# that is used to run osc commands | ||
run: | | ||
mkdir -p $HOME/.config/osc | ||
cp /home/osc/.config/osc/oscrc $HOME/.config/osc | ||
/scripts/init_osc_creds.sh | ||
- name: Prepare .changes file | ||
# The .changes file is updated only in release creation. This current task should be improved | ||
# in order to add the current rolling release notes | ||
if: github.event_name == 'release' | ||
run: | | ||
CHANGES_FILE=$NAME.changes | ||
osc checkout $OBS_PROJECT $NAME $CHANGES_FILE | ||
mv $CHANGES_FILE $FOLDER | ||
VERSION=${{ steps.latest-tag.outputs.tag }} | ||
hack/gh_release_to_obs_changeset.py $REPOSITORY -a [email protected] -t $VERSION -f $FOLDER/$CHANGES_FILE | ||
- name: Set version | ||
run: | | ||
git config --global --add safe.directory /__w/wanda/wanda | ||
VERSION=$(./hack/get_version_from_git.sh) | ||
# "+" character is not allowed in OBS dockerfile version strings | ||
VERSION=${VERSION//[+]/-} | ||
sed -i 's~%%VERSION%%~'"${VERSION}"'~' packaging/suse/Dockerfile | ||
- name: Commit on OBS | ||
run: | | ||
OBS_PACKAGE=$OBS_PROJECT/$NAME | ||
osc checkout $OBS_PACKAGE -o $DEST_FOLDER | ||
cp -r packaging/suse/* $DEST_FOLDER | ||
tar --transform 's,^./,/wanda/,' -zcvf $DEST_FOLDER/wanda.tar.gz --exclude=./.git ./* | ||
cd $DEST_FOLDER | ||
osc ar | ||
osc commit -m "New development version of $NAME released" |