From 7dfef0140ad1b09d7091ffc2db958a0c00b8f215 Mon Sep 17 00:00:00 2001 From: red031000 Date: Wed, 23 Dec 2020 19:21:52 +0000 Subject: initial try of github actions instead of travis --- .github/calcrom/.gitignore | 2 + .github/calcrom/Makefile | 17 +++++ .github/calcrom/calcrom.cpp | 153 ++++++++++++++++++++++++++++++++++++++++++++ .github/calcrom/webhook.sh | 19 ++++++ .github/workflows/build.yml | 47 ++++++++++++++ 5 files changed, 238 insertions(+) create mode 100644 .github/calcrom/.gitignore create mode 100644 .github/calcrom/Makefile create mode 100644 .github/calcrom/calcrom.cpp create mode 100644 .github/calcrom/webhook.sh create mode 100644 .github/workflows/build.yml diff --git a/.github/calcrom/.gitignore b/.github/calcrom/.gitignore new file mode 100644 index 00000000..e4016dbe --- /dev/null +++ b/.github/calcrom/.gitignore @@ -0,0 +1,2 @@ +calcrom +*.exe diff --git a/.github/calcrom/Makefile b/.github/calcrom/Makefile new file mode 100644 index 00000000..e3b6ff50 --- /dev/null +++ b/.github/calcrom/Makefile @@ -0,0 +1,17 @@ +CXX := g++ +CXXFLAGS := -O3 -std=c++11 + +ifeq ($(OS),Windows_NT) +EXE := .exe +else +EXE := +endif + +TARGET := calcrom$(EXE) + +.PHONY: all + +all: $(TARGET) + +$(TARGET): calcrom.cpp + $(CXX) $(CXXFLAGS) -o $@ $^ diff --git a/.github/calcrom/calcrom.cpp b/.github/calcrom/calcrom.cpp new file mode 100644 index 00000000..2947f5e7 --- /dev/null +++ b/.github/calcrom/calcrom.cpp @@ -0,0 +1,153 @@ +/* + * CALCROM.CPP + * © PikalaxALT 2020 + * + * Simple C++ executable to measure the completion rate of Pokémon Diamond + * reverse engineering (decompilation). + * + * Requirements: + * - Must have C++11 compliant compiler. + * - MacOS X: Must provide elf.h on the include (-I) path. + * - Must be placed in ".travis/calcrom/". + * + * Changelog: + * - 0.1.0 (26 May 2020): + * Initial implementation + * - 0.1.1 (26 May 2020): + * Allow program to be run from wherever + * - 0.1.2 (27 May 2020): + * Extra security on ELF header + * - 0.1.3 (30 Jun 2020): + * Account for diamond/pearl split + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace std; + +struct Glob : public vector { + glob_t glob_result; +public: + Glob(string const & pattern) { + int result = glob(pattern.c_str(), GLOB_TILDE | GLOB_BRACE, NULL, &glob_result); + if (result) { + stringstream ss; + ss << "Glob(" << pattern << ") failed with error " << result << endl; + throw runtime_error(ss.str()); + } + assign(glob_result.gl_pathv, glob_result.gl_pathv + glob_result.gl_pathc); + }; + void operator~() { + globfree(&glob_result); + } +}; + +void analyze(string basedir, string subdir, string version) { + fstream elf; + Elf32_Ehdr ehdr; + vector shdr; + stringstream pattern; + + // Accumulate sizes + // src asm + // data _____|_____ + // text | + unsigned sizes[2][2] = {{0, 0}, {0, 0}}; + char * shstrtab = NULL; + size_t shstrsz = 0; + stringstream builddir; + builddir << subdir << "/build/" << version; + pattern << basedir << "/" << subdir << "/{src,asm,lib/{src,asm},modules/*/{src,asm}}/*.{c,s,cpp}"; + for (char const * & fname : Glob(pattern.str())) + { + string fname_s(fname); + string ext = fname_s.substr(fname_s.rfind('.'), 4); + bool is_asm = ext == ".s"; + fname_s = fname_s.replace(fname_s.find(subdir), 4, builddir.str()); + fname_s = fname_s.replace(fname_s.rfind('.'), 4, ".o"); + elf.open(fname_s, ios_base::in | ios_base::binary); + if (!elf.good()) { + cerr << "Error: file not found: " << fname_s << endl; + return; + } + elf.read((char *)&ehdr, sizeof(ehdr)); + if (memcmp(ehdr.e_ident, ELFMAG, SELFMAG) != 0 + || ehdr.e_ehsize != sizeof(Elf32_Ehdr) + || ehdr.e_shentsize != sizeof(Elf32_Shdr)) + { + elf.close(); + stringstream ss; + ss << "Error validating " << fname_s << " as an ELF file" << endl; + throw runtime_error(ss.str()); + } + // Read ELF sections + elf.seekg(ehdr.e_shoff); + shdr.resize(ehdr.e_shnum); + elf.read((char *)shdr.data(), ehdr.e_shnum * ehdr.e_shentsize); + + // Read .shstrtab + if (shstrsz < shdr[ehdr.e_shstrndx].sh_size) { + shstrtab = (char *)realloc(shstrtab, shdr[ehdr.e_shstrndx].sh_size); + shstrsz = shdr[ehdr.e_shstrndx].sh_size; + } + elf.seekg(shdr[ehdr.e_shstrndx].sh_offset); + elf.read(shstrtab, shdr[ehdr.e_shstrndx].sh_size); + elf.close(); + + // Analyze sections + for (Elf32_Shdr & hdr : shdr) { + string shname = shstrtab + hdr.sh_name; + bool is_text = (shname == ".text" || shname == ".init" || shname == ".itcm"); + bool is_data = (shname == ".data" || shname == ".rodata" || shname == ".sdata" || shname == ".dtcm"); + size_t size = hdr.sh_size + (hdr.sh_size & 3 ? 4 - (hdr.sh_size & 3) : 0); + if (is_text || is_data) + { + sizes[is_text][is_asm] += size; + } + } + } + free(shstrtab); + + cout << "Analysis of " << (version.empty() ? subdir : version) << " binary:" << endl; + // Report code + unsigned total_text = sizes[1][0] + sizes[1][1]; + double total_text_d = total_text; + double src_text_d = sizes[1][0]; + double asm_text_d = sizes[1][1]; + cout << " " << total_text << " total bytes of code" << endl; + cout << " " << sizes[1][0] << " bytes of code in src (" << (src_text_d / total_text_d * 100.0) << "%)" << endl; + cout << " " << sizes[1][1] << " bytes of code in asm (" << (asm_text_d / total_text_d * 100.0) << "%)" << endl; + cout << endl; + // Report data + unsigned total_data = sizes[0][0] + sizes[0][1]; + double total_data_d = total_data; + double src_data_d = sizes[0][0]; + double asm_data_d = sizes[0][1]; + cout << " " << total_data << " total bytes of data" << endl; + cout << " " << sizes[0][0] << " bytes of data in src (" << (src_data_d / total_data_d * 100.0) << "%)" << endl; + cout << " " << sizes[0][1] << " bytes of data in asm (" << (asm_data_d / total_data_d * 100.0) << "%)" << endl; + // Let vectors fall to gc +} + +int main(int argc, char ** argv) +{ + if (argc < 2) { + cout << "usage: calcrom PROJECT_DIR" << endl; + throw invalid_argument("missing required argument: PROJECT_DIR\n"); + } + + analyze(argv[1], "arm9", "diamond.us"); + cout << endl; + analyze(argv[1], "arm9", "pearl.us"); + cout << endl; + analyze(argv[1], "arm7", ""); + + return 0; +} diff --git a/.github/calcrom/webhook.sh b/.github/calcrom/webhook.sh new file mode 100644 index 00000000..fd12b64f --- /dev/null +++ b/.github/calcrom/webhook.sh @@ -0,0 +1,19 @@ +#!/bin/bash -ex + +# Only run this script if it's the master branch build. +if [[ "$GITHUB_REF" != "refs/head/master" || "$GITHUB_EVENT_NAME" != "push" ]]; then + exit 0 +fi + +build_name=$1 +url=$2 +map_file=$(dirname "$0")/../../arm9/build/diamond.us/arm9.elf.xMAP +if [ ! -f $map_file ]; then + echo "$map_file does not exist!" + exit 1 +fi + +make -C ${GITHUB_WORKSPACE}/.github/calcrom +output=$(${GITHUB_WORKSPACE}/.github/calcrom/calcrom ${GITHUB_WORKSPACE} | sed -E ':a;N;$!ba;s/\r{0,1}\n/\\n/g') +curl -d "{\"username\": \"$CALCROM_DISCORD_WEBHOOK_USERNAME\", \"avatar_url\": \"$url\", \"content\":\"\`\`\`$build_name progress:\\n$output\`\`\`\"}" -H "Content-Type: application/json" -X POST $CALCROM_DISCORD_WEBHOOK_URL +popd diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 00000000..8d06370e --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,47 @@ +name: build + +on: [push, pull_request] + +env: + LM_LICENSE_FILE: "$GITHUB_WORKSPACE/tools/mwccarm/license.dat" + CC: gcc-8 + CXX: g++-8 + CALCROM_DISCORD_WEBHOOK_AVATAR_URL: "https://i.imgur.com/38BQHdd.png" + CALCROM_DISCORD_WEBHOOK_USERNAME: OK + CALCROM_WEBHOOK_URL: ${{ secrets.WebhookUrl }} + + +jobs: + build: + runs-on: ubuntu-20.04 + + strategy: + matrix: + version: [diamond, pearl] + + steps: + - name: Update and Install Software + run: | + sudo apt update + sudo apt -y upgrade + sudo apt -y install g++-8-multilib linux-libc-dev binutils-arm-none-eabi wine32 wine-stable + - name: Checkout Repo + uses: actions/checkout@v2 + - name: Setup Repo + run: | + mkdir -p $HOME/download + cd $HOME/download + wget http://private.martmists.com/mwccarm.zip + wget http://private.martmists.com/nitro.tar.gz + unzip mwccarm.zip + mv mwccarm $GITHUB_WORKSPACE/tools + tar xzf nitro.tar.gz + mv tools/bin $GITHUB_WORKSPACE/tools + mv include/nitro/specfiles/ARM7-TS.lcf.template $GITHUB_WORKSPACE/arm7 + mv include/nitro/specfiles/ARM9-TS.lcf.template $GITHUB_WORKSPACE/arm9 + working-directory: $HOME + - name: Build + run: make ${{ matrix.version }} + - name: Webhook + run: .github/calcrom/calcrom.sh pokediamond "$CALCROM_WEBHOOK_URL" + continue-on-error: true -- cgit v1.2.3 From 37d851b4db9676801f3402c31cdb9cf950aeff70 Mon Sep 17 00:00:00 2001 From: red031000 Date: Wed, 23 Dec 2020 19:29:46 +0000 Subject: attempt to fix wine --- .github/workflows/build.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8d06370e..4b1d4629 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -24,7 +24,12 @@ jobs: run: | sudo apt update sudo apt -y upgrade - sudo apt -y install g++-8-multilib linux-libc-dev binutils-arm-none-eabi wine32 wine-stable + sudo apt -y install g++-8-multilib linux-libc-dev binutils-arm-none-eabi + sudo dpkg --add-architecture i386 + wget -qO - https://dl.winehq.org/wine-builds/winehq.key | sudo apt-key add - + sudo add-apt-repository ppa:cybermax-dexter/sdl2-backport + sudo apt-add-repository "deb https://dl.winehq.org/wine-builds/ubuntu $(lsb_release -cs) main" + sudo apt install --install-recommends winehq-stable - name: Checkout Repo uses: actions/checkout@v2 - name: Setup Repo -- cgit v1.2.3 From 6bc1bdcbb0d056e0ac910e85e0607799212f34d9 Mon Sep 17 00:00:00 2001 From: red031000 Date: Wed, 23 Dec 2020 19:34:45 +0000 Subject: change to 18.04 --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4b1d4629..9cfe2dec 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -13,7 +13,7 @@ env: jobs: build: - runs-on: ubuntu-20.04 + runs-on: ubuntu-18.04 strategy: matrix: -- cgit v1.2.3 From e0ab568aaa3c6ef77723382c144023073717010e Mon Sep 17 00:00:00 2001 From: red031000 Date: Wed, 23 Dec 2020 19:45:27 +0000 Subject: try to fix workspace reference --- .github/workflows/build.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9cfe2dec..cc0e07ea 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -3,7 +3,7 @@ name: build on: [push, pull_request] env: - LM_LICENSE_FILE: "$GITHUB_WORKSPACE/tools/mwccarm/license.dat" + LM_LICENSE_FILE: "${{ github.workspace }}/tools/mwccarm/license.dat" CC: gcc-8 CXX: g++-8 CALCROM_DISCORD_WEBHOOK_AVATAR_URL: "https://i.imgur.com/38BQHdd.png" @@ -39,11 +39,11 @@ jobs: wget http://private.martmists.com/mwccarm.zip wget http://private.martmists.com/nitro.tar.gz unzip mwccarm.zip - mv mwccarm $GITHUB_WORKSPACE/tools + mv mwccarm ${{ github.workspace }}/tools tar xzf nitro.tar.gz - mv tools/bin $GITHUB_WORKSPACE/tools - mv include/nitro/specfiles/ARM7-TS.lcf.template $GITHUB_WORKSPACE/arm7 - mv include/nitro/specfiles/ARM9-TS.lcf.template $GITHUB_WORKSPACE/arm9 + mv tools/bin ${{ github.workspace }}/tools + mv include/nitro/specfiles/ARM7-TS.lcf.template ${{ github.workspace }}/arm7 + mv include/nitro/specfiles/ARM9-TS.lcf.template ${{ github.workspace }}/arm9 working-directory: $HOME - name: Build run: make ${{ matrix.version }} -- cgit v1.2.3 From b4a660bf15e1ffe7a678b64aa1103f79d4a6d83e Mon Sep 17 00:00:00 2001 From: red031000 Date: Wed, 23 Dec 2020 19:55:43 +0000 Subject: fix home --- .github/workflows/build.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index cc0e07ea..a90ef1eb 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -3,7 +3,7 @@ name: build on: [push, pull_request] env: - LM_LICENSE_FILE: "${{ github.workspace }}/tools/mwccarm/license.dat" + LM_LICENSE_FILE: "$GITHUB_WORKSPACE/tools/mwccarm/license.dat" CC: gcc-8 CXX: g++-8 CALCROM_DISCORD_WEBHOOK_AVATAR_URL: "https://i.imgur.com/38BQHdd.png" @@ -34,17 +34,17 @@ jobs: uses: actions/checkout@v2 - name: Setup Repo run: | - mkdir -p $HOME/download - cd $HOME/download + mkdir -p ~/download + cd ~/download wget http://private.martmists.com/mwccarm.zip wget http://private.martmists.com/nitro.tar.gz unzip mwccarm.zip - mv mwccarm ${{ github.workspace }}/tools + mv mwccarm $GITHUB_WORKSPACE/tools tar xzf nitro.tar.gz - mv tools/bin ${{ github.workspace }}/tools - mv include/nitro/specfiles/ARM7-TS.lcf.template ${{ github.workspace }}/arm7 - mv include/nitro/specfiles/ARM9-TS.lcf.template ${{ github.workspace }}/arm9 - working-directory: $HOME + mv tools/bin $GITHUB_WORKSPACE/tools + mv include/nitro/specfiles/ARM7-TS.lcf.template $GITHUB_WORKSPACE/arm7 + mv include/nitro/specfiles/ARM9-TS.lcf.template $GITHUB_WORKSPACE/arm9 + working-directory: ~ - name: Build run: make ${{ matrix.version }} - name: Webhook -- cgit v1.2.3 From ff283a07b0188e9e807e3299e2e1a408de6bf9c9 Mon Sep 17 00:00:00 2001 From: red031000 Date: Wed, 23 Dec 2020 20:33:36 +0000 Subject: remove travis --- .github/workflows/build.yml | 2 +- .travis.yml | 41 ------------ .travis/calcrom/.gitignore | 2 - .travis/calcrom/Makefile | 17 ----- .travis/calcrom/calcrom.cpp | 153 -------------------------------------------- .travis/calcrom/webhook.sh | 18 ------ 6 files changed, 1 insertion(+), 232 deletions(-) delete mode 100644 .travis.yml delete mode 100644 .travis/calcrom/.gitignore delete mode 100644 .travis/calcrom/Makefile delete mode 100644 .travis/calcrom/calcrom.cpp delete mode 100755 .travis/calcrom/webhook.sh diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a90ef1eb..c6d6aec4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -48,5 +48,5 @@ jobs: - name: Build run: make ${{ matrix.version }} - name: Webhook - run: .github/calcrom/calcrom.sh pokediamond "$CALCROM_WEBHOOK_URL" + run: $GITHUB_WORKSPACE/.github/calcrom/webhook.sh pokediamond "$CALCROM_WEBHOOK_URL" continue-on-error: true diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index ac700082..00000000 --- a/.travis.yml +++ /dev/null @@ -1,41 +0,0 @@ -dist: bionic -os: linux -language: c -env: - global: - - LM_LICENSE_FILE="$TRAVIS_BUILD_DIR/tools/mwccarm/license.dat" - - CC=gcc-8 - - CXX=g++-8 -addons: - apt: - packages: - - g++-8-multilib - - linux-libc-dev - - binutils-arm-none-eabi - - wine32 - - wine-stable -cache: - apt: true -install: - # These files are only accessible from Travis CI IP Addresses to prevent piracy. - - mkdir -p $HOME/download - - pushd $HOME/download - - wget http://private.martmists.com/mwccarm.zip - - wget http://private.martmists.com/nitro.tar.gz - - unzip mwccarm.zip - - mv mwccarm $TRAVIS_BUILD_DIR/tools - - tar xzf nitro.tar.gz - - mv tools/bin $TRAVIS_BUILD_DIR/tools - - mv include/nitro/specfiles/ARM7-TS.lcf.template $TRAVIS_BUILD_DIR/arm7 - - mv include/nitro/specfiles/ARM9-TS.lcf.template $TRAVIS_BUILD_DIR/arm9 - - popd - -script: - - travis_retry make - - travis_retry make pearl - -notifications: - email: false - -after_success: - - .travis/calcrom/webhook.sh pokediamond diff --git a/.travis/calcrom/.gitignore b/.travis/calcrom/.gitignore deleted file mode 100644 index e4016dbe..00000000 --- a/.travis/calcrom/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -calcrom -*.exe diff --git a/.travis/calcrom/Makefile b/.travis/calcrom/Makefile deleted file mode 100644 index e3b6ff50..00000000 --- a/.travis/calcrom/Makefile +++ /dev/null @@ -1,17 +0,0 @@ -CXX := g++ -CXXFLAGS := -O3 -std=c++11 - -ifeq ($(OS),Windows_NT) -EXE := .exe -else -EXE := -endif - -TARGET := calcrom$(EXE) - -.PHONY: all - -all: $(TARGET) - -$(TARGET): calcrom.cpp - $(CXX) $(CXXFLAGS) -o $@ $^ diff --git a/.travis/calcrom/calcrom.cpp b/.travis/calcrom/calcrom.cpp deleted file mode 100644 index 2947f5e7..00000000 --- a/.travis/calcrom/calcrom.cpp +++ /dev/null @@ -1,153 +0,0 @@ -/* - * CALCROM.CPP - * © PikalaxALT 2020 - * - * Simple C++ executable to measure the completion rate of Pokémon Diamond - * reverse engineering (decompilation). - * - * Requirements: - * - Must have C++11 compliant compiler. - * - MacOS X: Must provide elf.h on the include (-I) path. - * - Must be placed in ".travis/calcrom/". - * - * Changelog: - * - 0.1.0 (26 May 2020): - * Initial implementation - * - 0.1.1 (26 May 2020): - * Allow program to be run from wherever - * - 0.1.2 (27 May 2020): - * Extra security on ELF header - * - 0.1.3 (30 Jun 2020): - * Account for diamond/pearl split - */ - -#include -#include -#include -#include -#include -#include -#include -#include - -using namespace std; - -struct Glob : public vector { - glob_t glob_result; -public: - Glob(string const & pattern) { - int result = glob(pattern.c_str(), GLOB_TILDE | GLOB_BRACE, NULL, &glob_result); - if (result) { - stringstream ss; - ss << "Glob(" << pattern << ") failed with error " << result << endl; - throw runtime_error(ss.str()); - } - assign(glob_result.gl_pathv, glob_result.gl_pathv + glob_result.gl_pathc); - }; - void operator~() { - globfree(&glob_result); - } -}; - -void analyze(string basedir, string subdir, string version) { - fstream elf; - Elf32_Ehdr ehdr; - vector shdr; - stringstream pattern; - - // Accumulate sizes - // src asm - // data _____|_____ - // text | - unsigned sizes[2][2] = {{0, 0}, {0, 0}}; - char * shstrtab = NULL; - size_t shstrsz = 0; - stringstream builddir; - builddir << subdir << "/build/" << version; - pattern << basedir << "/" << subdir << "/{src,asm,lib/{src,asm},modules/*/{src,asm}}/*.{c,s,cpp}"; - for (char const * & fname : Glob(pattern.str())) - { - string fname_s(fname); - string ext = fname_s.substr(fname_s.rfind('.'), 4); - bool is_asm = ext == ".s"; - fname_s = fname_s.replace(fname_s.find(subdir), 4, builddir.str()); - fname_s = fname_s.replace(fname_s.rfind('.'), 4, ".o"); - elf.open(fname_s, ios_base::in | ios_base::binary); - if (!elf.good()) { - cerr << "Error: file not found: " << fname_s << endl; - return; - } - elf.read((char *)&ehdr, sizeof(ehdr)); - if (memcmp(ehdr.e_ident, ELFMAG, SELFMAG) != 0 - || ehdr.e_ehsize != sizeof(Elf32_Ehdr) - || ehdr.e_shentsize != sizeof(Elf32_Shdr)) - { - elf.close(); - stringstream ss; - ss << "Error validating " << fname_s << " as an ELF file" << endl; - throw runtime_error(ss.str()); - } - // Read ELF sections - elf.seekg(ehdr.e_shoff); - shdr.resize(ehdr.e_shnum); - elf.read((char *)shdr.data(), ehdr.e_shnum * ehdr.e_shentsize); - - // Read .shstrtab - if (shstrsz < shdr[ehdr.e_shstrndx].sh_size) { - shstrtab = (char *)realloc(shstrtab, shdr[ehdr.e_shstrndx].sh_size); - shstrsz = shdr[ehdr.e_shstrndx].sh_size; - } - elf.seekg(shdr[ehdr.e_shstrndx].sh_offset); - elf.read(shstrtab, shdr[ehdr.e_shstrndx].sh_size); - elf.close(); - - // Analyze sections - for (Elf32_Shdr & hdr : shdr) { - string shname = shstrtab + hdr.sh_name; - bool is_text = (shname == ".text" || shname == ".init" || shname == ".itcm"); - bool is_data = (shname == ".data" || shname == ".rodata" || shname == ".sdata" || shname == ".dtcm"); - size_t size = hdr.sh_size + (hdr.sh_size & 3 ? 4 - (hdr.sh_size & 3) : 0); - if (is_text || is_data) - { - sizes[is_text][is_asm] += size; - } - } - } - free(shstrtab); - - cout << "Analysis of " << (version.empty() ? subdir : version) << " binary:" << endl; - // Report code - unsigned total_text = sizes[1][0] + sizes[1][1]; - double total_text_d = total_text; - double src_text_d = sizes[1][0]; - double asm_text_d = sizes[1][1]; - cout << " " << total_text << " total bytes of code" << endl; - cout << " " << sizes[1][0] << " bytes of code in src (" << (src_text_d / total_text_d * 100.0) << "%)" << endl; - cout << " " << sizes[1][1] << " bytes of code in asm (" << (asm_text_d / total_text_d * 100.0) << "%)" << endl; - cout << endl; - // Report data - unsigned total_data = sizes[0][0] + sizes[0][1]; - double total_data_d = total_data; - double src_data_d = sizes[0][0]; - double asm_data_d = sizes[0][1]; - cout << " " << total_data << " total bytes of data" << endl; - cout << " " << sizes[0][0] << " bytes of data in src (" << (src_data_d / total_data_d * 100.0) << "%)" << endl; - cout << " " << sizes[0][1] << " bytes of data in asm (" << (asm_data_d / total_data_d * 100.0) << "%)" << endl; - // Let vectors fall to gc -} - -int main(int argc, char ** argv) -{ - if (argc < 2) { - cout << "usage: calcrom PROJECT_DIR" << endl; - throw invalid_argument("missing required argument: PROJECT_DIR\n"); - } - - analyze(argv[1], "arm9", "diamond.us"); - cout << endl; - analyze(argv[1], "arm9", "pearl.us"); - cout << endl; - analyze(argv[1], "arm7", ""); - - return 0; -} diff --git a/.travis/calcrom/webhook.sh b/.travis/calcrom/webhook.sh deleted file mode 100755 index 66f141b6..00000000 --- a/.travis/calcrom/webhook.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash -ex - -# Only run this script if it's the master branch build. -if [[ "$TRAVIS_BRANCH" != "master" || "$TRAVIS_PULL_REQUEST" != "false" ]]; then - exit 0 -fi - -build_name=$1 -map_file=$(dirname "$0")/../../arm9/build/diamond.us/arm9.elf.xMAP -if [ ! -f $map_file ]; then - echo "$map_file does not exist!" - exit 1 -fi - -make -C ${TRAVIS_BUILD_DIR}/.travis/calcrom -output=$(${TRAVIS_BUILD_DIR}/.travis/calcrom/calcrom ${TRAVIS_BUILD_DIR} | sed -E ':a;N;$!ba;s/\r{0,1}\n/\\n/g') -curl -d "{\"username\": \"$CALCROM_DISCORD_WEBHOOK_USERNAME\", \"avatar_url\": \"$CALCROM_DISCORD_WEBHOOK_AVATAR_URL\", \"content\":\"\`\`\`$build_name progress:\\n$output\`\`\`\"}" -H "Content-Type: application/json" -X POST $CALCROM_DISCORD_WEBHOOK_URL -popd -- cgit v1.2.3 From 6063c0d5ae8a436edae37979217b27135e6bfc5f Mon Sep 17 00:00:00 2001 From: red031000 Date: Wed, 23 Dec 2020 20:37:57 +0000 Subject: fix webhook url --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c6d6aec4..4b91dccb 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -8,7 +8,7 @@ env: CXX: g++-8 CALCROM_DISCORD_WEBHOOK_AVATAR_URL: "https://i.imgur.com/38BQHdd.png" CALCROM_DISCORD_WEBHOOK_USERNAME: OK - CALCROM_WEBHOOK_URL: ${{ secrets.WebhookUrl }} + CALCROM_WEBHOOK_URL: ${{ secrets.WEBHOOKURL }} jobs: -- cgit v1.2.3 From a13ce0a41c77dfc31bbbf5478d6443b73c1387a5 Mon Sep 17 00:00:00 2001 From: red031000 Date: Wed, 23 Dec 2020 20:54:28 +0000 Subject: chmod 755 --- .github/workflows/build.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4b91dccb..9666cbdd 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -48,5 +48,7 @@ jobs: - name: Build run: make ${{ matrix.version }} - name: Webhook - run: $GITHUB_WORKSPACE/.github/calcrom/webhook.sh pokediamond "$CALCROM_WEBHOOK_URL" + run: | + sudo chmod 755 $GITHUB_WORKSPACE/.github/calcrom/webhook.sh + $GITHUB_WORKSPACE/.github/calcrom/webhook.sh pokediamond "$CALCROM_WEBHOOK_URL" continue-on-error: true -- cgit v1.2.3 From 402e915ff5045ba1983973b1dd3a323c2dfcc567 Mon Sep 17 00:00:00 2001 From: red031000 Date: Wed, 23 Dec 2020 21:09:38 +0000 Subject: fix reference --- .github/calcrom/webhook.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/calcrom/webhook.sh b/.github/calcrom/webhook.sh index fd12b64f..8ebb0e20 100644 --- a/.github/calcrom/webhook.sh +++ b/.github/calcrom/webhook.sh @@ -1,7 +1,7 @@ #!/bin/bash -ex # Only run this script if it's the master branch build. -if [[ "$GITHUB_REF" != "refs/head/master" || "$GITHUB_EVENT_NAME" != "push" ]]; then +if [[ "$GITHUB_REF" != "refs/heads/master" || "$GITHUB_EVENT_NAME" != "push" ]]; then exit 0 fi -- cgit v1.2.3